@blocklet/ui-react 3.3.4 → 3.3.5
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.
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as r, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { use as ke, useMemo as Pe, isValidElement as te, cloneElement as ie, Children as Se } from "react";
|
|
3
|
-
import { Box as
|
|
4
|
-
import { useMemoizedFn as P, useCreation as
|
|
3
|
+
import { Box as a, Typography as B, CircularProgress as Me, Divider as De } from "@mui/material";
|
|
4
|
+
import { useMemoizedFn as P, useCreation as d, useRequest as oe } from "ahooks";
|
|
5
5
|
import Fe from "p-wait-for";
|
|
6
6
|
import ne from "react-helmet";
|
|
7
7
|
import { SessionContext as Te } from "@arcblock/did-connect-react/lib/Session";
|
|
8
8
|
import ze from "@arcblock/ux/lib/Tabs";
|
|
9
|
-
import
|
|
9
|
+
import I from "@arcblock/ux/lib/Empty";
|
|
10
10
|
import We from "@arcblock/ux/lib/Button";
|
|
11
11
|
import Ae from "@arcblock/ux/lib/Result";
|
|
12
12
|
import { useConfirm as Le } from "@arcblock/ux/lib/Dialog";
|
|
@@ -21,7 +21,7 @@ import { PROFILE_URL as M } from "@arcblock/ux/lib/Util/constant";
|
|
|
21
21
|
import Ee from "../../Footer/index.js";
|
|
22
22
|
import ae from "../../Header/index.js";
|
|
23
23
|
import { translations as _e } from "../libs/locales.js";
|
|
24
|
-
import
|
|
24
|
+
import ue from "./user-info/user-basic-info.js";
|
|
25
25
|
import "@mui/icons-material";
|
|
26
26
|
import "@iconify/react";
|
|
27
27
|
import "@arcblock/ux/lib/DID";
|
|
@@ -32,21 +32,21 @@ import "@iconify-icons/material-symbols/settings-input-antenna-rounded";
|
|
|
32
32
|
import "@arcblock/ux/lib/RelativeTime";
|
|
33
33
|
import "@arcblock/ux/lib/UserCard/Content/shorten-label";
|
|
34
34
|
import "./user-info/switch-role.js";
|
|
35
|
-
import { formatBlockletInfo as Oe, getLink as
|
|
35
|
+
import { formatBlockletInfo as Oe, getLink as F, getLocalizedNavigation as Re } from "../../blocklets.js";
|
|
36
36
|
import $e from "./passport.js";
|
|
37
37
|
import qe from "./settings.js";
|
|
38
|
-
import { client as
|
|
38
|
+
import { client as de } from "../../libs/client.js";
|
|
39
39
|
import Ge from "../../hooks/use-mobile.js";
|
|
40
40
|
import { ConfigUserSpaceProvider as Qe } from "../../contexts/config-user-space.js";
|
|
41
41
|
import Ve from "./storage/index.js";
|
|
42
42
|
import Je from "./nft.js";
|
|
43
43
|
import { UserFollowersProvider as ce } from "../../contexts/user-followers.js";
|
|
44
44
|
import Ke from "./fallback.js";
|
|
45
|
-
const
|
|
45
|
+
const T = S(M, "/nfts"), z = S(M, "/settings"), W = S(M, "/did-spaces"), j = S(M, "/user-followers"), Xe = (b) => b.some(
|
|
46
46
|
(y) => ["/userCenter/nfts", "/userCenter/user-followers", "/userCenter/settings", "/userCenter/did-spaces"].includes(
|
|
47
47
|
y.id
|
|
48
|
-
) || [
|
|
49
|
-
), fe = pe(
|
|
48
|
+
) || [T, z, W, j].includes(y.link)
|
|
49
|
+
), fe = pe(a)(({ theme: b }) => ({
|
|
50
50
|
flex: 1,
|
|
51
51
|
boxSizing: "border-box",
|
|
52
52
|
padding: "0 16px",
|
|
@@ -60,7 +60,7 @@ const F = S(M, "/nfts"), T = S(M, "/settings"), z = S(M, "/did-spaces"), N = S(M
|
|
|
60
60
|
[b.breakpoints.up("md")]: {
|
|
61
61
|
flexDirection: "row"
|
|
62
62
|
}
|
|
63
|
-
})),
|
|
63
|
+
})), N = pe(a)(({ theme: b }) => ({
|
|
64
64
|
overflow: "hidden",
|
|
65
65
|
flex: "revert",
|
|
66
66
|
[b.breakpoints.up("md")]: {
|
|
@@ -76,42 +76,42 @@ function $r({
|
|
|
76
76
|
children: b,
|
|
77
77
|
notLoginContent: y = null,
|
|
78
78
|
currentTab: v,
|
|
79
|
-
contentProps:
|
|
80
|
-
disableAutoRedirect:
|
|
79
|
+
contentProps: H = {},
|
|
80
|
+
disableAutoRedirect: E = !1,
|
|
81
81
|
hideFooter: me = !1,
|
|
82
82
|
headerProps: he = {},
|
|
83
83
|
footerProps: xe = {},
|
|
84
|
-
userDid:
|
|
85
|
-
stickySidebar:
|
|
86
|
-
embed:
|
|
84
|
+
userDid: A = void 0,
|
|
85
|
+
stickySidebar: _ = !1,
|
|
86
|
+
embed: D = !1,
|
|
87
87
|
onlyProfile: C = !1,
|
|
88
88
|
// 只显示 profile 页面,用于 ArcSphere 只需要显示 Profile 的内容
|
|
89
89
|
onDestroySelf: ge = void 0
|
|
90
90
|
}) {
|
|
91
|
-
const { locale: x, defaultLocale: k } = Be(),
|
|
92
|
-
if (
|
|
93
|
-
return
|
|
94
|
-
const e = window.location.href,
|
|
95
|
-
return
|
|
96
|
-
}, [
|
|
91
|
+
const { locale: x, defaultLocale: k } = Be(), u = Ge({ key: "md" }), f = P((e, i = {}) => Ue(_e, e, x, "en", i)), t = ke(Te)?.session, h = d(() => {
|
|
92
|
+
if (A)
|
|
93
|
+
return A;
|
|
94
|
+
const e = window.location.href, i = je(e);
|
|
95
|
+
return i?.did ? Array.isArray(i.did) ? i.did[0] : i.did : t?.user?.did;
|
|
96
|
+
}, [t?.user?.did, A]), o = d(() => t?.user ? h === t?.user?.did : !1, [h, t?.user?.did]), w = Pe(() => !!t?.user && He(), [t?.user]), n = oe(
|
|
97
97
|
// eslint-disable-next-line consistent-return
|
|
98
98
|
async () => {
|
|
99
|
-
if (await Fe(() =>
|
|
100
|
-
return
|
|
99
|
+
if (await Fe(() => t?.initialized), o)
|
|
100
|
+
return t.user;
|
|
101
101
|
if (h)
|
|
102
|
-
return
|
|
102
|
+
return de.user.getUserPublicInfo({ did: h });
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
|
-
refreshDeps: [h,
|
|
105
|
+
refreshDeps: [h, o, t?.initialized, t?.user]
|
|
106
106
|
}
|
|
107
|
-
), O = P(() =>
|
|
108
|
-
async () => n.data && v ? await
|
|
107
|
+
), O = P(() => o ? t.refresh() : n.refresh()), g = oe(
|
|
108
|
+
async () => n.data && v ? await de.user.getUserPrivacyConfig({ did: h }) : null,
|
|
109
109
|
{
|
|
110
110
|
refreshDeps: [h, n.data, v],
|
|
111
111
|
loadingDelay: 300
|
|
112
112
|
}
|
|
113
113
|
), { confirmHolder: R } = Le({
|
|
114
|
-
fullScreen:
|
|
114
|
+
fullScreen: u,
|
|
115
115
|
sx: {
|
|
116
116
|
".MuiDialog-paper": {
|
|
117
117
|
borderRadius: 1,
|
|
@@ -130,53 +130,53 @@ function $r({
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
}), $ =
|
|
133
|
+
}), $ = d(() => {
|
|
134
134
|
const e = Ne(window.blocklet);
|
|
135
135
|
try {
|
|
136
136
|
return Oe(e);
|
|
137
|
-
} catch (
|
|
138
|
-
return console.error("Failed to format blocklet info",
|
|
137
|
+
} catch (i) {
|
|
138
|
+
return console.error("Failed to format blocklet info", i, e), e;
|
|
139
139
|
}
|
|
140
|
-
}, []), q =
|
|
140
|
+
}, []), q = d(() => {
|
|
141
141
|
const e = {
|
|
142
142
|
label: f("common.nft"),
|
|
143
143
|
protected: !1,
|
|
144
144
|
isPrivate: !1,
|
|
145
145
|
// true: 隐私数据,仅自己可见
|
|
146
|
-
value:
|
|
147
|
-
url:
|
|
148
|
-
},
|
|
146
|
+
value: T,
|
|
147
|
+
url: F(T, x, k)
|
|
148
|
+
}, i = {
|
|
149
149
|
label: f("userFollowers"),
|
|
150
150
|
protected: !1,
|
|
151
151
|
isPrivate: !1,
|
|
152
|
-
value:
|
|
153
|
-
url:
|
|
152
|
+
value: j,
|
|
153
|
+
url: F(j, x, k)
|
|
154
154
|
};
|
|
155
|
-
let p = w ? [e,
|
|
156
|
-
if (
|
|
157
|
-
const
|
|
155
|
+
let p = w ? [e, i] : [e];
|
|
156
|
+
if (o) {
|
|
157
|
+
const U = [
|
|
158
158
|
e,
|
|
159
159
|
{
|
|
160
160
|
label: f("common.setting"),
|
|
161
161
|
protected: !0,
|
|
162
162
|
isPrivate: !0,
|
|
163
|
-
value:
|
|
164
|
-
url:
|
|
163
|
+
value: z,
|
|
164
|
+
url: F(z, x, k)
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
167
|
label: f("storageManagement"),
|
|
168
168
|
protected: !0,
|
|
169
169
|
isPrivate: !0,
|
|
170
|
-
value:
|
|
171
|
-
url:
|
|
170
|
+
value: W,
|
|
171
|
+
url: F(W, x, k)
|
|
172
172
|
}
|
|
173
173
|
];
|
|
174
|
-
p = w ? [...
|
|
174
|
+
p = w ? [...U, i] : U;
|
|
175
175
|
}
|
|
176
176
|
return p;
|
|
177
|
-
}, [
|
|
178
|
-
const e = $?.navigation?.userCenter || [],
|
|
179
|
-
return (Re({ navigation: e, locale: x, defaultLocale: k }) || []).concat(
|
|
177
|
+
}, [o, x, w]), l = d(() => {
|
|
178
|
+
const e = $?.navigation?.userCenter || [], i = Xe(e);
|
|
179
|
+
return (Re({ navigation: e, locale: x, defaultLocale: k }) || []).concat(i ? [] : q).map((c) => {
|
|
180
180
|
const re = c.value ?? c._rawLink ?? c.link ?? c.url;
|
|
181
181
|
return {
|
|
182
182
|
value: re,
|
|
@@ -189,34 +189,34 @@ function $r({
|
|
|
189
189
|
// 是否开启仅粉丝可查看的功能,目前只对 discuss kit 开启
|
|
190
190
|
// icon: x.icon,
|
|
191
191
|
};
|
|
192
|
-
}).filter((c) =>
|
|
193
|
-
}, [$, n.data, g?.data, x, q,
|
|
192
|
+
}).filter((c) => o || !c.isPrivate);
|
|
193
|
+
}, [$, n.data, g?.data, x, q, o]), s = d(() => l.find((e) => se(e.value) === se(v)), [l]), G = d(() => {
|
|
194
194
|
const e = window.blocklet?.appName, p = [s?.label, f("userCenter.title")].filter(Boolean).join("-");
|
|
195
195
|
return e ? `${p} | ${e}` : p;
|
|
196
196
|
}, [s, f]), be = P((e) => e && (te(e) ? ie(e, {
|
|
197
197
|
...e.props || {},
|
|
198
|
-
userCenterTabs:
|
|
199
|
-
}) : Se.map(e, (
|
|
200
|
-
...
|
|
201
|
-
userCenterTabs:
|
|
202
|
-
}) :
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
did:
|
|
198
|
+
userCenterTabs: l
|
|
199
|
+
}) : Se.map(e, (i) => te(i) ? ie(i, {
|
|
200
|
+
...i.props || {},
|
|
201
|
+
userCenterTabs: l
|
|
202
|
+
}) : i))), ve = P((e) => {
|
|
203
|
+
const i = l.find((p) => p.value === e);
|
|
204
|
+
i && (window.location.href = le(i.url, {
|
|
205
|
+
did: o ? void 0 : h
|
|
206
206
|
}));
|
|
207
|
-
}), Q =
|
|
207
|
+
}), Q = d(() => /* @__PURE__ */ r(
|
|
208
208
|
qe,
|
|
209
209
|
{
|
|
210
210
|
user: n.data,
|
|
211
|
-
settings: { userCenterTabs:
|
|
212
|
-
onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await
|
|
213
|
-
isMobile:
|
|
211
|
+
settings: { userCenterTabs: l },
|
|
212
|
+
onSave: async (e) => e === "privacy" ? (await g.runAsync(), g.data) : (e === "profile" && await t.refresh(), null),
|
|
213
|
+
isMobile: u,
|
|
214
214
|
onDestroySelf: ge
|
|
215
215
|
}
|
|
216
|
-
), [n.data,
|
|
217
|
-
|
|
218
|
-
}),
|
|
219
|
-
|
|
216
|
+
), [n.data, l, g.data, g.runAsync]), V = d(() => s && s?.value === z, [s]), J = d(() => s && s?.value === S(M, "/profile") || s?.value === T, [s]), we = d(() => s && s?.value === W, [s]), ye = t.useOAuth(), Ce = t.usePasskey(), K = P(() => {
|
|
217
|
+
t?.user?.sourceProvider === "passkey" ? Ce.switchPassport(t.user) : ["google", "apple", "email", "github"].includes(t?.user?.sourceProvider ?? "") ? ye.switchOAuthPassport(t.user) : t && t.switchPassport();
|
|
218
|
+
}), L = d(() => J ? /* @__PURE__ */ m(
|
|
219
|
+
a,
|
|
220
220
|
{
|
|
221
221
|
sx: {
|
|
222
222
|
display: "flex",
|
|
@@ -224,9 +224,9 @@ function $r({
|
|
|
224
224
|
gap: 2.5
|
|
225
225
|
},
|
|
226
226
|
children: [
|
|
227
|
-
|
|
227
|
+
o ? /* @__PURE__ */ m(a, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
|
|
228
228
|
/* @__PURE__ */ r(
|
|
229
|
-
|
|
229
|
+
B,
|
|
230
230
|
{
|
|
231
231
|
sx: {
|
|
232
232
|
color: "text.primary",
|
|
@@ -241,20 +241,20 @@ function $r({
|
|
|
241
241
|
/* @__PURE__ */ r(Je, { user: n.data })
|
|
242
242
|
]
|
|
243
243
|
}
|
|
244
|
-
) : V &&
|
|
245
|
-
|
|
244
|
+
) : V && o ? Q : we && o ? /* @__PURE__ */ r(Qe, { children: /* @__PURE__ */ r(Ve, {}) }) : null, [V, J, n, o, _, Q]), X = d(() => /* @__PURE__ */ r(
|
|
245
|
+
a,
|
|
246
246
|
{
|
|
247
247
|
sx: {
|
|
248
248
|
display: {
|
|
249
|
-
xs:
|
|
249
|
+
xs: o ? "none" : "block",
|
|
250
250
|
md: "block"
|
|
251
251
|
},
|
|
252
252
|
py: 3
|
|
253
253
|
},
|
|
254
|
-
children: /* @__PURE__ */ r(
|
|
254
|
+
children: /* @__PURE__ */ r(I, { children: f("emptyContent") })
|
|
255
255
|
}
|
|
256
|
-
), [
|
|
257
|
-
|
|
256
|
+
), [o, x]), Y = d(() => !g.data || g.loading ? /* @__PURE__ */ r(
|
|
257
|
+
a,
|
|
258
258
|
{
|
|
259
259
|
sx: {
|
|
260
260
|
height: "100%",
|
|
@@ -267,27 +267,27 @@ function $r({
|
|
|
267
267
|
},
|
|
268
268
|
children: /* @__PURE__ */ r(Me, {})
|
|
269
269
|
}
|
|
270
|
-
) : /* @__PURE__ */ r(
|
|
270
|
+
) : /* @__PURE__ */ r(a, { sx: { flex: 1 }, children: /* @__PURE__ */ r(
|
|
271
271
|
Ke,
|
|
272
272
|
{
|
|
273
273
|
isSupportFollow: w,
|
|
274
274
|
currentActiveTab: s,
|
|
275
|
-
isMyself:
|
|
276
|
-
children: b ? /* @__PURE__ */ r(
|
|
275
|
+
isMyself: o,
|
|
276
|
+
children: b ? /* @__PURE__ */ r(a, { ...H, children: be(b) }) : L
|
|
277
277
|
}
|
|
278
|
-
) }), [g, s,
|
|
279
|
-
if (n.loading ||
|
|
278
|
+
) }), [g, s, o, b, H, L, x]), Z = d(() => {
|
|
279
|
+
if (n.loading || t.loading)
|
|
280
280
|
return null;
|
|
281
281
|
if (n.error) {
|
|
282
282
|
if (n.error?.response?.status === 404)
|
|
283
|
-
return /* @__PURE__ */ r(
|
|
283
|
+
return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ae, { status: 404, description: f("noUserFound") }) });
|
|
284
284
|
const p = {
|
|
285
285
|
message: n.error.response?.data?.error || n.error.message || "error occurred"
|
|
286
286
|
};
|
|
287
|
-
return /* @__PURE__ */ r(
|
|
287
|
+
return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ie, { error: p }) });
|
|
288
288
|
}
|
|
289
|
-
return !h && !n.data ? y || /* @__PURE__ */ r(
|
|
290
|
-
|
|
289
|
+
return !h && !n.data ? y || /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ m(
|
|
290
|
+
a,
|
|
291
291
|
{
|
|
292
292
|
sx: {
|
|
293
293
|
display: "flex",
|
|
@@ -297,19 +297,19 @@ function $r({
|
|
|
297
297
|
gap: 1
|
|
298
298
|
},
|
|
299
299
|
children: [
|
|
300
|
-
/* @__PURE__ */ r(
|
|
301
|
-
/* @__PURE__ */ r(We, { size: "small", variant: "contained", onClick: () =>
|
|
300
|
+
/* @__PURE__ */ r(I, { children: f("viewAfterLogin") }),
|
|
301
|
+
/* @__PURE__ */ r(We, { size: "small", variant: "contained", onClick: () => t.login(), children: f("loginNow") })
|
|
302
302
|
]
|
|
303
303
|
}
|
|
304
|
-
) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(
|
|
305
|
-
/* @__PURE__ */ r(
|
|
306
|
-
/* @__PURE__ */ r(
|
|
307
|
-
] }) }) :
|
|
308
|
-
|
|
309
|
-
|
|
304
|
+
) }) : h && !n.data && !n.loading ? /* @__PURE__ */ r(I, { style: { width: "100%", paddingTop: 16 }, children: /* @__PURE__ */ m(a, { sx: { textAlign: "center", width: "100%" }, children: [
|
|
305
|
+
/* @__PURE__ */ r(B, { variant: "body1", sx: { fontSize: 18, fontWeight: 500 }, children: f("userNotFound") }),
|
|
306
|
+
/* @__PURE__ */ r(B, { variant: "body1", color: "text.secondary", children: f("userNotFoundDescription") })
|
|
307
|
+
] }) }) : D ? /* @__PURE__ */ m(N, { children: [
|
|
308
|
+
l.length > 0 && v ? /* @__PURE__ */ r(
|
|
309
|
+
a,
|
|
310
310
|
{
|
|
311
311
|
sx: {
|
|
312
|
-
display:
|
|
312
|
+
display: u ? "block" : "flex",
|
|
313
313
|
height: "100%",
|
|
314
314
|
overflow: "auto",
|
|
315
315
|
padding: "1px"
|
|
@@ -317,39 +317,39 @@ function $r({
|
|
|
317
317
|
children: Y
|
|
318
318
|
}
|
|
319
319
|
) : null,
|
|
320
|
-
|
|
321
|
-
] }) : C ? /* @__PURE__ */ r(
|
|
322
|
-
|
|
320
|
+
l.length === 0 && X
|
|
321
|
+
] }) : C ? /* @__PURE__ */ r(N, { display: "flex", flexDirection: u ? "column" : "row", children: /* @__PURE__ */ r(
|
|
322
|
+
ue,
|
|
323
323
|
{
|
|
324
|
-
isMobile:
|
|
325
|
-
order:
|
|
326
|
-
isMyself:
|
|
324
|
+
isMobile: u,
|
|
325
|
+
order: u ? 1 : "unset",
|
|
326
|
+
isMyself: o,
|
|
327
327
|
switchPassport: K,
|
|
328
|
-
switchProfile:
|
|
328
|
+
switchProfile: t.switchProfile,
|
|
329
329
|
user: n.data,
|
|
330
330
|
showFullDid: !1,
|
|
331
331
|
onlyProfile: C,
|
|
332
332
|
refreshProfile: O,
|
|
333
333
|
isShowSocialActions: w,
|
|
334
334
|
sx: {
|
|
335
|
-
padding:
|
|
336
|
-
...
|
|
335
|
+
padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
|
|
336
|
+
...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
|
|
337
337
|
boxSizing: "content-box"
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
) }) : /* @__PURE__ */ m(
|
|
340
|
+
) }) : /* @__PURE__ */ m(N, { display: "flex", flexDirection: u ? "column" : "row", children: [
|
|
341
341
|
/* @__PURE__ */ m(
|
|
342
|
-
|
|
342
|
+
a,
|
|
343
343
|
{
|
|
344
344
|
className: "user-center-tabs",
|
|
345
345
|
sx: {
|
|
346
346
|
flex: "1",
|
|
347
|
-
order:
|
|
348
|
-
width:
|
|
347
|
+
order: u ? 2 : "unset",
|
|
348
|
+
width: u ? "unset" : "calc(100% - 424px)"
|
|
349
349
|
},
|
|
350
350
|
children: [
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
l.length > 0 && v ? /* @__PURE__ */ m(
|
|
352
|
+
a,
|
|
353
353
|
{
|
|
354
354
|
sx: {
|
|
355
355
|
display: "flex",
|
|
@@ -364,7 +364,7 @@ function $r({
|
|
|
364
364
|
{
|
|
365
365
|
orientation: "horizontal",
|
|
366
366
|
variant: "line",
|
|
367
|
-
tabs:
|
|
367
|
+
tabs: l,
|
|
368
368
|
current: s?.value ?? v,
|
|
369
369
|
onChange: ve,
|
|
370
370
|
enableTabClick: !0,
|
|
@@ -373,7 +373,7 @@ function $r({
|
|
|
373
373
|
".MuiTabs-flexContainer": {
|
|
374
374
|
gap: 3,
|
|
375
375
|
".MuiButtonBase-root": {
|
|
376
|
-
padding:
|
|
376
|
+
padding: u ? "16px 4px" : "32px 4px 16px 4px",
|
|
377
377
|
fontSize: 16
|
|
378
378
|
},
|
|
379
379
|
".MuiTab-root": {
|
|
@@ -407,26 +407,26 @@ function $r({
|
|
|
407
407
|
]
|
|
408
408
|
}
|
|
409
409
|
) : null,
|
|
410
|
-
|
|
410
|
+
l.length === 0 && X
|
|
411
411
|
]
|
|
412
412
|
}
|
|
413
413
|
),
|
|
414
|
-
!
|
|
414
|
+
!u && /* @__PURE__ */ r(De, { orientation: "vertical", sx: { ml: 5 } }),
|
|
415
415
|
/* @__PURE__ */ r(
|
|
416
|
-
|
|
416
|
+
ue,
|
|
417
417
|
{
|
|
418
|
-
isMobile:
|
|
419
|
-
order:
|
|
420
|
-
isMyself:
|
|
418
|
+
isMobile: u,
|
|
419
|
+
order: u ? 1 : "unset",
|
|
420
|
+
isMyself: o,
|
|
421
421
|
switchPassport: K,
|
|
422
|
-
switchProfile:
|
|
422
|
+
switchProfile: t.switchProfile,
|
|
423
423
|
user: n.data,
|
|
424
424
|
refreshProfile: O,
|
|
425
425
|
showFullDid: !1,
|
|
426
426
|
isShowSocialActions: w,
|
|
427
427
|
sx: {
|
|
428
|
-
padding:
|
|
429
|
-
...
|
|
428
|
+
padding: u ? "16px 0 0 0" : "40px 24px 24px 40px",
|
|
429
|
+
...u ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
|
|
430
430
|
boxSizing: "content-box"
|
|
431
431
|
}
|
|
432
432
|
}
|
|
@@ -434,31 +434,40 @@ function $r({
|
|
|
434
434
|
] });
|
|
435
435
|
}, [
|
|
436
436
|
n,
|
|
437
|
-
|
|
438
|
-
|
|
437
|
+
l,
|
|
438
|
+
o,
|
|
439
439
|
s,
|
|
440
440
|
g,
|
|
441
441
|
v,
|
|
442
|
+
_,
|
|
443
|
+
L
|
|
444
|
+
]), ee = d(() => o ? !1 : s?.isPrivate, [o, s]);
|
|
445
|
+
if (d(() => C || D || !l.length || !t.user ? !1 : !E && !v && l?.length > 0 || !s || ee, [
|
|
442
446
|
E,
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
447
|
+
v,
|
|
448
|
+
l,
|
|
449
|
+
s,
|
|
450
|
+
ee,
|
|
451
|
+
C,
|
|
452
|
+
t.user,
|
|
453
|
+
D
|
|
454
|
+
])) {
|
|
455
|
+
const e = l[0]?.url, i = l.find((p) => p.value === e);
|
|
456
|
+
return e && !i?.isPrivate && window.location.replace(
|
|
448
457
|
le(e, {
|
|
449
|
-
did:
|
|
458
|
+
did: o ? void 0 : h
|
|
450
459
|
})
|
|
451
460
|
), null;
|
|
452
461
|
}
|
|
453
|
-
return
|
|
462
|
+
return D || C ? /* @__PURE__ */ m(a, { children: [
|
|
454
463
|
/* @__PURE__ */ r(ne, { children: /* @__PURE__ */ r("title", { children: G }) }),
|
|
455
464
|
/* @__PURE__ */ r(ae, { style: { display: "none" } }),
|
|
456
465
|
/* @__PURE__ */ m(fe, { children: [
|
|
457
|
-
/* @__PURE__ */ r(ce, { isMySelf:
|
|
466
|
+
/* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: Z }),
|
|
458
467
|
R
|
|
459
468
|
] })
|
|
460
469
|
] }) : /* @__PURE__ */ m(
|
|
461
|
-
|
|
470
|
+
a,
|
|
462
471
|
{
|
|
463
472
|
sx: {
|
|
464
473
|
minHeight: "100vh",
|
|
@@ -469,7 +478,7 @@ function $r({
|
|
|
469
478
|
/* @__PURE__ */ r(ne, { children: /* @__PURE__ */ r("title", { children: G }) }),
|
|
470
479
|
/* @__PURE__ */ r(ae, { bordered: !0, ...he, maxWidth: "100%" }),
|
|
471
480
|
/* @__PURE__ */ m(fe, { children: [
|
|
472
|
-
/* @__PURE__ */ r(ce, { isMySelf:
|
|
481
|
+
/* @__PURE__ */ r(ce, { isMySelf: o, userDid: n.data?.did ?? "", children: Z }),
|
|
473
482
|
R
|
|
474
483
|
] }),
|
|
475
484
|
me ? null : /* @__PURE__ */ r(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.5",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@abtnode/constant": "^1.17.6",
|
|
37
37
|
"@abtnode/util": "^1.17.6",
|
|
38
|
-
"@arcblock/bridge": "3.3.
|
|
39
|
-
"@arcblock/icons": "3.3.
|
|
40
|
-
"@arcblock/react-hooks": "3.3.
|
|
38
|
+
"@arcblock/bridge": "3.3.5",
|
|
39
|
+
"@arcblock/icons": "3.3.5",
|
|
40
|
+
"@arcblock/react-hooks": "3.3.5",
|
|
41
41
|
"@arcblock/ws": "^1.27.16",
|
|
42
42
|
"@blocklet/did-space-react": "^1.2.11",
|
|
43
43
|
"@iconify-icons/logos": "^1.2.36",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
|
-
"@arcblock/did-connect-react": "3.3.
|
|
85
|
+
"@arcblock/did-connect-react": "3.3.5",
|
|
86
86
|
"@babel/preset-env": "^7.28.0",
|
|
87
87
|
"@babel/preset-react": "^7.27.1",
|
|
88
88
|
"@babel/preset-typescript": "^7.27.1",
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"typescript": "~5.5.4",
|
|
97
97
|
"unbuild": "^2.0.0"
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "757fbba540967c8552f9c30fc64fdce00a8be222"
|
|
100
100
|
}
|
|
@@ -154,8 +154,8 @@ export default function UserCenter({
|
|
|
154
154
|
}, [currentDid, session?.user?.did]);
|
|
155
155
|
|
|
156
156
|
const isShowSocialActions = useMemo((): boolean => {
|
|
157
|
-
return isSupportFollow();
|
|
158
|
-
}, []);
|
|
157
|
+
return !!session?.user && isSupportFollow();
|
|
158
|
+
}, [session?.user]);
|
|
159
159
|
|
|
160
160
|
const userState = useRequest<UserPublicInfo | User | undefined, []>(
|
|
161
161
|
// eslint-disable-next-line consistent-return
|
|
@@ -684,7 +684,9 @@ export default function UserCenter({
|
|
|
684
684
|
// 判断是否需要重定向到第一个可用的标签页
|
|
685
685
|
const shouldRedirect = useCreation(() => {
|
|
686
686
|
// 非 Profile 模式下才考虑重定向
|
|
687
|
-
|
|
687
|
+
// 非登录状态下不进行重定向
|
|
688
|
+
// 没有可用标签页时不进行重定向
|
|
689
|
+
if (onlyProfile || embed || !userCenterTabs.length || !session.user) {
|
|
688
690
|
return false;
|
|
689
691
|
}
|
|
690
692
|
|
|
@@ -697,7 +699,16 @@ export default function UserCenter({
|
|
|
697
699
|
const accessingPrivateTab = isPrivateActive;
|
|
698
700
|
|
|
699
701
|
return noActiveTabButHasTabs || invalidCurrentTab || accessingPrivateTab;
|
|
700
|
-
}, [
|
|
702
|
+
}, [
|
|
703
|
+
disableAutoRedirect,
|
|
704
|
+
currentTab,
|
|
705
|
+
userCenterTabs,
|
|
706
|
+
currentActiveTab,
|
|
707
|
+
isPrivateActive,
|
|
708
|
+
onlyProfile,
|
|
709
|
+
session.user,
|
|
710
|
+
embed,
|
|
711
|
+
]);
|
|
701
712
|
|
|
702
713
|
if (shouldRedirect) {
|
|
703
714
|
// 获取第一个可用的标签页URL
|