@blocklet/ui-react 3.1.26 → 3.1.27

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.
Files changed (28) hide show
  1. package/lib/@types/index.d.ts +1 -1
  2. package/lib/UserCenter/components/fallback.d.ts +8 -0
  3. package/lib/UserCenter/components/fallback.js +21 -0
  4. package/lib/UserCenter/components/user-center.js +205 -200
  5. package/lib/UserCenter/components/user-info/social-actions/chat.d.ts +5 -0
  6. package/lib/UserCenter/components/user-info/social-actions/chat.js +24 -0
  7. package/lib/UserCenter/components/user-info/social-actions/follow.d.ts +2 -0
  8. package/lib/UserCenter/components/user-info/social-actions/follow.js +19 -0
  9. package/lib/UserCenter/components/user-info/social-actions/index.d.ts +5 -0
  10. package/lib/UserCenter/components/user-info/social-actions/index.js +13 -0
  11. package/lib/UserCenter/components/user-info/user-basic-info.js +37 -35
  12. package/lib/UserCenter/libs/locales.d.ts +14 -0
  13. package/lib/UserCenter/libs/locales.js +16 -2
  14. package/lib/contexts/user-followers.d.ts +13 -0
  15. package/lib/contexts/user-followers.js +40 -0
  16. package/lib/hooks/use-follow.d.ts +12 -0
  17. package/lib/hooks/use-follow.js +47 -0
  18. package/package.json +6 -6
  19. package/src/@types/index.ts +1 -1
  20. package/src/UserCenter/components/fallback.tsx +51 -0
  21. package/src/UserCenter/components/user-center.tsx +22 -12
  22. package/src/UserCenter/components/user-info/social-actions/chat.tsx +42 -0
  23. package/src/UserCenter/components/user-info/social-actions/follow.tsx +30 -0
  24. package/src/UserCenter/components/user-info/social-actions/index.tsx +17 -0
  25. package/src/UserCenter/components/user-info/user-basic-info.tsx +6 -0
  26. package/src/UserCenter/libs/locales.ts +14 -0
  27. package/src/contexts/user-followers.tsx +54 -0
  28. package/src/hooks/use-follow.tsx +74 -0
