@blocklet/ui-react 3.1.26 → 3.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/@types/index.d.ts +1 -1
- package/lib/Footer/links.js +26 -33
- package/lib/UserCenter/components/fallback.d.ts +8 -0
- package/lib/UserCenter/components/fallback.js +21 -0
- package/lib/UserCenter/components/user-center.js +205 -200
- package/lib/UserCenter/components/user-info/social-actions/chat.d.ts +5 -0
- package/lib/UserCenter/components/user-info/social-actions/chat.js +24 -0
- package/lib/UserCenter/components/user-info/social-actions/follow.d.ts +2 -0
- package/lib/UserCenter/components/user-info/social-actions/follow.js +19 -0
- package/lib/UserCenter/components/user-info/social-actions/index.d.ts +5 -0
- package/lib/UserCenter/components/user-info/social-actions/index.js +13 -0
- package/lib/UserCenter/components/user-info/user-basic-info.js +37 -35
- package/lib/UserCenter/libs/locales.d.ts +14 -0
- package/lib/UserCenter/libs/locales.js +16 -2
- package/lib/blocklets.js +56 -54
- package/lib/contexts/user-followers.d.ts +13 -0
- package/lib/contexts/user-followers.js +40 -0
- package/lib/hooks/use-follow.d.ts +12 -0
- package/lib/hooks/use-follow.js +47 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +37 -36
- package/package.json +6 -6
- package/src/@types/index.ts +1 -1
- package/src/Footer/links.jsx +10 -7
- package/src/UserCenter/components/fallback.tsx +51 -0
- package/src/UserCenter/components/user-center.tsx +22 -12
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +42 -0
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +30 -0
- package/src/UserCenter/components/user-info/social-actions/index.tsx +17 -0
- package/src/UserCenter/components/user-info/user-basic-info.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +14 -0
- package/src/blocklets.js +5 -1
- package/src/contexts/user-followers.tsx +54 -0
- package/src/hooks/use-follow.tsx +74 -0
- package/src/utils.js +5 -0
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as r, jsxs as
|
|
2
|
-
import { use as
|
|
3
|
-
import { Box as
|
|
4
|
-
import { useMemoizedFn as y, useCreation as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { SessionContext as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { useConfirm as
|
|
13
|
-
import { translate as
|
|
1
|
+
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { use as ve, isValidElement as K, cloneElement as X, Children as we } from "react";
|
|
3
|
+
import { Box as d, Typography as ye, CircularProgress as ke, Divider as Ce } from "@mui/material";
|
|
4
|
+
import { useMemoizedFn as y, useCreation as a, useRequest as Y } from "ahooks";
|
|
5
|
+
import Pe from "p-wait-for";
|
|
6
|
+
import Z from "react-helmet";
|
|
7
|
+
import { SessionContext as Me } from "@arcblock/did-connect-react/lib/Session";
|
|
8
|
+
import Se from "@arcblock/ux/lib/Tabs";
|
|
9
|
+
import ee from "@arcblock/ux/lib/Empty";
|
|
10
|
+
import De from "@arcblock/ux/lib/Button";
|
|
11
|
+
import Te from "@arcblock/ux/lib/Result";
|
|
12
|
+
import { useConfirm as ze } from "@arcblock/ux/lib/Dialog";
|
|
13
|
+
import { translate as Fe } from "@arcblock/ux/lib/Locale/util";
|
|
14
14
|
import { useLocaleContext as We } from "@arcblock/ux/lib/Locale/context";
|
|
15
|
-
import { ErrorFallback as
|
|
16
|
-
import { styled as
|
|
17
|
-
import
|
|
18
|
-
import { joinURL as
|
|
19
|
-
import { PROFILE_URL as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { translations as
|
|
15
|
+
import { ErrorFallback as Ue } from "@arcblock/ux/lib/ErrorBoundary";
|
|
16
|
+
import { styled as de } from "@arcblock/ux/lib/Theme";
|
|
17
|
+
import Ae from "lodash/cloneDeep";
|
|
18
|
+
import { joinURL as k, getQuery as Le, withoutTrailingSlash as re, withQuery as te } from "ufo";
|
|
19
|
+
import { PROFILE_URL as C } from "@arcblock/ux/lib/Util/constant";
|
|
20
|
+
import Be from "../../Footer/index.js";
|
|
21
|
+
import ie from "../../Header/index.js";
|
|
22
|
+
import { translations as Ie } from "../libs/locales.js";
|
|
23
23
|
import oe from "./user-info/user-basic-info.js";
|
|
24
24
|
import "@mui/icons-material";
|
|
25
25
|
import "@iconify/react";
|
|
@@ -31,15 +31,17 @@ import "@iconify-icons/material-symbols/settings-input-antenna-rounded";
|
|
|
31
31
|
import "@arcblock/ux/lib/RelativeTime";
|
|
32
32
|
import "@arcblock/ux/lib/UserCard/Content/shorten-label";
|
|
33
33
|
import "./user-info/switch-role.js";
|
|
34
|
-
import { formatBlockletInfo as
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import { client as
|
|
38
|
-
import
|
|
39
|
-
import { ConfigUserSpaceProvider as
|
|
34
|
+
import { formatBlockletInfo as je, getLink as P, getLocalizedNavigation as He } from "../../blocklets.js";
|
|
35
|
+
import Ne from "./passport.js";
|
|
36
|
+
import Ee from "./settings.js";
|
|
37
|
+
import { client as ne } from "../../libs/client.js";
|
|
38
|
+
import _e from "../../hooks/use-mobile.js";
|
|
39
|
+
import { ConfigUserSpaceProvider as Oe } from "../../contexts/config-user-space.js";
|
|
40
40
|
import Re from "./storage/index.js";
|
|
41
|
-
import
|
|
42
|
-
|
|
41
|
+
import $e from "./nft.js";
|
|
42
|
+
import { UserFollowersProvider as se } from "../../contexts/user-followers.js";
|
|
43
|
+
import qe from "./fallback.js";
|
|
44
|
+
const D = k(C, "/nfts"), T = k(C, "/settings"), z = k(C, "/did-spaces"), le = k(C, "/user-followers"), ae = de(d)(({ theme: v }) => ({
|
|
43
45
|
flex: 1,
|
|
44
46
|
boxSizing: "border-box",
|
|
45
47
|
padding: "0 16px",
|
|
@@ -53,7 +55,7 @@ const T = C(k, "/nfts"), z = C(k, "/settings"), W = C(k, "/did-spaces"), ae = le
|
|
|
53
55
|
[v.breakpoints.up("md")]: {
|
|
54
56
|
flexDirection: "row"
|
|
55
57
|
}
|
|
56
|
-
})),
|
|
58
|
+
})), F = de(d)(({ theme: v }) => ({
|
|
57
59
|
overflow: "hidden",
|
|
58
60
|
flex: "revert",
|
|
59
61
|
[v.breakpoints.up("md")]: {
|
|
@@ -65,46 +67,46 @@ const T = C(k, "/nfts"), z = C(k, "/settings"), W = C(k, "/did-spaces"), ae = le
|
|
|
65
67
|
}
|
|
66
68
|
}
|
|
67
69
|
}));
|
|
68
|
-
function
|
|
70
|
+
function jr({
|
|
69
71
|
children: v,
|
|
70
|
-
notLoginContent:
|
|
71
|
-
currentTab:
|
|
72
|
-
contentProps:
|
|
73
|
-
disableAutoRedirect:
|
|
74
|
-
hideFooter:
|
|
75
|
-
headerProps:
|
|
76
|
-
footerProps:
|
|
77
|
-
userDid:
|
|
78
|
-
stickySidebar:
|
|
79
|
-
embed:
|
|
72
|
+
notLoginContent: W = null,
|
|
73
|
+
currentTab: b,
|
|
74
|
+
contentProps: U = {},
|
|
75
|
+
disableAutoRedirect: A = !1,
|
|
76
|
+
hideFooter: ue = !1,
|
|
77
|
+
headerProps: ce = {},
|
|
78
|
+
footerProps: fe = {},
|
|
79
|
+
userDid: M = void 0,
|
|
80
|
+
stickySidebar: L = !1,
|
|
81
|
+
embed: B = !1,
|
|
80
82
|
onlyProfile: w = !1,
|
|
81
83
|
// 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
|
|
82
|
-
onDestroySelf:
|
|
84
|
+
onDestroySelf: pe = void 0
|
|
83
85
|
}) {
|
|
84
|
-
const { locale:
|
|
85
|
-
if (
|
|
86
|
-
return
|
|
87
|
-
const e = window.location.href, t =
|
|
88
|
-
return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did :
|
|
89
|
-
}, [
|
|
86
|
+
const { locale: h } = We(), u = _e({ key: "md" }), p = y((e, t = {}) => Fe(Ie, e, h, "en", t)), o = ve(Me)?.session, x = a(() => {
|
|
87
|
+
if (M)
|
|
88
|
+
return M;
|
|
89
|
+
const e = window.location.href, t = Le(e);
|
|
90
|
+
return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did : o?.user?.did;
|
|
91
|
+
}, [o?.user?.did, M]), i = a(() => o?.user ? x === o?.user?.did : !1, [x, o?.user?.did]), n = Y(
|
|
90
92
|
// eslint-disable-next-line consistent-return
|
|
91
93
|
async () => {
|
|
92
|
-
if (await
|
|
93
|
-
return
|
|
94
|
-
if (
|
|
95
|
-
return
|
|
94
|
+
if (await Pe(() => o?.initialized), i)
|
|
95
|
+
return o.user;
|
|
96
|
+
if (x)
|
|
97
|
+
return ne.user.getUserPublicInfo({ did: x });
|
|
96
98
|
},
|
|
97
99
|
{
|
|
98
|
-
refreshDeps: [
|
|
100
|
+
refreshDeps: [x, i, o?.initialized, o?.user]
|
|
99
101
|
}
|
|
100
|
-
),
|
|
101
|
-
async () =>
|
|
102
|
+
), I = y(() => i ? o.refresh() : n.refresh()), g = Y(
|
|
103
|
+
async () => n.data && b ? await ne.user.getUserPrivacyConfig({ did: x }) : null,
|
|
102
104
|
{
|
|
103
|
-
refreshDeps: [
|
|
105
|
+
refreshDeps: [x, n.data, b],
|
|
104
106
|
loadingDelay: 300
|
|
105
107
|
}
|
|
106
|
-
), { confirmHolder:
|
|
107
|
-
fullScreen:
|
|
108
|
+
), { confirmHolder: j } = ze({
|
|
109
|
+
fullScreen: u,
|
|
108
110
|
sx: {
|
|
109
111
|
".MuiDialog-paper": {
|
|
110
112
|
borderRadius: 1,
|
|
@@ -123,81 +125,90 @@ function Br({
|
|
|
123
125
|
}
|
|
124
126
|
}
|
|
125
127
|
}
|
|
126
|
-
}),
|
|
127
|
-
const e =
|
|
128
|
+
}), H = a(() => {
|
|
129
|
+
const e = Ae(window.blocklet);
|
|
128
130
|
try {
|
|
129
|
-
return
|
|
131
|
+
return je(e);
|
|
130
132
|
} catch (t) {
|
|
131
133
|
return console.error("Failed to format blocklet info", t, e), e;
|
|
132
134
|
}
|
|
133
|
-
}, []),
|
|
135
|
+
}, []), N = a(() => {
|
|
134
136
|
const e = {
|
|
135
|
-
label:
|
|
137
|
+
label: p("common.nft"),
|
|
136
138
|
protected: !1,
|
|
137
139
|
isPrivate: !1,
|
|
138
140
|
// true: 隐私数据,仅自己可见
|
|
139
|
-
value:
|
|
140
|
-
url: D
|
|
141
|
+
value: D,
|
|
142
|
+
url: P(D, h)
|
|
143
|
+
}, t = {
|
|
144
|
+
label: p("userFollowers"),
|
|
145
|
+
protected: !1,
|
|
146
|
+
isPrivate: !1,
|
|
147
|
+
value: le,
|
|
148
|
+
url: P(le, h)
|
|
141
149
|
};
|
|
142
|
-
let
|
|
143
|
-
return
|
|
150
|
+
let f = [e, t];
|
|
151
|
+
return i && (f = [
|
|
144
152
|
e,
|
|
145
153
|
{
|
|
146
|
-
label:
|
|
154
|
+
label: p("common.setting"),
|
|
147
155
|
protected: !0,
|
|
148
156
|
isPrivate: !0,
|
|
149
|
-
value:
|
|
150
|
-
url:
|
|
157
|
+
value: T,
|
|
158
|
+
url: P(T, h)
|
|
151
159
|
},
|
|
152
160
|
{
|
|
153
|
-
label:
|
|
161
|
+
label: p("storageManagement"),
|
|
154
162
|
protected: !0,
|
|
155
163
|
isPrivate: !0,
|
|
156
|
-
value:
|
|
157
|
-
url:
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
value: z,
|
|
165
|
+
url: P(z, h)
|
|
166
|
+
},
|
|
167
|
+
t
|
|
168
|
+
]), f;
|
|
169
|
+
}, [i, h]), l = a(() => {
|
|
170
|
+
const e = H?.navigation?.userCenter || [];
|
|
171
|
+
return (He(e, h) || []).concat(N).map((c) => {
|
|
172
|
+
const J = c.value ?? c._rawLink ?? c.link ?? c.url;
|
|
164
173
|
return {
|
|
165
|
-
value:
|
|
166
|
-
label:
|
|
167
|
-
url:
|
|
168
|
-
protected:
|
|
169
|
-
isPrivate:
|
|
174
|
+
value: J,
|
|
175
|
+
label: c.title || c.label,
|
|
176
|
+
url: c.link || c.url,
|
|
177
|
+
protected: g?.data?.[J] ?? !1,
|
|
178
|
+
isPrivate: c.isPrivate || c.private || (c?._rawLink?.includes("/customer") ?? !1),
|
|
170
179
|
// FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
|
|
180
|
+
followersOnly: c.component === "did-comments"
|
|
181
|
+
// 是否开启仅粉丝可查看的功能,目前只对 discuss kit 开启
|
|
171
182
|
// icon: x.icon,
|
|
172
183
|
};
|
|
173
|
-
}).filter((
|
|
174
|
-
}, [
|
|
175
|
-
const e = window.blocklet?.appName,
|
|
176
|
-
return e ? `${
|
|
177
|
-
}, [
|
|
184
|
+
}).filter((c) => i || !c.isPrivate);
|
|
185
|
+
}, [H, n.data, g?.data, h, N, i]), s = a(() => l.find((e) => re(e.value) === re(b)), [l]), E = a(() => {
|
|
186
|
+
const e = window.blocklet?.appName, f = [s?.label, p("userCenter.title")].filter(Boolean).join("-");
|
|
187
|
+
return e ? `${f} | ${e}` : f;
|
|
188
|
+
}, [s, p]), me = y((e) => e && (K(e) ? X(e, {
|
|
178
189
|
...e.props || {},
|
|
179
190
|
userCenterTabs: l
|
|
180
|
-
}) :
|
|
191
|
+
}) : we.map(e, (t) => K(t) ? X(t, {
|
|
181
192
|
...t.props || {},
|
|
182
193
|
userCenterTabs: l
|
|
183
|
-
}) : t))),
|
|
184
|
-
const t = l.find((
|
|
185
|
-
t && (window.location.href =
|
|
186
|
-
did:
|
|
194
|
+
}) : t))), he = y((e) => {
|
|
195
|
+
const t = l.find((f) => f.value === e);
|
|
196
|
+
t && (window.location.href = te(t.url, {
|
|
197
|
+
did: i ? void 0 : x
|
|
187
198
|
}));
|
|
188
|
-
}),
|
|
189
|
-
|
|
199
|
+
}), _ = a(() => /* @__PURE__ */ r(
|
|
200
|
+
Ee,
|
|
190
201
|
{
|
|
191
|
-
user:
|
|
202
|
+
user: n.data,
|
|
192
203
|
settings: { userCenterTabs: l },
|
|
193
|
-
onSave: async (e) => e === "privacy" ? (await
|
|
194
|
-
isMobile:
|
|
195
|
-
onDestroySelf:
|
|
204
|
+
onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await o.refresh(), null),
|
|
205
|
+
isMobile: u,
|
|
206
|
+
onDestroySelf: pe
|
|
196
207
|
}
|
|
197
|
-
), [
|
|
198
|
-
|
|
199
|
-
}),
|
|
200
|
-
|
|
208
|
+
), [n.data, l, g.data, g.runAsync]), O = a(() => s && s?.value === T, [s]), R = a(() => s && s?.value === k(C, "/profile") || s?.value === D, [s]), xe = a(() => s && s?.value === z, [s]), ge = o.useOAuth(), be = o.usePasskey(), $ = y(() => {
|
|
209
|
+
o?.user?.sourceProvider === "passkey" ? be.switchPassport(o.user) : ["google", "apple", "email", "github"].includes(o?.user?.sourceProvider ?? "") ? ge.switchOAuthPassport(o.user) : o && o.switchPassport();
|
|
210
|
+
}), S = a(() => R ? /* @__PURE__ */ m(
|
|
211
|
+
d,
|
|
201
212
|
{
|
|
202
213
|
sx: {
|
|
203
214
|
display: "flex",
|
|
@@ -205,37 +216,37 @@ function Br({
|
|
|
205
216
|
gap: 2.5
|
|
206
217
|
},
|
|
207
218
|
children: [
|
|
208
|
-
|
|
219
|
+
i ? /* @__PURE__ */ m(d, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
|
|
209
220
|
/* @__PURE__ */ r(
|
|
210
|
-
|
|
221
|
+
ye,
|
|
211
222
|
{
|
|
212
223
|
sx: {
|
|
213
224
|
color: "text.primary",
|
|
214
225
|
fontWeight: 600,
|
|
215
226
|
mb: 2.5
|
|
216
227
|
},
|
|
217
|
-
children:
|
|
228
|
+
children: p("passport")
|
|
218
229
|
}
|
|
219
230
|
),
|
|
220
|
-
/* @__PURE__ */ r(
|
|
231
|
+
/* @__PURE__ */ r(Ne, { user: n.data })
|
|
221
232
|
] }) : null,
|
|
222
|
-
/* @__PURE__ */ r(
|
|
233
|
+
/* @__PURE__ */ r($e, { user: n.data })
|
|
223
234
|
]
|
|
224
235
|
}
|
|
225
|
-
) : O &&
|
|
226
|
-
|
|
236
|
+
) : O && i ? _ : xe && i ? /* @__PURE__ */ r(Oe, { children: /* @__PURE__ */ r(Re, {}) }) : null, [O, R, n, i, L, _]), q = a(() => /* @__PURE__ */ r(
|
|
237
|
+
d,
|
|
227
238
|
{
|
|
228
239
|
sx: {
|
|
229
240
|
display: {
|
|
230
|
-
xs:
|
|
241
|
+
xs: i ? "none" : "block",
|
|
231
242
|
md: "block"
|
|
232
243
|
},
|
|
233
244
|
py: 3
|
|
234
245
|
},
|
|
235
|
-
children: /* @__PURE__ */ r(
|
|
246
|
+
children: /* @__PURE__ */ r(ee, { children: p("emptyContent") })
|
|
236
247
|
}
|
|
237
|
-
), [
|
|
238
|
-
|
|
248
|
+
), [i, h]), G = a(() => !g.data || g.loading ? /* @__PURE__ */ r(
|
|
249
|
+
d,
|
|
239
250
|
{
|
|
240
251
|
sx: {
|
|
241
252
|
height: "100%",
|
|
@@ -246,27 +257,21 @@ function Br({
|
|
|
246
257
|
alignItems: "center",
|
|
247
258
|
flex: 1
|
|
248
259
|
},
|
|
249
|
-
children: /* @__PURE__ */ r(
|
|
260
|
+
children: /* @__PURE__ */ r(ke, {})
|
|
250
261
|
}
|
|
251
|
-
) : (
|
|
252
|
-
|
|
253
|
-
/* @__PURE__ */ r(a, { sx: { flex: 1 }, children: o?.protected && !n ? /* @__PURE__ */ r(a, { children: /* @__PURE__ */ r(S, { children: f("underProtected") }) }) : (
|
|
254
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
255
|
-
/* @__PURE__ */ r(X, { children: v ? /* @__PURE__ */ r(a, { ...B, children: pe(v) }) : /* @__PURE__ */ r(X, { children: M }) })
|
|
256
|
-
) })
|
|
257
|
-
), [h, o, n, v, B, M, b]), V = c(() => {
|
|
258
|
-
if (s.loading || i.loading)
|
|
262
|
+
) : /* @__PURE__ */ r(d, { sx: { flex: 1 }, children: /* @__PURE__ */ r(qe, { currentActiveTab: s, isMyself: i, children: v ? /* @__PURE__ */ r(d, { ...U, children: me(v) }) : S }) }), [g, s, i, v, U, S, h]), Q = a(() => {
|
|
263
|
+
if (n.loading || o.loading)
|
|
259
264
|
return null;
|
|
260
|
-
if (
|
|
261
|
-
if (
|
|
262
|
-
return /* @__PURE__ */ r(
|
|
263
|
-
const
|
|
264
|
-
message:
|
|
265
|
+
if (n.error) {
|
|
266
|
+
if (n.error?.response?.status === 404)
|
|
267
|
+
return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Te, { status: 404, description: p("noUserFound") }) });
|
|
268
|
+
const f = {
|
|
269
|
+
message: n.error.response?.data?.error || n.error.message || "error occurred"
|
|
265
270
|
};
|
|
266
|
-
return /* @__PURE__ */ r(
|
|
271
|
+
return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ue, { error: f }) });
|
|
267
272
|
}
|
|
268
|
-
return !
|
|
269
|
-
|
|
273
|
+
return !x && !n.data ? W || /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
|
|
274
|
+
d,
|
|
270
275
|
{
|
|
271
276
|
sx: {
|
|
272
277
|
display: "flex",
|
|
@@ -276,54 +281,54 @@ function Br({
|
|
|
276
281
|
gap: 1
|
|
277
282
|
},
|
|
278
283
|
children: [
|
|
279
|
-
/* @__PURE__ */ r(
|
|
280
|
-
/* @__PURE__ */ r(
|
|
284
|
+
/* @__PURE__ */ r(ee, { children: p("viewAfterLogin") }),
|
|
285
|
+
/* @__PURE__ */ r(De, { size: "small", variant: "contained", onClick: () => o.login(), children: p("loginNow") })
|
|
281
286
|
]
|
|
282
287
|
}
|
|
283
|
-
) }) :
|
|
284
|
-
l.length > 0 &&
|
|
285
|
-
|
|
288
|
+
) }) : B ? /* @__PURE__ */ m(F, { children: [
|
|
289
|
+
l.length > 0 && b ? /* @__PURE__ */ r(
|
|
290
|
+
d,
|
|
286
291
|
{
|
|
287
292
|
sx: {
|
|
288
|
-
display:
|
|
293
|
+
display: u ? "block" : "flex",
|
|
289
294
|
height: "100%",
|
|
290
295
|
overflow: "auto",
|
|
291
296
|
padding: "1px"
|
|
292
297
|
},
|
|
293
|
-
children:
|
|
298
|
+
children: G
|
|
294
299
|
}
|
|
295
300
|
) : null,
|
|
296
|
-
l.length === 0 &&
|
|
297
|
-
] }) : w ? /* @__PURE__ */ r(
|
|
301
|
+
l.length === 0 && q
|
|
302
|
+
] }) : w ? /* @__PURE__ */ r(F, { display: "flex", flexDirection: u ? "column" : "row", children: /* @__PURE__ */ r(
|
|
298
303
|
oe,
|
|
299
304
|
{
|
|
300
|
-
isMobile:
|
|
301
|
-
order:
|
|
302
|
-
isMyself:
|
|
303
|
-
switchPassport:
|
|
304
|
-
switchProfile:
|
|
305
|
-
user:
|
|
305
|
+
isMobile: u,
|
|
306
|
+
order: u ? 1 : "unset",
|
|
307
|
+
isMyself: i,
|
|
308
|
+
switchPassport: $,
|
|
309
|
+
switchProfile: o.switchProfile,
|
|
310
|
+
user: n.data,
|
|
306
311
|
showFullDid: !1,
|
|
307
312
|
onlyProfile: w,
|
|
308
|
-
refreshProfile:
|
|
313
|
+
refreshProfile: I,
|
|
309
314
|
sx: {
|
|
310
|
-
padding:
|
|
311
|
-
...
|
|
315
|
+
padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
|
|
316
|
+
...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
|
|
312
317
|
boxSizing: "content-box"
|
|
313
318
|
}
|
|
314
319
|
}
|
|
315
|
-
) }) : /* @__PURE__ */
|
|
316
|
-
/* @__PURE__ */
|
|
317
|
-
|
|
320
|
+
) }) : /* @__PURE__ */ m(F, { display: "flex", flexDirection: u ? "column" : "row", children: [
|
|
321
|
+
/* @__PURE__ */ m(
|
|
322
|
+
d,
|
|
318
323
|
{
|
|
319
324
|
className: "user-center-tabs",
|
|
320
325
|
sx: {
|
|
321
326
|
flex: "1",
|
|
322
|
-
order:
|
|
327
|
+
order: u ? 2 : "unset"
|
|
323
328
|
},
|
|
324
329
|
children: [
|
|
325
|
-
l.length > 0 &&
|
|
326
|
-
|
|
330
|
+
l.length > 0 && b ? /* @__PURE__ */ m(
|
|
331
|
+
d,
|
|
327
332
|
{
|
|
328
333
|
sx: {
|
|
329
334
|
display: "flex",
|
|
@@ -334,20 +339,20 @@ function Br({
|
|
|
334
339
|
},
|
|
335
340
|
children: [
|
|
336
341
|
/* @__PURE__ */ r(
|
|
337
|
-
|
|
342
|
+
Se,
|
|
338
343
|
{
|
|
339
344
|
orientation: "horizontal",
|
|
340
345
|
variant: "line",
|
|
341
346
|
tabs: l,
|
|
342
|
-
current:
|
|
343
|
-
onChange:
|
|
347
|
+
current: s?.value ?? b,
|
|
348
|
+
onChange: he,
|
|
344
349
|
enableTabClick: !0,
|
|
345
350
|
sx: {
|
|
346
351
|
mb: (e) => `${e.spacing(3)} !important`,
|
|
347
352
|
".MuiTabs-flexContainer": {
|
|
348
353
|
gap: 3,
|
|
349
354
|
".MuiButtonBase-root": {
|
|
350
|
-
padding:
|
|
355
|
+
padding: u ? "16px 4px" : "32px 4px 16px 4px",
|
|
351
356
|
fontSize: 16
|
|
352
357
|
},
|
|
353
358
|
".MuiTab-root": {
|
|
@@ -377,61 +382,61 @@ function Br({
|
|
|
377
382
|
}
|
|
378
383
|
}
|
|
379
384
|
),
|
|
380
|
-
|
|
385
|
+
G
|
|
381
386
|
]
|
|
382
387
|
}
|
|
383
388
|
) : null,
|
|
384
|
-
l.length === 0 &&
|
|
389
|
+
l.length === 0 && q
|
|
385
390
|
]
|
|
386
391
|
}
|
|
387
392
|
),
|
|
388
|
-
!
|
|
393
|
+
!u && /* @__PURE__ */ r(Ce, { orientation: "vertical", sx: { ml: 5 } }),
|
|
389
394
|
/* @__PURE__ */ r(
|
|
390
395
|
oe,
|
|
391
396
|
{
|
|
392
|
-
isMobile:
|
|
393
|
-
order:
|
|
394
|
-
isMyself:
|
|
395
|
-
switchPassport:
|
|
396
|
-
switchProfile:
|
|
397
|
-
user:
|
|
398
|
-
refreshProfile:
|
|
397
|
+
isMobile: u,
|
|
398
|
+
order: u ? 1 : "unset",
|
|
399
|
+
isMyself: i,
|
|
400
|
+
switchPassport: $,
|
|
401
|
+
switchProfile: o.switchProfile,
|
|
402
|
+
user: n.data,
|
|
403
|
+
refreshProfile: I,
|
|
399
404
|
showFullDid: !1,
|
|
400
405
|
sx: {
|
|
401
|
-
padding:
|
|
402
|
-
...
|
|
406
|
+
padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
|
|
407
|
+
...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
|
|
403
408
|
boxSizing: "content-box"
|
|
404
409
|
}
|
|
405
410
|
}
|
|
406
411
|
)
|
|
407
412
|
] });
|
|
408
413
|
}, [
|
|
409
|
-
s,
|
|
410
|
-
l,
|
|
411
414
|
n,
|
|
412
|
-
|
|
413
|
-
|
|
415
|
+
l,
|
|
416
|
+
i,
|
|
417
|
+
s,
|
|
414
418
|
g,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
419
|
+
b,
|
|
420
|
+
L,
|
|
421
|
+
S
|
|
422
|
+
]), V = a(() => i ? !1 : s?.isPrivate, [i, s]);
|
|
423
|
+
if (a(() => w ? !1 : !A && !b && l?.length > 0 || !s || V, [A, b, l, s, V, w])) {
|
|
424
|
+
const e = l[0]?.url, t = l.find((f) => f.value === e);
|
|
420
425
|
return e && !t?.isPrivate && window.location.replace(
|
|
421
|
-
|
|
422
|
-
did:
|
|
426
|
+
te(e, {
|
|
427
|
+
did: i ? void 0 : x
|
|
423
428
|
})
|
|
424
429
|
), null;
|
|
425
430
|
}
|
|
426
|
-
return
|
|
427
|
-
/* @__PURE__ */ r(
|
|
428
|
-
/* @__PURE__ */ r(
|
|
429
|
-
/* @__PURE__ */
|
|
430
|
-
|
|
431
|
-
|
|
431
|
+
return B || w ? /* @__PURE__ */ m(d, { children: [
|
|
432
|
+
/* @__PURE__ */ r(Z, { children: /* @__PURE__ */ r("title", { children: E }) }),
|
|
433
|
+
/* @__PURE__ */ r(ie, { style: { display: "none" } }),
|
|
434
|
+
/* @__PURE__ */ m(ae, { children: [
|
|
435
|
+
/* @__PURE__ */ r(se, { isMySelf: i, userDid: n.data?.did ?? "", children: Q }),
|
|
436
|
+
j
|
|
432
437
|
] })
|
|
433
|
-
] }) : /* @__PURE__ */
|
|
434
|
-
|
|
438
|
+
] }) : /* @__PURE__ */ m(
|
|
439
|
+
d,
|
|
435
440
|
{
|
|
436
441
|
sx: {
|
|
437
442
|
minHeight: "100vh",
|
|
@@ -439,17 +444,17 @@ function Br({
|
|
|
439
444
|
flexDirection: "column"
|
|
440
445
|
},
|
|
441
446
|
children: [
|
|
442
|
-
/* @__PURE__ */ r(
|
|
443
|
-
/* @__PURE__ */ r(
|
|
444
|
-
/* @__PURE__ */
|
|
445
|
-
|
|
446
|
-
|
|
447
|
+
/* @__PURE__ */ r(Z, { children: /* @__PURE__ */ r("title", { children: E }) }),
|
|
448
|
+
/* @__PURE__ */ r(ie, { bordered: !0, ...ce, maxWidth: "100%" }),
|
|
449
|
+
/* @__PURE__ */ m(ae, { children: [
|
|
450
|
+
/* @__PURE__ */ r(se, { isMySelf: i, userDid: n.data?.did ?? "", children: Q }),
|
|
451
|
+
j
|
|
447
452
|
] }),
|
|
448
|
-
|
|
449
|
-
|
|
453
|
+
ue ? null : /* @__PURE__ */ r(
|
|
454
|
+
Be,
|
|
450
455
|
{
|
|
451
456
|
bordered: !0,
|
|
452
|
-
...
|
|
457
|
+
...fe,
|
|
453
458
|
sx: {
|
|
454
459
|
".MuiContainer-root": {
|
|
455
460
|
maxWidth: 1600
|
|
@@ -462,5 +467,5 @@ function Br({
|
|
|
462
467
|
);
|
|
463
468
|
}
|
|
464
469
|
export {
|
|
465
|
-
|
|
470
|
+
jr as default
|
|
466
471
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsxs as a, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as l } from "react";
|
|
3
|
+
import { Button as u } from "@mui/material";
|
|
4
|
+
import { useMemoizedFn as e } from "ahooks";
|
|
5
|
+
import { translate as f } from "@arcblock/ux/lib/Locale/util";
|
|
6
|
+
import { useLocaleContext as p } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import { joinURL as d } from "ufo";
|
|
8
|
+
import { translations as h } from "../../../libs/locales.js";
|
|
9
|
+
const x = () => {
|
|
10
|
+
const { componentMountPoints: o = [] } = window.blocklet || {};
|
|
11
|
+
return o.find((t) => t.name === "did-comments")?.mountPoint;
|
|
12
|
+
};
|
|
13
|
+
function v({ user: o }) {
|
|
14
|
+
const { locale: n } = p(), t = e((m, s = {}) => f(h, m, n, "en", s)), i = l(() => x(), []), r = e(() => {
|
|
15
|
+
window.open(d(i, `/chat/dm/${o?.did}`), "_blank");
|
|
16
|
+
});
|
|
17
|
+
return i ? /* @__PURE__ */ a(u, { fullWidth: !0, variant: "outlined", color: "inherit", onClick: r, children: [
|
|
18
|
+
/* @__PURE__ */ c("i", { className: "iconify", "data-icon": "mi:message-alt", style: { fontSize: "15px", marginRight: "4px" } }),
|
|
19
|
+
t("profile.chat")
|
|
20
|
+
] }) : null;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
v as default
|
|
24
|
+
};
|