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