@blocklet/ui-react 2.9.91 → 2.10.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/build.config.ts +1 -6
- package/lib/@types/index.d.ts +1 -0
- package/lib/@types/index.js +0 -1
- package/lib/BlockletStudio/index.js +50 -50
- package/lib/ComponentInstaller/index.js +122 -202
- package/lib/ComponentInstaller/installer-item.js +116 -138
- package/lib/ComponentInstaller/locales.js +5 -10
- package/lib/ComponentInstaller/use-component-installed.js +37 -41
- package/lib/ComponentManager/components/add-component.js +58 -67
- package/lib/ComponentManager/components/check-component.js +2 -9
- package/lib/ComponentManager/components/publish-component.js +50 -59
- package/lib/ComponentManager/components/resource-dialog.js +42 -39
- package/lib/ComponentManager/index.js +3 -27
- package/lib/ComponentManager/libs/locales.js +2 -8
- package/lib/Dashboard/index.js +74 -99
- package/lib/Footer/brand.js +21 -43
- package/lib/Footer/copyright.js +15 -24
- package/lib/Footer/index.js +47 -71
- package/lib/Footer/internal-footer.js +72 -100
- package/lib/Footer/layout/plain.js +26 -45
- package/lib/Footer/layout/row.js +12 -29
- package/lib/Footer/layout/standard.js +34 -64
- package/lib/Footer/links.js +74 -104
- package/lib/Footer/social-media.js +35 -42
- package/lib/Header/index.js +69 -117
- package/lib/Icon/index.js +18 -53
- package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
- package/lib/UserCenter/components/config-profile.js +67 -0
- package/lib/UserCenter/components/notification.js +203 -186
- package/lib/UserCenter/components/passport.js +70 -79
- package/lib/UserCenter/components/privacy.js +86 -88
- package/lib/UserCenter/components/settings.js +74 -84
- package/lib/UserCenter/components/storage/connect-to.js +56 -75
- package/lib/UserCenter/components/storage/connected.js +16 -37
- package/lib/UserCenter/components/storage/delete.js +42 -51
- package/lib/UserCenter/components/storage/disconnect.js +15 -29
- package/lib/UserCenter/components/storage/index.js +20 -54
- package/lib/UserCenter/components/storage/item.js +94 -122
- package/lib/UserCenter/components/storage/preview-nft.js +77 -85
- package/lib/UserCenter/components/third-party-login/index.js +49 -61
- package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
- package/lib/UserCenter/components/user-center.js +276 -287
- package/lib/UserCenter/components/user-info/index.js +3 -27
- package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
- package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
- package/lib/UserCenter/components/user-info/user-info.js +41 -74
- package/lib/UserCenter/components/webhook-item.js +184 -177
- package/lib/UserCenter/index.js +1 -13
- package/lib/UserCenter/libs/api.js +4 -16
- package/lib/UserCenter/libs/locales.d.ts +10 -0
- package/lib/UserCenter/libs/locales.js +12 -8
- package/lib/UserCenter/libs/utils.js +7 -17
- package/lib/UserSessions/components/user-session-info.js +88 -85
- package/lib/UserSessions/components/user-sessions.js +177 -213
- package/lib/UserSessions/index.js +1 -13
- package/lib/UserSessions/libs/locales.js +2 -8
- package/lib/UserSessions/libs/utils.js +4 -11
- package/lib/blocklets.js +59 -63
- package/lib/common/header-addons.js +44 -60
- package/lib/common/link-blocker.js +9 -18
- package/lib/common/overridable-theme-provider.js +10 -23
- package/lib/common/wallet-hidden-topbar.js +7 -14
- package/lib/contexts/config-user-space.js +38 -46
- package/lib/hooks/use-mobile.js +5 -13
- package/lib/index.js +10 -100
- package/lib/libs/client.js +2 -8
- package/lib/libs/spaces.js +6 -13
- package/lib/types.js +39 -41
- package/lib/utils.js +25 -44
- package/package.json +8 -38
- package/src/@types/index.ts +1 -0
- package/src/Footer/brand.jsx +6 -1
- package/src/UserCenter/components/config-profile.tsx +70 -0
- package/src/UserCenter/components/notification.tsx +63 -47
- package/src/UserCenter/components/settings.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +10 -0
- package/es/@types/index.d.ts +0 -101
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +0 -16
- package/es/BlockletStudio/index.d.ts +0 -28
- package/es/BlockletStudio/index.js +0 -114
- package/es/ComponentInstaller/index.d.ts +0 -37
- package/es/ComponentInstaller/index.js +0 -200
- package/es/ComponentInstaller/installer-item.d.ts +0 -21
- package/es/ComponentInstaller/installer-item.js +0 -139
- package/es/ComponentInstaller/locales.d.ts +0 -28
- package/es/ComponentInstaller/locales.js +0 -22
- package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
- package/es/ComponentInstaller/use-component-installed.js +0 -88
- package/es/ComponentManager/components/add-component.d.ts +0 -16
- package/es/ComponentManager/components/add-component.js +0 -114
- package/es/ComponentManager/components/check-component.d.ts +0 -2
- package/es/ComponentManager/components/check-component.js +0 -2
- package/es/ComponentManager/components/publish-component.d.ts +0 -10
- package/es/ComponentManager/components/publish-component.js +0 -76
- package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
- package/es/ComponentManager/components/resource-dialog.js +0 -74
- package/es/ComponentManager/index.d.ts +0 -3
- package/es/ComponentManager/index.js +0 -3
- package/es/ComponentManager/libs/locales.d.ts +0 -14
- package/es/ComponentManager/libs/locales.js +0 -14
- package/es/Dashboard/index.d.ts +0 -40
- package/es/Dashboard/index.js +0 -118
- package/es/Footer/brand.d.ts +0 -22
- package/es/Footer/brand.js +0 -73
- package/es/Footer/copyright.d.ts +0 -18
- package/es/Footer/copyright.js +0 -25
- package/es/Footer/index.d.ts +0 -6
- package/es/Footer/index.js +0 -82
- package/es/Footer/internal-footer.d.ts +0 -29
- package/es/Footer/internal-footer.js +0 -117
- package/es/Footer/layout/plain.d.ts +0 -15
- package/es/Footer/layout/plain.js +0 -39
- package/es/Footer/layout/row.d.ts +0 -18
- package/es/Footer/layout/row.js +0 -41
- package/es/Footer/layout/standard.d.ts +0 -15
- package/es/Footer/layout/standard.js +0 -53
- package/es/Footer/links.d.ts +0 -22
- package/es/Footer/links.js +0 -207
- package/es/Footer/social-media.d.ts +0 -14
- package/es/Footer/social-media.js +0 -60
- package/es/Header/index.d.ts +0 -10
- package/es/Header/index.js +0 -155
- package/es/Icon/index.d.ts +0 -23
- package/es/Icon/index.js +0 -55
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.js +0 -248
- package/es/UserCenter/components/passport.d.ts +0 -6
- package/es/UserCenter/components/passport.js +0 -88
- package/es/UserCenter/components/privacy.d.ts +0 -11
- package/es/UserCenter/components/privacy.js +0 -99
- package/es/UserCenter/components/settings.d.ts +0 -9
- package/es/UserCenter/components/settings.js +0 -89
- package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
- package/es/UserCenter/components/storage/connect-to.js +0 -108
- package/es/UserCenter/components/storage/connected.d.ts +0 -7
- package/es/UserCenter/components/storage/connected.js +0 -24
- package/es/UserCenter/components/storage/delete.d.ts +0 -7
- package/es/UserCenter/components/storage/delete.js +0 -62
- package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
- package/es/UserCenter/components/storage/disconnect.js +0 -23
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
- package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/es/UserCenter/components/storage/index.d.ts +0 -3
- package/es/UserCenter/components/storage/index.js +0 -27
- package/es/UserCenter/components/storage/item.d.ts +0 -9
- package/es/UserCenter/components/storage/item.js +0 -158
- package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
- package/es/UserCenter/components/storage/preview-nft.js +0 -80
- package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
- package/es/UserCenter/components/third-party-login/index.js +0 -110
- package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
- package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
- package/es/UserCenter/components/user-center.d.ts +0 -15
- package/es/UserCenter/components/user-center.js +0 -414
- package/es/UserCenter/components/user-info/index.d.ts +0 -3
- package/es/UserCenter/components/user-info/index.js +0 -3
- package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
- package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-info-item.js +0 -47
- package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
- package/es/UserCenter/components/user-info/user-info.js +0 -66
- package/es/UserCenter/components/webhook-item.d.ts +0 -3
- package/es/UserCenter/components/webhook-item.js +0 -243
- package/es/UserCenter/index.d.ts +0 -1
- package/es/UserCenter/index.js +0 -1
- package/es/UserCenter/libs/api.d.ts +0 -3
- package/es/UserCenter/libs/api.js +0 -4
- package/es/UserCenter/libs/locales.d.ts +0 -162
- package/es/UserCenter/libs/locales.js +0 -162
- package/es/UserCenter/libs/utils.d.ts +0 -4
- package/es/UserCenter/libs/utils.js +0 -14
- package/es/UserSessions/components/user-session-info.d.ts +0 -6
- package/es/UserSessions/components/user-session-info.js +0 -92
- package/es/UserSessions/components/user-sessions.d.ts +0 -9
- package/es/UserSessions/components/user-sessions.js +0 -265
- package/es/UserSessions/index.d.ts +0 -1
- package/es/UserSessions/index.js +0 -1
- package/es/UserSessions/libs/locales.d.ts +0 -58
- package/es/UserSessions/libs/locales.js +0 -58
- package/es/UserSessions/libs/utils.d.ts +0 -2
- package/es/UserSessions/libs/utils.js +0 -73
- package/es/blocklets.d.ts +0 -16
- package/es/blocklets.js +0 -178
- package/es/common/header-addons.d.ts +0 -21
- package/es/common/header-addons.js +0 -83
- package/es/common/link-blocker.d.ts +0 -7
- package/es/common/link-blocker.js +0 -18
- package/es/common/overridable-theme-provider.d.ts +0 -18
- package/es/common/overridable-theme-provider.js +0 -15
- package/es/common/wallet-hidden-topbar.d.ts +0 -1
- package/es/common/wallet-hidden-topbar.js +0 -14
- package/es/contexts/config-user-space.d.ts +0 -26
- package/es/contexts/config-user-space.js +0 -53
- package/es/hooks/use-mobile.d.ts +0 -4
- package/es/hooks/use-mobile.js +0 -5
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/libs/client.d.ts +0 -2
- package/es/libs/client.js +0 -2
- package/es/libs/spaces.d.ts +0 -2
- package/es/libs/spaces.js +0 -13
- package/es/types.d.ts +0 -2
- package/es/types.js +0 -43
- package/es/utils.d.ts +0 -8
- package/es/utils.js +0 -78
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _userInfo = require("./user-info");
|
|
27
|
-
var _blocklets = require("../../blocklets");
|
|
28
|
-
var _passport = _interopRequireDefault(require("./passport"));
|
|
29
|
-
var _settings = _interopRequireDefault(require("./settings"));
|
|
30
|
-
var _client = require("../../libs/client");
|
|
31
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
32
|
-
function UserCenter({
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { Box, CircularProgress, Typography } from "@mui/material";
|
|
4
|
+
import { useCreation, useMemoizedFn, useMount, useRequest, useUpdateEffect } from "ahooks";
|
|
5
|
+
import pWaitFor from "p-wait-for";
|
|
6
|
+
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
7
|
+
import Tabs from "@arcblock/ux/lib/Tabs";
|
|
8
|
+
import Empty from "@arcblock/ux/lib/Empty";
|
|
9
|
+
import Button from "@arcblock/ux/lib/Button";
|
|
10
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
11
|
+
import { useConfirm } from "@arcblock/ux/lib/Dialog";
|
|
12
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
13
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
14
|
+
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
15
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
16
|
+
import { getQuery, withQuery } from "ufo";
|
|
17
|
+
import Footer from "../../Footer/index.js";
|
|
18
|
+
import Header from "../../Header/index.js";
|
|
19
|
+
import { translations } from "../libs/locales.js";
|
|
20
|
+
import { UserInfo, UserBasicInfo } from "./user-info/index.js";
|
|
21
|
+
import { formatBlockletInfo, getLocalizedNavigation } from "../../blocklets.js";
|
|
22
|
+
import Passport from "./passport.js";
|
|
23
|
+
import Settings from "./settings.js";
|
|
24
|
+
import { client } from "../../libs/client.js";
|
|
25
|
+
export default function UserCenter({
|
|
33
26
|
children,
|
|
34
27
|
notLoginContent = null,
|
|
35
28
|
currentTab,
|
|
@@ -42,20 +35,18 @@ function UserCenter({
|
|
|
42
35
|
userDid = void 0,
|
|
43
36
|
stickySidebar = false
|
|
44
37
|
}) {
|
|
45
|
-
const {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
49
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
38
|
+
const { locale } = useLocaleContext();
|
|
39
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
40
|
+
return translate(translations, key, locale, "en", data);
|
|
50
41
|
});
|
|
51
|
-
const sessionCtx =
|
|
42
|
+
const sessionCtx = useContext(SessionContext);
|
|
52
43
|
const session = sessionCtx?.session;
|
|
53
|
-
const currentDid =
|
|
44
|
+
const currentDid = useCreation(() => {
|
|
54
45
|
if (userDid) {
|
|
55
46
|
return userDid;
|
|
56
47
|
}
|
|
57
48
|
const currentUrl = window.location.href;
|
|
58
|
-
const query =
|
|
49
|
+
const query = getQuery(currentUrl);
|
|
59
50
|
if (query?.did) {
|
|
60
51
|
if (Array.isArray(query.did)) {
|
|
61
52
|
return query.did[0];
|
|
@@ -64,43 +55,41 @@ function UserCenter({
|
|
|
64
55
|
}
|
|
65
56
|
return session?.user?.did;
|
|
66
57
|
}, [session?.user?.did, userDid]);
|
|
67
|
-
const isMyself =
|
|
58
|
+
const isMyself = useCreation(() => {
|
|
68
59
|
if (session?.user) {
|
|
69
60
|
return currentDid === session?.user?.did;
|
|
70
61
|
}
|
|
71
62
|
return false;
|
|
72
63
|
}, [currentDid, session?.user?.did]);
|
|
73
|
-
const userState =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
64
|
+
const userState = useRequest(
|
|
65
|
+
// eslint-disable-next-line consistent-return
|
|
66
|
+
async () => {
|
|
67
|
+
await pWaitFor(() => session?.initialized);
|
|
68
|
+
if (isMyself) {
|
|
69
|
+
return session.user;
|
|
70
|
+
}
|
|
71
|
+
if (currentDid) {
|
|
72
|
+
return client.user.getUserPublicInfo({ did: currentDid });
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
refreshDeps: [currentDid, isMyself, session?.initialized, session?.user]
|
|
84
77
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
);
|
|
79
|
+
const privacyState = useRequest(
|
|
80
|
+
async () => {
|
|
81
|
+
if (userState.data && currentTab) {
|
|
82
|
+
const config = await client.user.getUserPrivacyConfig({ did: currentDid });
|
|
83
|
+
return config;
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
refreshDeps: [currentDid, userState.data, currentTab],
|
|
89
|
+
loadingDelay: 300
|
|
94
90
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
refreshDeps: [currentDid, userState.data, currentTab],
|
|
98
|
-
loadingDelay: 300
|
|
99
|
-
});
|
|
100
|
-
const {
|
|
101
|
-
confirmHolder,
|
|
102
|
-
confirmApi
|
|
103
|
-
} = (0, _Dialog.useConfirm)({
|
|
91
|
+
);
|
|
92
|
+
const { confirmHolder, confirmApi } = useConfirm({
|
|
104
93
|
sx: {
|
|
105
94
|
".MuiDialog-paper": {
|
|
106
95
|
borderRadius: 2,
|
|
@@ -120,19 +109,19 @@ function UserCenter({
|
|
|
120
109
|
}
|
|
121
110
|
}
|
|
122
111
|
});
|
|
123
|
-
const formattedBlocklet =
|
|
124
|
-
const blocklet = (
|
|
112
|
+
const formattedBlocklet = useCreation(() => {
|
|
113
|
+
const blocklet = cloneDeep(window.blocklet);
|
|
125
114
|
try {
|
|
126
|
-
return
|
|
115
|
+
return formatBlockletInfo(blocklet);
|
|
127
116
|
} catch (e) {
|
|
128
117
|
console.error("Failed to format blocklet info", e, blocklet);
|
|
129
118
|
return blocklet;
|
|
130
119
|
}
|
|
131
120
|
}, []);
|
|
132
|
-
const userCenterTabs =
|
|
121
|
+
const userCenterTabs = useCreation(() => {
|
|
133
122
|
const menus = formattedBlocklet?.navigation?.userCenter || [];
|
|
134
|
-
const localizedMenus =
|
|
135
|
-
return localizedMenus.map(x => {
|
|
123
|
+
const localizedMenus = getLocalizedNavigation(menus, locale) || [];
|
|
124
|
+
return localizedMenus.map((x) => {
|
|
136
125
|
const value = x._rawLink ?? x.link;
|
|
137
126
|
return {
|
|
138
127
|
value,
|
|
@@ -143,30 +132,31 @@ function UserCenter({
|
|
|
143
132
|
};
|
|
144
133
|
});
|
|
145
134
|
}, [formattedBlocklet, userState.data, privacyState?.data, locale]);
|
|
146
|
-
const currentActiveTab =
|
|
147
|
-
return userCenterTabs.find(x => x.value === currentTab);
|
|
135
|
+
const currentActiveTab = useCreation(() => {
|
|
136
|
+
return userCenterTabs.find((x) => x.value === currentTab);
|
|
148
137
|
}, [userCenterTabs]);
|
|
149
|
-
const handleChangeTab =
|
|
150
|
-
const findTab = userCenterTabs.find(x => x.value === value);
|
|
138
|
+
const handleChangeTab = useMemoizedFn((value) => {
|
|
139
|
+
const findTab = userCenterTabs.find((x) => x.value === value);
|
|
151
140
|
if (findTab) {
|
|
152
|
-
window.location.href =
|
|
141
|
+
window.location.href = withQuery(findTab.url, {
|
|
153
142
|
did: isMyself ? void 0 : currentDid
|
|
154
143
|
});
|
|
155
144
|
}
|
|
156
145
|
});
|
|
157
|
-
const settingContent =
|
|
158
|
-
return /* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
146
|
+
const settingContent = useCreation(() => {
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
Settings,
|
|
149
|
+
{
|
|
150
|
+
user: userState.data,
|
|
151
|
+
settings: { userCenterTabs },
|
|
152
|
+
onSave: async () => {
|
|
153
|
+
await privacyState.runAsync();
|
|
154
|
+
return privacyState.data;
|
|
155
|
+
}
|
|
166
156
|
}
|
|
167
|
-
|
|
157
|
+
);
|
|
168
158
|
}, [userState.data]);
|
|
169
|
-
const openSettings =
|
|
159
|
+
const openSettings = useMemoizedFn(() => {
|
|
170
160
|
confirmApi.open({
|
|
171
161
|
title: t("settings"),
|
|
172
162
|
content: settingContent,
|
|
@@ -175,17 +165,17 @@ function UserCenter({
|
|
|
175
165
|
onConfirm: confirmApi.close
|
|
176
166
|
});
|
|
177
167
|
});
|
|
178
|
-
|
|
168
|
+
useUpdateEffect(() => {
|
|
179
169
|
confirmApi.update({
|
|
180
170
|
content: settingContent
|
|
181
171
|
});
|
|
182
172
|
}, [settingContent]);
|
|
183
|
-
|
|
173
|
+
useMount(() => {
|
|
184
174
|
if (autoPopupSetting) {
|
|
185
175
|
openSettings();
|
|
186
176
|
}
|
|
187
177
|
});
|
|
188
|
-
const content =
|
|
178
|
+
const content = useCreation(() => {
|
|
189
179
|
if (userState.loading || session.loading) {
|
|
190
180
|
return null;
|
|
191
181
|
}
|
|
@@ -194,24 +184,15 @@ function UserCenter({
|
|
|
194
184
|
const formatError = {
|
|
195
185
|
message: errorMessage
|
|
196
186
|
};
|
|
197
|
-
return /* @__PURE__ */(
|
|
198
|
-
sx: {
|
|
199
|
-
width: "100%"
|
|
200
|
-
},
|
|
201
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_ErrorBoundary.ErrorFallback, {
|
|
202
|
-
error: formatError
|
|
203
|
-
})
|
|
204
|
-
});
|
|
187
|
+
return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsx(ErrorFallback, { error: formatError }) });
|
|
205
188
|
}
|
|
206
189
|
if (!currentDid && !userState.data) {
|
|
207
190
|
if (notLoginContent) {
|
|
208
191
|
return notLoginContent;
|
|
209
192
|
}
|
|
210
|
-
return /* @__PURE__ */
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
},
|
|
214
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
193
|
+
return /* @__PURE__ */ jsx(Box, { sx: { width: "100%" }, children: /* @__PURE__ */ jsxs(
|
|
194
|
+
Box,
|
|
195
|
+
{
|
|
215
196
|
sx: {
|
|
216
197
|
display: "flex",
|
|
217
198
|
flexDirection: "column",
|
|
@@ -219,207 +200,215 @@ function UserCenter({
|
|
|
219
200
|
alignItems: "center",
|
|
220
201
|
gap: 1
|
|
221
202
|
},
|
|
222
|
-
children: [
|
|
223
|
-
children: t("viewAfterLogin")
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
children: t("loginNow")
|
|
229
|
-
})]
|
|
230
|
-
})
|
|
231
|
-
});
|
|
203
|
+
children: [
|
|
204
|
+
/* @__PURE__ */ jsx(Empty, { children: t("viewAfterLogin") }),
|
|
205
|
+
/* @__PURE__ */ jsx(Button, { size: "small", variant: "contained", onClick: () => session.login(), children: t("loginNow") })
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
) });
|
|
232
209
|
}
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
md: "block"
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
children: userState.data.fullName
|
|
250
|
-
}) : null, /* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfo.UserBasicInfo, {
|
|
251
|
-
isMyself,
|
|
252
|
-
switchPassport: session.switchPassport,
|
|
253
|
-
switchProfile: session.switchProfile,
|
|
254
|
-
openSettings,
|
|
255
|
-
user: userState.data,
|
|
256
|
-
showFullDid: false,
|
|
257
|
-
sx: {
|
|
258
|
-
display: {
|
|
259
|
-
md: "none",
|
|
260
|
-
xs: "block"
|
|
210
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
211
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flex: 1, overflow: "hidden" }, children: [
|
|
212
|
+
userState?.data?.fullName ? /* @__PURE__ */ jsx(
|
|
213
|
+
Typography,
|
|
214
|
+
{
|
|
215
|
+
variant: "h4",
|
|
216
|
+
sx: {
|
|
217
|
+
py: 1.5,
|
|
218
|
+
fontWeight: 700,
|
|
219
|
+
display: {
|
|
220
|
+
xs: "none",
|
|
221
|
+
md: "block"
|
|
222
|
+
}
|
|
261
223
|
},
|
|
262
|
-
|
|
224
|
+
children: userState.data.fullName
|
|
263
225
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
226
|
+
) : null,
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
UserBasicInfo,
|
|
229
|
+
{
|
|
230
|
+
isMyself,
|
|
231
|
+
switchPassport: session.switchPassport,
|
|
232
|
+
switchProfile: session.switchProfile,
|
|
233
|
+
openSettings,
|
|
234
|
+
user: userState.data,
|
|
235
|
+
showFullDid: false,
|
|
274
236
|
sx: {
|
|
237
|
+
display: {
|
|
238
|
+
md: "none",
|
|
239
|
+
xs: "block"
|
|
240
|
+
},
|
|
275
241
|
mb: 1.5
|
|
276
242
|
}
|
|
277
|
-
}
|
|
243
|
+
}
|
|
244
|
+
),
|
|
245
|
+
userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
|
|
246
|
+
Box,
|
|
247
|
+
{
|
|
278
248
|
sx: {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
minHeight: "160px",
|
|
282
|
-
display: "flex",
|
|
283
|
-
justifyContent: "center",
|
|
284
|
-
alignItems: "center"
|
|
249
|
+
overflow: "auto",
|
|
250
|
+
padding: "1px"
|
|
285
251
|
},
|
|
286
|
-
children:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
252
|
+
children: [
|
|
253
|
+
/* @__PURE__ */ jsx(
|
|
254
|
+
Tabs,
|
|
255
|
+
{
|
|
256
|
+
variant: "line",
|
|
257
|
+
tabs: userCenterTabs,
|
|
258
|
+
current: currentTab,
|
|
259
|
+
onChange: handleChangeTab,
|
|
260
|
+
sx: { mb: 1.5 }
|
|
261
|
+
}
|
|
262
|
+
),
|
|
263
|
+
!privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
|
|
264
|
+
Box,
|
|
265
|
+
{
|
|
266
|
+
sx: {
|
|
267
|
+
height: "100%",
|
|
268
|
+
minWidth: "160px",
|
|
269
|
+
minHeight: "160px",
|
|
270
|
+
display: "flex",
|
|
271
|
+
justifyContent: "center",
|
|
272
|
+
alignItems: "center"
|
|
273
|
+
},
|
|
274
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
|
|
275
|
+
}
|
|
276
|
+
) : (
|
|
277
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
278
|
+
/* @__PURE__ */ jsx(Fragment, { children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : (
|
|
279
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
280
|
+
/* @__PURE__ */ jsx(Fragment, { children: children && /* @__PURE__ */ jsx(Box, { ...contentProps, children }) })
|
|
281
|
+
) })
|
|
282
|
+
)
|
|
283
|
+
]
|
|
284
|
+
}
|
|
285
|
+
) : null,
|
|
286
|
+
userCenterTabs.length === 0 ? /* @__PURE__ */ jsx(
|
|
287
|
+
Box,
|
|
288
|
+
{
|
|
289
|
+
sx: {
|
|
290
|
+
display: {
|
|
291
|
+
xs: isMyself ? "none" : "block",
|
|
292
|
+
md: "block"
|
|
293
|
+
},
|
|
294
|
+
py: 3
|
|
295
|
+
},
|
|
296
|
+
children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
|
|
297
|
+
}
|
|
298
|
+
) : null
|
|
299
|
+
] }),
|
|
300
|
+
/* @__PURE__ */ jsx(
|
|
301
|
+
Box,
|
|
302
|
+
{
|
|
310
303
|
sx: {
|
|
311
304
|
display: {
|
|
312
|
-
xs:
|
|
305
|
+
xs: "none",
|
|
313
306
|
md: "block"
|
|
314
307
|
},
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
})
|
|
320
|
-
}) : null]
|
|
321
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
322
|
-
sx: {
|
|
323
|
-
display: {
|
|
324
|
-
xs: "none",
|
|
325
|
-
md: "block"
|
|
326
|
-
},
|
|
327
|
-
width: "1px",
|
|
328
|
-
my: -3,
|
|
329
|
-
backgroundColor: _Colors.temp.strokeSep
|
|
308
|
+
width: "1px",
|
|
309
|
+
my: -3,
|
|
310
|
+
backgroundColor: colors.strokeSep
|
|
311
|
+
}
|
|
330
312
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
md: 420
|
|
336
|
-
},
|
|
337
|
-
maxWidth: "100%",
|
|
338
|
-
position: "relative"
|
|
339
|
-
},
|
|
340
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
313
|
+
),
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
Box,
|
|
316
|
+
{
|
|
341
317
|
sx: {
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
position: {
|
|
346
|
-
xs: "static",
|
|
347
|
-
md: stickySidebar ? "sticky" : "static"
|
|
318
|
+
width: {
|
|
319
|
+
sx: "100%",
|
|
320
|
+
md: 420
|
|
348
321
|
},
|
|
349
|
-
|
|
322
|
+
maxWidth: "100%",
|
|
323
|
+
position: "relative"
|
|
350
324
|
},
|
|
351
|
-
children:
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
}), isMyself ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
364
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
365
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
366
|
-
sx: {
|
|
367
|
-
fontWeight: 600,
|
|
368
|
-
mb: 1.5
|
|
369
|
-
},
|
|
370
|
-
children: t("myInfo")
|
|
371
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfo.UserInfo, {
|
|
372
|
-
user: userState.data
|
|
373
|
-
})]
|
|
374
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
375
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
376
|
-
sx: {
|
|
377
|
-
fontWeight: 600,
|
|
378
|
-
mb: 1.5
|
|
325
|
+
children: /* @__PURE__ */ jsxs(
|
|
326
|
+
Box,
|
|
327
|
+
{
|
|
328
|
+
sx: {
|
|
329
|
+
display: "flex",
|
|
330
|
+
flexDirection: "column",
|
|
331
|
+
gap: 2.5,
|
|
332
|
+
position: {
|
|
333
|
+
xs: "static",
|
|
334
|
+
md: stickySidebar ? "sticky" : "static"
|
|
379
335
|
},
|
|
380
|
-
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
336
|
+
top: (theme) => stickySidebar ? theme.spacing(3) : "unset"
|
|
337
|
+
},
|
|
338
|
+
children: [
|
|
339
|
+
/* @__PURE__ */ jsx(
|
|
340
|
+
UserBasicInfo,
|
|
341
|
+
{
|
|
342
|
+
isMyself,
|
|
343
|
+
switchPassport: session.switchPassport,
|
|
344
|
+
switchProfile: session.switchProfile,
|
|
345
|
+
openSettings,
|
|
346
|
+
user: userState.data,
|
|
347
|
+
sx: {
|
|
348
|
+
display: {
|
|
349
|
+
xs: "none",
|
|
350
|
+
md: "block"
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
),
|
|
355
|
+
isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
356
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
357
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("myInfo") }),
|
|
358
|
+
/* @__PURE__ */ jsx(UserInfo, { user: userState.data })
|
|
359
|
+
] }),
|
|
360
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
361
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
|
|
362
|
+
/* @__PURE__ */ jsx(Passport, { user: userState.data })
|
|
363
|
+
] })
|
|
364
|
+
] }) : null
|
|
365
|
+
]
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
}
|
|
369
|
+
)
|
|
370
|
+
] });
|
|
389
371
|
}, [userState, userCenterTabs, isMyself, currentActiveTab, privacyState, currentTab, stickySidebar]);
|
|
390
372
|
if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
|
|
391
373
|
window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
|
|
392
374
|
return null;
|
|
393
375
|
}
|
|
394
|
-
return /* @__PURE__ */
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
minHeight: "100vh",
|
|
398
|
-
display: "flex",
|
|
399
|
-
flexDirection: "column"
|
|
400
|
-
},
|
|
401
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Header.default, {
|
|
402
|
-
bordered: true,
|
|
403
|
-
...headerProps
|
|
404
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
405
|
-
flex: 1,
|
|
376
|
+
return /* @__PURE__ */ jsxs(
|
|
377
|
+
Box,
|
|
378
|
+
{
|
|
406
379
|
sx: {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
margin: "0 auto",
|
|
410
|
-
p: 3,
|
|
380
|
+
backgroundColor: colors.backgroundsBgSubtitle,
|
|
381
|
+
minHeight: "100vh",
|
|
411
382
|
display: "flex",
|
|
412
|
-
|
|
413
|
-
flexDirection: {
|
|
414
|
-
xs: "column",
|
|
415
|
-
md: "row"
|
|
416
|
-
},
|
|
417
|
-
gap: 2.5
|
|
383
|
+
flexDirection: "column"
|
|
418
384
|
},
|
|
419
|
-
children: [
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
385
|
+
children: [
|
|
386
|
+
/* @__PURE__ */ jsx(Header, { bordered: true, ...headerProps }),
|
|
387
|
+
/* @__PURE__ */ jsxs(
|
|
388
|
+
Box,
|
|
389
|
+
{
|
|
390
|
+
flex: 1,
|
|
391
|
+
sx: {
|
|
392
|
+
width: "100%",
|
|
393
|
+
maxWidth: 1200,
|
|
394
|
+
margin: "0 auto",
|
|
395
|
+
p: 3,
|
|
396
|
+
display: "flex",
|
|
397
|
+
alignItems: "stretch",
|
|
398
|
+
flexDirection: {
|
|
399
|
+
xs: "column",
|
|
400
|
+
md: "row"
|
|
401
|
+
},
|
|
402
|
+
gap: 2.5
|
|
403
|
+
},
|
|
404
|
+
children: [
|
|
405
|
+
content,
|
|
406
|
+
confirmHolder
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
),
|
|
410
|
+
hideFooter ? null : /* @__PURE__ */ jsx(Footer, { bordered: true, ...footerProps })
|
|
411
|
+
]
|
|
412
|
+
}
|
|
413
|
+
);
|
|
414
|
+
}
|