@blocklet/ui-react 2.10.90 → 2.11.1
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 -0
- package/lib/UserCenter/components/config-profile.js +1 -1
- package/lib/UserCenter/components/notification.js +1 -2
- package/lib/UserCenter/components/privacy.d.ts +1 -0
- package/lib/UserCenter/components/privacy.js +3 -0
- package/lib/UserCenter/components/settings.d.ts +1 -1
- package/lib/UserCenter/components/settings.js +20 -18
- package/lib/UserCenter/components/third-party-login/index.js +4 -3
- package/lib/UserCenter/components/user-center.d.ts +1 -1
- package/lib/UserCenter/components/user-center.js +192 -195
- package/lib/UserCenter/components/user-info/index.d.ts +1 -0
- package/lib/UserCenter/components/user-info/index.js +1 -0
- package/lib/UserCenter/components/user-info/switch-role.d.ts +7 -0
- package/lib/UserCenter/components/user-info/switch-role.js +43 -0
- package/lib/UserCenter/components/user-info/user-basic-info.d.ts +1 -2
- package/lib/UserCenter/components/user-info/user-basic-info.js +33 -85
- package/lib/UserCenter/libs/locales.d.ts +4 -0
- package/lib/UserCenter/libs/locales.js +6 -2
- package/lib/common/header-addons.js +8 -0
- package/lib/common/notification-addon.d.ts +13 -0
- package/lib/common/notification-addon.js +41 -0
- package/package.json +5 -5
- package/src/@types/index.ts +1 -0
- package/src/UserCenter/components/config-profile.tsx +3 -1
- package/src/UserCenter/components/notification.tsx +1 -2
- package/src/UserCenter/components/privacy.tsx +4 -0
- package/src/UserCenter/components/settings.tsx +27 -27
- package/src/UserCenter/components/third-party-login/index.tsx +10 -3
- package/src/UserCenter/components/user-center.tsx +195 -180
- package/src/UserCenter/components/user-info/index.tsx +1 -0
- package/src/UserCenter/components/user-info/switch-role.tsx +44 -0
- package/src/UserCenter/components/user-info/user-basic-info.tsx +33 -81
- package/src/UserCenter/libs/locales.ts +4 -0
- package/src/common/header-addons.jsx +10 -0
- package/src/common/notification-addon.jsx +49 -0
package/lib/@types/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export default function ConfigProfile({ user, onSave }) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
),
|
|
64
|
-
/* @__PURE__ */ jsx(Select, { fullWidth: true, value: currentState.locale, onChange: handleChange, size: "small", children: (window.blocklet.languages || languages).map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x.code, children: x.name })) })
|
|
64
|
+
/* @__PURE__ */ jsx(Select, { fullWidth: true, value: currentState.locale, onChange: handleChange, size: "small", children: (window.blocklet.languages || languages).map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x.code, children: x.name }, x.code)) })
|
|
65
65
|
] })
|
|
66
66
|
]
|
|
67
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Alert, Box, CircularProgress,
|
|
2
|
+
import { Alert, Box, CircularProgress, Stack, Typography } from "@mui/material";
|
|
3
3
|
import { useCreation, useMemoizedFn, useReactive, useRequest } from "ahooks";
|
|
4
4
|
import { Icon } from "@iconify/react";
|
|
5
5
|
import AddRoundedIcon from "@iconify-icons/material-symbols/add-rounded";
|
|
@@ -201,7 +201,6 @@ export default function Notification({ user }) {
|
|
|
201
201
|
]
|
|
202
202
|
}
|
|
203
203
|
),
|
|
204
|
-
/* @__PURE__ */ jsx(Divider, {}),
|
|
205
204
|
/* @__PURE__ */ jsxs(Stack, { spacing: 1.5, useFlexGap: true, direction: "column", alignItems: "start", children: [
|
|
206
205
|
webhooks.map((item, index) => /* @__PURE__ */ jsx(
|
|
207
206
|
WebhookItem,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import { useCreation, useMemoizedFn, useReactive } from "ahooks";
|
|
2
|
+
import { Box, Divider, Typography } from "@mui/material";
|
|
3
|
+
import { useCreation, useMemoizedFn } from "ahooks";
|
|
5
4
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
6
5
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
6
|
+
import colors from "@arcblock/ux/lib/Colors/themes/temp";
|
|
7
7
|
import { ConfigUserSpaceProvider } from "../../contexts/config-user-space.js";
|
|
8
8
|
import { translations } from "../libs/locales.js";
|
|
9
9
|
import Notification from "./notification.js";
|
|
@@ -28,7 +28,8 @@ export default function Settings({
|
|
|
28
28
|
return {
|
|
29
29
|
key: item.value,
|
|
30
30
|
name: item.label,
|
|
31
|
-
value: item.protected
|
|
31
|
+
value: item.protected,
|
|
32
|
+
isPrivate: item.isPrivate
|
|
32
33
|
};
|
|
33
34
|
});
|
|
34
35
|
}, [settings?.userCenterTabs]);
|
|
@@ -69,16 +70,7 @@ export default function Settings({
|
|
|
69
70
|
}
|
|
70
71
|
].filter(Boolean);
|
|
71
72
|
}, [user, privacyConfigList]);
|
|
72
|
-
|
|
73
|
-
tab: tabs[0].value
|
|
74
|
-
});
|
|
75
|
-
const currentTab = useCreation(() => {
|
|
76
|
-
return tabs.find((x) => x.value === currentState.tab);
|
|
77
|
-
}, [currentState.tab, tabs]);
|
|
78
|
-
const handleChangeTab = useMemoizedFn((value) => {
|
|
79
|
-
currentState.tab = value;
|
|
80
|
-
});
|
|
81
|
-
return currentTab && /* @__PURE__ */ jsxs(
|
|
73
|
+
return /* @__PURE__ */ jsx(
|
|
82
74
|
Box,
|
|
83
75
|
{
|
|
84
76
|
...rest,
|
|
@@ -89,10 +81,20 @@ export default function Settings({
|
|
|
89
81
|
},
|
|
90
82
|
maxWidth: "100%"
|
|
91
83
|
},
|
|
92
|
-
children: [
|
|
93
|
-
/* @__PURE__ */ jsx(
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
children: tabs.map((tab, index) => /* @__PURE__ */ jsxs(Box, { children: [
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
Typography,
|
|
87
|
+
{
|
|
88
|
+
sx: {
|
|
89
|
+
color: colors.foregroundsFgBase,
|
|
90
|
+
fontWeight: 600
|
|
91
|
+
},
|
|
92
|
+
children: tab.label
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ jsx(Box, { mt: 2.5, children: tab.content }),
|
|
96
|
+
index < tabs.length - 1 ? /* @__PURE__ */ jsx(Divider, { sx: { mt: 2.5, mb: 2.5 } }) : null
|
|
97
|
+
] }, tab.value))
|
|
96
98
|
}
|
|
97
99
|
);
|
|
98
100
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useState } from "react";
|
|
3
3
|
import { Box } from "@mui/material";
|
|
4
4
|
import { useAsyncEffect, useCreation } from "ahooks";
|
|
5
5
|
import { getConnectedAccounts, getSourceProvider } from "@arcblock/ux/lib/SessionUser/libs/utils";
|
|
6
6
|
import { LOGIN_PROVIDER } from "@arcblock/ux/lib/Util/constant";
|
|
7
7
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
8
|
+
import Empty from "@arcblock/ux/lib/Empty";
|
|
8
9
|
import ThirdPartyItem from "./third-party-item.js";
|
|
9
10
|
export default function ThirdPartyLogin({ user }) {
|
|
10
11
|
const { session } = useContext(SessionContext);
|
|
@@ -102,9 +103,9 @@ export default function ThirdPartyLogin({ user }) {
|
|
|
102
103
|
display: "grid",
|
|
103
104
|
gridTemplateColumns: "1fr min-content"
|
|
104
105
|
},
|
|
105
|
-
children: normalizedAccounts.map((account) => {
|
|
106
|
+
children: !normalizedAccounts.length ? /* @__PURE__ */ jsx(Empty, {}) : /* @__PURE__ */ jsx(Fragment, { children: normalizedAccounts.map((account) => {
|
|
106
107
|
return /* @__PURE__ */ jsx(ThirdPartyItem, { item: account }, account?.provider);
|
|
107
|
-
})
|
|
108
|
+
}) })
|
|
108
109
|
}
|
|
109
110
|
);
|
|
110
111
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoxProps } from '@mui/material';
|
|
2
|
-
export default function UserCenter({ children, notLoginContent, currentTab, contentProps, disableAutoRedirect,
|
|
2
|
+
export default function UserCenter({ children, notLoginContent, currentTab, contentProps, disableAutoRedirect, hideFooter, headerProps, footerProps, userDid, stickySidebar, }: {
|
|
3
3
|
readonly children: any;
|
|
4
4
|
readonly notLoginContent: any;
|
|
5
5
|
readonly currentTab: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { Box, CircularProgress, Typography } from "@mui/material";
|
|
4
|
-
import { useCreation, useMemoizedFn,
|
|
3
|
+
import { Box, CircularProgress, Divider, Typography } from "@mui/material";
|
|
4
|
+
import { useCreation, useMemoizedFn, useRequest } from "ahooks";
|
|
5
5
|
import pWaitFor from "p-wait-for";
|
|
6
6
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
7
7
|
import Tabs from "@arcblock/ux/lib/Tabs";
|
|
@@ -14,11 +14,12 @@ import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
|
14
14
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
15
15
|
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
16
16
|
import cloneDeep from "lodash/cloneDeep";
|
|
17
|
-
import { getQuery, withQuery } from "ufo";
|
|
17
|
+
import { getQuery, withQuery, joinURL } from "ufo";
|
|
18
|
+
import { PROFILE_URL } from "@arcblock/ux/lib/Util/constant";
|
|
18
19
|
import Footer from "../../Footer/index.js";
|
|
19
20
|
import Header from "../../Header/index.js";
|
|
20
21
|
import { translations } from "../libs/locales.js";
|
|
21
|
-
import { UserInfo, UserBasicInfo } from "./user-info/index.js";
|
|
22
|
+
import { UserInfo, UserBasicInfo, SwitchRole } from "./user-info/index.js";
|
|
22
23
|
import { formatBlockletInfo, getLocalizedNavigation } from "../../blocklets.js";
|
|
23
24
|
import Passport from "./passport.js";
|
|
24
25
|
import Settings from "./settings.js";
|
|
@@ -30,7 +31,6 @@ export default function UserCenter({
|
|
|
30
31
|
currentTab,
|
|
31
32
|
contentProps = {},
|
|
32
33
|
disableAutoRedirect = false,
|
|
33
|
-
autoPopupSetting = false,
|
|
34
34
|
hideFooter = false,
|
|
35
35
|
headerProps = {},
|
|
36
36
|
footerProps = {},
|
|
@@ -92,7 +92,7 @@ export default function UserCenter({
|
|
|
92
92
|
loadingDelay: 300
|
|
93
93
|
}
|
|
94
94
|
);
|
|
95
|
-
const { confirmHolder
|
|
95
|
+
const { confirmHolder } = useConfirm({
|
|
96
96
|
fullScreen: isMobile,
|
|
97
97
|
sx: {
|
|
98
98
|
".MuiDialog-paper": {
|
|
@@ -122,20 +122,40 @@ export default function UserCenter({
|
|
|
122
122
|
return blocklet;
|
|
123
123
|
}
|
|
124
124
|
}, []);
|
|
125
|
+
const defaultTabs = useCreation(() => {
|
|
126
|
+
const tabs = [
|
|
127
|
+
{
|
|
128
|
+
label: t("common.profile"),
|
|
129
|
+
protected: false,
|
|
130
|
+
url: joinURL(PROFILE_URL, "/profile")
|
|
131
|
+
}
|
|
132
|
+
];
|
|
133
|
+
if (isMyself) {
|
|
134
|
+
tabs.push({
|
|
135
|
+
label: t("common.setting"),
|
|
136
|
+
protected: true,
|
|
137
|
+
isPrivate: true,
|
|
138
|
+
url: joinURL(PROFILE_URL, "/settings")
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return tabs;
|
|
142
|
+
}, [isMyself]);
|
|
125
143
|
const userCenterTabs = useCreation(() => {
|
|
126
144
|
const menus = formattedBlocklet?.navigation?.userCenter || [];
|
|
127
145
|
const localizedMenus = getLocalizedNavigation(menus, locale) || [];
|
|
128
|
-
|
|
129
|
-
|
|
146
|
+
const allMenus = localizedMenus.concat(defaultTabs);
|
|
147
|
+
return allMenus.map((x) => {
|
|
148
|
+
const value = x._rawLink ?? x.link ?? x.url;
|
|
130
149
|
return {
|
|
131
150
|
value,
|
|
132
|
-
label: x.title,
|
|
133
|
-
url: x.link,
|
|
134
|
-
protected: privacyState?.data?.[value] ?? false
|
|
151
|
+
label: x.title || x.label,
|
|
152
|
+
url: x.link || x.url,
|
|
153
|
+
protected: privacyState?.data?.[value] ?? false,
|
|
154
|
+
isPrivate: x.isPrivate
|
|
135
155
|
// icon: x.icon,
|
|
136
156
|
};
|
|
137
|
-
});
|
|
138
|
-
}, [formattedBlocklet, userState.data, privacyState?.data, locale]);
|
|
157
|
+
}).filter((x) => isMyself || !x.isPrivate);
|
|
158
|
+
}, [formattedBlocklet, userState.data, privacyState?.data, locale, defaultTabs, isMyself]);
|
|
139
159
|
const currentActiveTab = useCreation(() => {
|
|
140
160
|
return userCenterTabs.find((x) => x.value === currentTab);
|
|
141
161
|
}, [userCenterTabs]);
|
|
@@ -166,25 +186,61 @@ export default function UserCenter({
|
|
|
166
186
|
}
|
|
167
187
|
);
|
|
168
188
|
}, [userState.data, userCenterTabs, privacyState.data, privacyState.runAsync]);
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
189
|
+
const isSettingTab = useCreation(() => {
|
|
190
|
+
return currentActiveTab && currentActiveTab?.value === joinURL(PROFILE_URL, "/settings");
|
|
191
|
+
}, [currentActiveTab]);
|
|
192
|
+
const isProfileTab = useCreation(() => {
|
|
193
|
+
return currentActiveTab && currentActiveTab?.value === joinURL(PROFILE_URL, "/profile");
|
|
194
|
+
}, [currentActiveTab]);
|
|
195
|
+
const renderDefaultTab = useCreation(() => {
|
|
196
|
+
if (isProfileTab) {
|
|
197
|
+
return /* @__PURE__ */ jsx(
|
|
198
|
+
Box,
|
|
199
|
+
{
|
|
200
|
+
sx: {
|
|
201
|
+
width: {
|
|
202
|
+
sx: "100%",
|
|
203
|
+
md: 420
|
|
204
|
+
},
|
|
205
|
+
maxWidth: "100%",
|
|
206
|
+
position: "relative"
|
|
207
|
+
},
|
|
208
|
+
children: /* @__PURE__ */ jsxs(
|
|
209
|
+
Box,
|
|
210
|
+
{
|
|
211
|
+
sx: {
|
|
212
|
+
display: "flex",
|
|
213
|
+
flexDirection: "column",
|
|
214
|
+
gap: 2.5,
|
|
215
|
+
position: {
|
|
216
|
+
xs: "static",
|
|
217
|
+
md: stickySidebar ? "sticky" : "static"
|
|
218
|
+
},
|
|
219
|
+
top: (theme) => stickySidebar ? theme.spacing(3) : "unset"
|
|
220
|
+
},
|
|
221
|
+
children: [
|
|
222
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
223
|
+
/* @__PURE__ */ jsxs(Box, { display: "flex", justifyContent: "space-between", children: [
|
|
224
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: isMyself ? t("myInfo") : t("hisInfo") }),
|
|
225
|
+
isMyself ? /* @__PURE__ */ jsx(SwitchRole, { user: userState.data, switchPassport: session.switchPassport }) : null
|
|
226
|
+
] }),
|
|
227
|
+
/* @__PURE__ */ jsx(UserInfo, { user: userState.data, isMySelf: isMyself })
|
|
228
|
+
] }),
|
|
229
|
+
isMyself ? /* @__PURE__ */ jsxs(Box, { children: [
|
|
230
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
|
|
231
|
+
/* @__PURE__ */ jsx(Passport, { user: userState.data })
|
|
232
|
+
] }) : null
|
|
233
|
+
]
|
|
234
|
+
}
|
|
235
|
+
)
|
|
236
|
+
}
|
|
237
|
+
);
|
|
186
238
|
}
|
|
187
|
-
|
|
239
|
+
if (isSettingTab && isMyself) {
|
|
240
|
+
return settingContent;
|
|
241
|
+
}
|
|
242
|
+
return null;
|
|
243
|
+
}, [isSettingTab, isProfileTab, userState, isMyself, stickySidebar, settingContent]);
|
|
188
244
|
const content = useCreation(() => {
|
|
189
245
|
if (userState.loading || session.loading) {
|
|
190
246
|
return null;
|
|
@@ -221,185 +277,127 @@ export default function UserCenter({
|
|
|
221
277
|
}
|
|
222
278
|
) });
|
|
223
279
|
}
|
|
224
|
-
return /* @__PURE__ */ jsxs(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
{
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
md: 1
|
|
233
|
-
},
|
|
234
|
-
overflow: "hidden"
|
|
235
|
-
}
|
|
236
|
-
],
|
|
237
|
-
children: [
|
|
238
|
-
userState?.data?.fullName ? /* @__PURE__ */ jsx(
|
|
239
|
-
Typography,
|
|
240
|
-
{
|
|
241
|
-
variant: "h4",
|
|
242
|
-
sx: {
|
|
243
|
-
py: 1.5,
|
|
244
|
-
fontSize: "18px !important",
|
|
245
|
-
fontWeight: 700,
|
|
246
|
-
lineHeight: 1.5,
|
|
247
|
-
display: {
|
|
248
|
-
xs: "none",
|
|
249
|
-
md: "block"
|
|
250
|
-
}
|
|
251
|
-
},
|
|
252
|
-
children: userState.data.fullName
|
|
253
|
-
}
|
|
254
|
-
) : null,
|
|
255
|
-
/* @__PURE__ */ jsx(
|
|
256
|
-
UserBasicInfo,
|
|
257
|
-
{
|
|
258
|
-
isMyself,
|
|
259
|
-
switchPassport: session.switchPassport,
|
|
260
|
-
switchProfile: session.switchProfile,
|
|
261
|
-
openSettings,
|
|
262
|
-
user: userState.data,
|
|
263
|
-
showFullDid: false,
|
|
264
|
-
sx: {
|
|
265
|
-
display: {
|
|
266
|
-
md: "none",
|
|
267
|
-
xs: "block"
|
|
268
|
-
},
|
|
269
|
-
mb: 1.5
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
),
|
|
273
|
-
userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
|
|
274
|
-
Box,
|
|
275
|
-
{
|
|
276
|
-
sx: {
|
|
277
|
-
overflow: "auto",
|
|
278
|
-
padding: "1px"
|
|
279
|
-
},
|
|
280
|
-
children: [
|
|
281
|
-
/* @__PURE__ */ jsx(
|
|
282
|
-
Tabs,
|
|
283
|
-
{
|
|
284
|
-
variant: "line",
|
|
285
|
-
tabs: userCenterTabs,
|
|
286
|
-
current: currentTab,
|
|
287
|
-
onChange: handleChangeTab,
|
|
288
|
-
sx: { mb: 1.5 }
|
|
289
|
-
}
|
|
290
|
-
),
|
|
291
|
-
!privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
|
|
292
|
-
Box,
|
|
293
|
-
{
|
|
294
|
-
sx: {
|
|
295
|
-
height: "100%",
|
|
296
|
-
minWidth: "160px",
|
|
297
|
-
minHeight: "160px",
|
|
298
|
-
display: "flex",
|
|
299
|
-
justifyContent: "center",
|
|
300
|
-
alignItems: "center"
|
|
301
|
-
},
|
|
302
|
-
children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
|
|
303
|
-
}
|
|
304
|
-
) : (
|
|
305
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
306
|
-
/* @__PURE__ */ jsx(Fragment, { children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : (
|
|
307
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
308
|
-
/* @__PURE__ */ jsx(Fragment, { children: children && /* @__PURE__ */ jsx(Box, { ...contentProps, children }) })
|
|
309
|
-
) })
|
|
310
|
-
)
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
) : null,
|
|
314
|
-
userCenterTabs.length === 0 ? /* @__PURE__ */ jsx(
|
|
315
|
-
Box,
|
|
316
|
-
{
|
|
317
|
-
sx: {
|
|
318
|
-
display: {
|
|
319
|
-
xs: isMyself ? "none" : "block",
|
|
320
|
-
md: "block"
|
|
321
|
-
},
|
|
322
|
-
py: 3
|
|
323
|
-
},
|
|
324
|
-
children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
|
|
325
|
-
}
|
|
326
|
-
) : null
|
|
327
|
-
]
|
|
328
|
-
}
|
|
329
|
-
),
|
|
330
|
-
/* @__PURE__ */ jsx(
|
|
331
|
-
Box,
|
|
332
|
-
{
|
|
333
|
-
sx: {
|
|
334
|
-
display: {
|
|
335
|
-
xs: "none",
|
|
336
|
-
md: "block"
|
|
280
|
+
return /* @__PURE__ */ jsxs(
|
|
281
|
+
Box,
|
|
282
|
+
{
|
|
283
|
+
sx: [
|
|
284
|
+
{
|
|
285
|
+
flex: {
|
|
286
|
+
xs: "revert",
|
|
287
|
+
md: 1
|
|
337
288
|
},
|
|
338
|
-
|
|
339
|
-
my: -3,
|
|
340
|
-
backgroundColor: colors.strokeSep
|
|
289
|
+
overflow: "hidden"
|
|
341
290
|
}
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
{
|
|
347
|
-
sx: {
|
|
348
|
-
width: {
|
|
349
|
-
sx: "100%",
|
|
350
|
-
md: 420
|
|
351
|
-
},
|
|
352
|
-
maxWidth: "100%",
|
|
353
|
-
position: "relative"
|
|
354
|
-
},
|
|
355
|
-
children: /* @__PURE__ */ jsxs(
|
|
356
|
-
Box,
|
|
291
|
+
],
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ jsx(
|
|
294
|
+
UserBasicInfo,
|
|
357
295
|
{
|
|
296
|
+
isMyself,
|
|
297
|
+
switchPassport: session.switchPassport,
|
|
298
|
+
switchProfile: session.switchProfile,
|
|
299
|
+
user: userState.data,
|
|
300
|
+
showFullDid: false,
|
|
358
301
|
sx: {
|
|
359
302
|
display: "flex",
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
303
|
+
gap: 3,
|
|
304
|
+
mt: 2
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
/* @__PURE__ */ jsx(Divider, { sx: { mt: 3, mb: 3 } }),
|
|
309
|
+
userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
|
|
310
|
+
Box,
|
|
311
|
+
{
|
|
312
|
+
display: isMobile ? "block" : "flex",
|
|
313
|
+
gap: 2,
|
|
314
|
+
sx: {
|
|
315
|
+
overflow: "auto",
|
|
316
|
+
padding: "1px"
|
|
367
317
|
},
|
|
368
318
|
children: [
|
|
369
319
|
/* @__PURE__ */ jsx(
|
|
370
|
-
|
|
320
|
+
Tabs,
|
|
371
321
|
{
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
322
|
+
orientation: isMobile ? "horizontal" : "vertical",
|
|
323
|
+
variant: "line",
|
|
324
|
+
tabs: userCenterTabs,
|
|
325
|
+
current: currentTab,
|
|
326
|
+
onChange: handleChangeTab,
|
|
377
327
|
sx: {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
328
|
+
width: isMobile ? "100%" : 180,
|
|
329
|
+
".MuiTabs-flexContainer": {
|
|
330
|
+
gap: 1.5,
|
|
331
|
+
".MuiButtonBase-root": {
|
|
332
|
+
fontSize: 16
|
|
333
|
+
},
|
|
334
|
+
".MuiTab-root": {
|
|
335
|
+
display: "block",
|
|
336
|
+
textAlign: "left"
|
|
337
|
+
}
|
|
381
338
|
}
|
|
382
339
|
}
|
|
383
340
|
}
|
|
384
341
|
),
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
342
|
+
!privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
|
|
343
|
+
Box,
|
|
344
|
+
{
|
|
345
|
+
sx: {
|
|
346
|
+
height: "100%",
|
|
347
|
+
minWidth: "160px",
|
|
348
|
+
minHeight: "160px",
|
|
349
|
+
display: "flex",
|
|
350
|
+
justifyContent: "center",
|
|
351
|
+
alignItems: "center"
|
|
352
|
+
},
|
|
353
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
|
|
354
|
+
}
|
|
355
|
+
) : (
|
|
356
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
357
|
+
/* @__PURE__ */ jsx(Box, { sx: { flex: 1 }, children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : (
|
|
358
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
359
|
+
/* @__PURE__ */ jsx(Fragment, { children: children ? /* @__PURE__ */ jsx(Box, { ...contentProps, children }) : /* @__PURE__ */ jsx(Fragment, { children: renderDefaultTab }) })
|
|
360
|
+
) })
|
|
361
|
+
)
|
|
393
362
|
]
|
|
394
363
|
}
|
|
395
|
-
)
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
364
|
+
) : null,
|
|
365
|
+
userCenterTabs.length === 0 ? /* @__PURE__ */ jsx(
|
|
366
|
+
Box,
|
|
367
|
+
{
|
|
368
|
+
sx: {
|
|
369
|
+
display: {
|
|
370
|
+
xs: isMyself ? "none" : "block",
|
|
371
|
+
md: "block"
|
|
372
|
+
},
|
|
373
|
+
py: 3
|
|
374
|
+
},
|
|
375
|
+
children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
|
|
376
|
+
}
|
|
377
|
+
) : null
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
}, [
|
|
382
|
+
userState,
|
|
383
|
+
userCenterTabs,
|
|
384
|
+
isMyself,
|
|
385
|
+
currentActiveTab,
|
|
386
|
+
privacyState,
|
|
387
|
+
currentTab,
|
|
388
|
+
stickySidebar,
|
|
389
|
+
renderDefaultTab
|
|
390
|
+
]);
|
|
391
|
+
const isPrivateActive = useCreation(() => {
|
|
392
|
+
if (isMyself) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
return currentActiveTab?.isPrivate;
|
|
396
|
+
}, [isMyself, currentActiveTab]);
|
|
397
|
+
if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0 || !currentActiveTab || isPrivateActive) {
|
|
401
398
|
const firstUserCenterUrl = formattedBlocklet?.navigation?.userCenter[0]?.link;
|
|
402
|
-
|
|
399
|
+
const firstTab = userCenterTabs.find((x) => x.value === firstUserCenterUrl);
|
|
400
|
+
if (firstUserCenterUrl && !firstTab?.isPrivate) {
|
|
403
401
|
window.location.replace(
|
|
404
402
|
withQuery(firstUserCenterUrl, {
|
|
405
403
|
did: isMyself ? void 0 : currentDid
|
|
@@ -412,13 +410,12 @@ export default function UserCenter({
|
|
|
412
410
|
Box,
|
|
413
411
|
{
|
|
414
412
|
sx: {
|
|
415
|
-
backgroundColor: colors.backgroundsBgSubtitle,
|
|
416
413
|
minHeight: "100vh",
|
|
417
414
|
display: "flex",
|
|
418
415
|
flexDirection: "column"
|
|
419
416
|
},
|
|
420
417
|
children: [
|
|
421
|
-
/* @__PURE__ */ jsx(Header, { bordered: true, ...headerProps }),
|
|
418
|
+
/* @__PURE__ */ jsx(Header, { bordered: true, ...headerProps, maxWidth: "100%" }),
|
|
422
419
|
/* @__PURE__ */ jsxs(
|
|
423
420
|
Box,
|
|
424
421
|
{
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { User } from '../../../@types';
|
|
2
|
+
declare function SwitchRole({ user, switchPassport }: {
|
|
3
|
+
user: User;
|
|
4
|
+
switchPassport: () => void;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
declare const _default: import("react").MemoExoticComponent<typeof SwitchRole>;
|
|
7
|
+
export default _default;
|