@@ -1,25 +1,25 @@
1
- import { jsx as r, jsxs as p, Fragment as X } from "react/jsx-runtime";
2
- import { use as be, isValidElement as Y, cloneElement as Z, Children as ve } from "react";
3
- import { Box as a, Typography as we, CircularProgress as ye, Divider as Ce } from "@mui/material";
4
- import { useMemoizedFn as y, useCreation as c, useRequest as ee } from "ahooks";
5
- import ke from "p-wait-for";
6
- import re from "react-helmet";
7
- import { SessionContext as Pe } from "@arcblock/did-connect-react/lib/Session";
8
- import Me from "@arcblock/ux/lib/Tabs";
9
- import S from "@arcblock/ux/lib/Empty";
10
- import Se from "@arcblock/ux/lib/Button";
11
- import De from "@arcblock/ux/lib/Result";
12
- import { useConfirm as Te } from "@arcblock/ux/lib/Dialog";
13
- import { translate as ze } from "@arcblock/ux/lib/Locale/util";
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 Ae } from "@arcblock/ux/lib/ErrorBoundary";
16
- import { styled as le } from "@arcblock/ux/lib/Theme";
17
- import Ue from "lodash/cloneDeep";
18
- import { joinURL as C, getQuery as Be, withoutTrailingSlash as te, withQuery as ie } from "ufo";
19
- import { PROFILE_URL as k } from "@arcblock/ux/lib/Util/constant";
20
- import Le from "../../Footer/index.js";
21
- import ne from "../../Header/index.js";
22
- import { translations as Fe } from "../libs/locales.js";
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 Ie, getLink as D, getLocalizedNavigation as je } from "../../blocklets.js";
35
- import He from "./passport.js";
36
- import Ne from "./settings.js";
37
- import { client as se } from "../../libs/client.js";
38
- import Ee from "../../hooks/use-mobile.js";
39
- import { ConfigUserSpaceProvider as _e } from "../../contexts/config-user-space.js";
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 Oe from "./nft.js";
42
- const T = C(k, "/nfts"), z = C(k, "/settings"), W = C(k, "/did-spaces"), ae = le(a)(({ theme: v }) => ({
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
- })), A = le(a)(({ theme: v }) => ({
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 Br({
70
+ function jr({
69
71
  children: v,
70
- notLoginContent: U = null,
71
- currentTab: g,
72
- contentProps: B = {},
73
- disableAutoRedirect: L = !1,
74
- hideFooter: ce = !1,
75
- headerProps: de = {},
76
- footerProps: ue = {},
77
- userDid: P = void 0,
78
- stickySidebar: F = !1,
79
- embed: I = !1,
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: fe = void 0
84
+ onDestroySelf: pe = void 0
83
85
  }) {
84
- const { locale: b } = We(), d = Ee({ key: "md" }), f = y((e, t = {}) => ze(Fe, e, b, "en", t)), i = be(Pe)?.session, m = c(() => {
85
- if (P)
86
- return P;
87
- const e = window.location.href, t = Be(e);
88
- return t?.did ? Array.isArray(t.did) ? t.did[0] : t.did : i?.user?.did;
89
- }, [i?.user?.did, P]), n = c(() => i?.user ? m === i?.user?.did : !1, [m, i?.user?.did]), s = ee(
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 ke(() => i?.initialized), n)
93
- return i.user;
94
- if (m)
95
- return se.user.getUserPublicInfo({ did: m });
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: [m, n, i?.initialized, i?.user]
100
+ refreshDeps: [x, i, o?.initialized, o?.user]
99
101
  }
100
- ), j = y(() => n ? i.refresh() : s.refresh()), h = ee(
101
- async () => s.data && g ? await se.user.getUserPrivacyConfig({ did: m }) : null,
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: [m, s.data, g],
105
+ refreshDeps: [x, n.data, b],
104
106
  loadingDelay: 300
105
107
  }
106
- ), { confirmHolder: H } = Te({
107
- fullScreen: d,
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
- }), N = c(() => {
127
- const e = Ue(window.blocklet);
128
+ }), H = a(() => {
129
+ const e = Ae(window.blocklet);
128
130
  try {
129
- return Ie(e);
131
+ return je(e);
130
132
  } catch (t) {
131
133
  return console.error("Failed to format blocklet info", t, e), e;
132
134
  }
133
- }, []), E = c(() => {
135
+ }, []), N = a(() => {
134
136
  const e = {
135
- label: f("common.nft"),
137
+ label: p("common.nft"),
136
138
  protected: !1,
137
139
  isPrivate: !1,
138
140
  // true: 隐私数据,仅自己可见
139
- value: T,
140
- url: D(T, b)
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 t = [e];
143
- return n && (t = [
150
+ let f = [e, t];
151
+ return i && (f = [
144
152
  e,
145
153
  {
146
- label: f("common.setting"),
154
+ label: p("common.setting"),
147
155
  protected: !0,
148
156
  isPrivate: !0,
149
- value: z,
150
- url: D(z, b)
157
+ value: T,
158
+ url: P(T, h)
151
159
  },
152
160
  {
153
- label: f("storageManagement"),
161
+ label: p("storageManagement"),
154
162
  protected: !0,
155
163
  isPrivate: !0,
156
- value: W,
157
- url: D(W, b)
158
- }
159
- ]), t;
160
- }, [n, b]), l = c(() => {
161
- const e = N?.navigation?.userCenter || [];
162
- return (je(e, b) || []).concat(E).map((u) => {
163
- const K = u.value ?? u._rawLink ?? u.link ?? u.url;
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: K,
166
- label: u.title || u.label,
167
- url: u.link || u.url,
168
- protected: h?.data?.[K] ?? !1,
169
- isPrivate: u.isPrivate || u.private || (u?._rawLink?.includes("/customer") ?? !1)
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((u) => n || !u.isPrivate);
174
- }, [N, s.data, h?.data, b, E, n]), o = c(() => l.find((e) => te(e.value) === te(g)), [l]), _ = c(() => {
175
- const e = window.blocklet?.appName, x = [o?.label, f("userCenter.title")].filter(Boolean).join("-");
176
- return e ? `${x} | ${e}` : x;
177
- }, [o, f]), pe = y((e) => e && (Y(e) ? Z(e, {
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
- }) : ve.map(e, (t) => Y(t) ? Z(t, {
191
+ }) : we.map(e, (t) => K(t) ? X(t, {
181
192
  ...t.props || {},
182
193
  userCenterTabs: l
183
- }) : t))), me = y((e) => {
184
- const t = l.find((x) => x.value === e);
185
- t && (window.location.href = ie(t.url, {
186
- did: n ? void 0 : m
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
- }), R = c(() => /* @__PURE__ */ r(
189
- Ne,
199
+ }), _ = a(() => /* @__PURE__ */ r(
200
+ Ee,
190
201
  {
191
- user: s.data,
202
+ user: n.data,
192
203
  settings: { userCenterTabs: l },
193
- onSave: async (e) => e === "privacy" ? (await h.runAsync(), h.data) : (e === "profile" && await i.refresh(), null),
194
- isMobile: d,
195
- onDestroySelf: fe
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
- ), [s.data, l, h.data, h.runAsync]), O = c(() => o && o?.value === z, [o]), $ = c(() => o && o?.value === C(k, "/profile") || o?.value === T, [o]), he = c(() => o && o?.value === W, [o]), xe = i.useOAuth(), ge = i.usePasskey(), q = y(() => {
198
- i?.user?.sourceProvider === "passkey" ? ge.switchPassport(i.user) : ["google", "apple", "email", "github"].includes(i?.user?.sourceProvider ?? "") ? xe.switchOAuthPassport(i.user) : i && i.switchPassport();
199
- }), M = c(() => $ ? /* @__PURE__ */ p(
200
- a,
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
- n ? /* @__PURE__ */ p(a, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
219
+ i ? /* @__PURE__ */ m(d, { sx: { border: "1px solid", borderColor: "divider", borderRadius: 1.5, p: 2 }, children: [
209
220
  /* @__PURE__ */ r(
210
- we,
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: f("passport")
228
+ children: p("passport")
218
229
  }
219
230
  ),
220
- /* @__PURE__ */ r(He, { user: s.data })
231
+ /* @__PURE__ */ r(Ne, { user: n.data })
221
232
  ] }) : null,
222
- /* @__PURE__ */ r(Oe, { user: s.data })
233
+ /* @__PURE__ */ r($e, { user: n.data })
223
234
  ]
224
235
  }
225
- ) : O && n ? R : he && n ? /* @__PURE__ */ r(_e, { children: /* @__PURE__ */ r(Re, {}) }) : null, [O, $, s, n, F, R]), G = c(() => /* @__PURE__ */ r(
226
- a,
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: n ? "none" : "block",
241
+ xs: i ? "none" : "block",
231
242
  md: "block"
232
243
  },
233
244
  py: 3
234
245
  },
235
- children: /* @__PURE__ */ r(S, { children: f("emptyContent") })
246
+ children: /* @__PURE__ */ r(ee, { children: p("emptyContent") })
236
247
  }
237
- ), [n, b]), Q = c(() => !h.data || h.loading ? /* @__PURE__ */ r(
238
- a,
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(ye, {})
260
+ children: /* @__PURE__ */ r(ke, {})
250
261
  }
251
- ) : (
252
- // eslint-disable-next-line react/jsx-no-useless-fragment
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 (s.error) {
261
- if (s.error?.response?.status === 404)
262
- return /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(De, { status: 404, description: f("noUserFound") }) });
263
- const x = {
264
- message: s.error.response?.data?.error || s.error.message || "error occurred"
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(a, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ae, { error: x }) });
271
+ return /* @__PURE__ */ r(d, { sx: { width: "100%" }, children: /* @__PURE__ */ r(Ue, { error: f }) });
267
272
  }
268
- return !m && !s.data ? U || /* @__PURE__ */ r(a, { sx: { width: "100%" }, children: /* @__PURE__ */ p(
269
- a,
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(S, { children: f("viewAfterLogin") }),
280
- /* @__PURE__ */ r(Se, { size: "small", variant: "contained", onClick: () => i.login(), children: f("loginNow") })
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
- ) }) : I ? /* @__PURE__ */ p(A, { children: [
284
- l.length > 0 && g ? /* @__PURE__ */ r(
285
- a,
288
+ ) }) : B ? /* @__PURE__ */ m(F, { children: [
289
+ l.length > 0 && b ? /* @__PURE__ */ r(
290
+ d,
286
291
  {
287
292
  sx: {
288
- display: d ? "block" : "flex",
293
+ display: u ? "block" : "flex",
289
294
  height: "100%",
290
295
  overflow: "auto",
291
296
  padding: "1px"
292
297
  },
293
- children: Q
298
+ children: G
294
299
  }
295
300
  ) : null,
296
- l.length === 0 && G
297
- ] }) : w ? /* @__PURE__ */ r(A, { display: "flex", flexDirection: d ? "column" : "row", children: /* @__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: d,
301
- order: d ? 1 : "unset",
302
- isMyself: n,
303
- switchPassport: q,
304
- switchProfile: i.switchProfile,
305
- user: s.data,
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: j,
313
+ refreshProfile: I,
309
314
  sx: {
310
- padding: d ? "16px 0 0 0" : "40px 24px 24px 40px",
311
- ...d ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
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__ */ p(A, { display: "flex", flexDirection: d ? "column" : "row", children: [
316
- /* @__PURE__ */ p(
317
- a,
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: d ? 2 : "unset"
327
+ order: u ? 2 : "unset"
323
328
  },
324
329
  children: [
325
- l.length > 0 && g ? /* @__PURE__ */ p(
326
- a,
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
- Me,
342
+ Se,
338
343
  {
339
344
  orientation: "horizontal",
340
345
  variant: "line",
341
346
  tabs: l,
342
- current: o?.value ?? g,
343
- onChange: me,
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: d ? "16px 4px" : "32px 4px 16px 4px",
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
- Q
385
+ G
381
386
  ]
382
387
  }
383
388
  ) : null,
384
- l.length === 0 && G
389
+ l.length === 0 && q
385
390
  ]
386
391
  }
387
392
  ),
388
- !d && /* @__PURE__ */ r(Ce, { orientation: "vertical", sx: { ml: 5 } }),
393
+ !u && /* @__PURE__ */ r(Ce, { orientation: "vertical", sx: { ml: 5 } }),
389
394
  /* @__PURE__ */ r(
390
395
  oe,
391
396
  {
392
- isMobile: d,
393
- order: d ? 1 : "unset",
394
- isMyself: n,
395
- switchPassport: q,
396
- switchProfile: i.switchProfile,
397
- user: s.data,
398
- refreshProfile: j,
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: d ? "16px 0 0 0" : "40px 24px 24px 40px",
402
- ...d ? {} : { width: 320, maxWidth: 320, flexShrink: 0 },
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
- o,
413
- h,
415
+ l,
416
+ i,
417
+ s,
414
418
  g,
415
- F,
416
- M
417
- ]), J = c(() => n ? !1 : o?.isPrivate, [n, o]);
418
- if (c(() => w ? !1 : !L && !g && l?.length > 0 || !o || J, [L, g, l, o, J, w])) {
419
- const e = l[0]?.url, t = l.find((x) => x.value === e);
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
- ie(e, {
422
- did: n ? void 0 : m
426
+ te(e, {
427
+ did: i ? void 0 : x
423
428
  })
424
429
  ), null;
425
430
  }
426
- return I || w ? /* @__PURE__ */ p(a, { children: [
427
- /* @__PURE__ */ r(re, { children: /* @__PURE__ */ r("title", { children: _ }) }),
428
- /* @__PURE__ */ r(ne, { style: { display: "none" } }),
429
- /* @__PURE__ */ p(ae, { children: [
430
- V,
431
- H
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__ */ p(
434
- a,
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(re, { children: /* @__PURE__ */ r("title", { children: _ }) }),
443
- /* @__PURE__ */ r(ne, { bordered: !0, ...de, maxWidth: "100%" }),
444
- /* @__PURE__ */ p(ae, { children: [
445
- V,
446
- H
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
- ce ? null : /* @__PURE__ */ r(
449
- Le,
453
+ ue ? null : /* @__PURE__ */ r(
454
+ Be,
450
455
  {
451
456
  bordered: !0,
452
- ...ue,
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
- Br as default
470
+ jr as default
466
471
  };
@@ -0,0 +1,5 @@
1
+ import { User } from '../../../../@types';
2
+ declare function Chat({ user }: {
3
+ user: User;
4
+ }): import("react/jsx-runtime").JSX.Element | null;
5
+ export default Chat;
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ declare function Follow(): import("react/jsx-runtime").JSX.Element;
2
+ export default Follow;