@blocklet/ui-react 2.9.90 → 2.10.0
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,38 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _locales = require("../libs/locales");
|
|
19
|
-
var _utils = require("../libs/utils");
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
function Passport({
|
|
22
|
-
user,
|
|
23
|
-
...rest
|
|
24
|
-
}) {
|
|
25
|
-
const {
|
|
26
|
-
locale
|
|
27
|
-
} = (0, _context.useLocaleContext)();
|
|
28
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
29
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import Empty from "@arcblock/ux/lib/Empty";
|
|
4
|
+
import { useTheme } from "@arcblock/ux/lib/Theme";
|
|
5
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
6
|
+
import PassportItem from "@arcblock/ux/lib/Passport";
|
|
7
|
+
import { PASSPORT_STATUS } from "@arcblock/ux/lib/Util/constant";
|
|
8
|
+
import { useCreation, useMemoizedFn } from "ahooks";
|
|
9
|
+
import uniqBy from "lodash/uniqBy";
|
|
10
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
11
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
12
|
+
import { translations } from "../libs/locales.js";
|
|
13
|
+
import { createPassportSvg } from "../libs/utils.js";
|
|
14
|
+
export default function Passport({ user, ...rest }) {
|
|
15
|
+
const { locale } = useLocaleContext();
|
|
16
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
17
|
+
return translate(translations, key, locale, "en", data);
|
|
30
18
|
});
|
|
31
|
-
const theme =
|
|
32
|
-
const passports =
|
|
33
|
-
const passportList = (user?.passports || []).map(x => ({
|
|
19
|
+
const theme = useTheme();
|
|
20
|
+
const passports = useCreation(() => {
|
|
21
|
+
const passportList = (user?.passports || []).map((x) => ({
|
|
34
22
|
...x,
|
|
35
|
-
revoked: x.status ===
|
|
23
|
+
revoked: x.status === PASSPORT_STATUS.REVOKED
|
|
36
24
|
}));
|
|
37
25
|
passportList.sort((a, b) => {
|
|
38
26
|
if (a.revoked === b.revoked) {
|
|
@@ -43,55 +31,58 @@ function Passport({
|
|
|
43
31
|
}
|
|
44
32
|
return -1;
|
|
45
33
|
});
|
|
46
|
-
return (
|
|
34
|
+
return uniqBy(passportList, "role");
|
|
47
35
|
}, [user?.passports]);
|
|
48
|
-
const currentRole =
|
|
49
|
-
const activeColor =
|
|
50
|
-
return theme?.palette?.primary?.main ||
|
|
36
|
+
const currentRole = useCreation(() => passports?.find((item) => item.name === user.role), [passports, user?.role]);
|
|
37
|
+
const activeColor = useCreation(() => {
|
|
38
|
+
return theme?.palette?.primary?.main || colors.textBase;
|
|
51
39
|
}, [theme?.palette?.primary?.main]);
|
|
52
40
|
if (passports.length === 0) {
|
|
53
|
-
return /* @__PURE__ */(
|
|
54
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Empty.default, {
|
|
55
|
-
children: t("noPassport")
|
|
56
|
-
})
|
|
57
|
-
});
|
|
41
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("noPassport") }) });
|
|
58
42
|
}
|
|
59
|
-
return /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
gridTemplateColumns: {
|
|
64
|
-
xs: "repeat(2, 1fr)",
|
|
65
|
-
sm: "repeat(3, 1fr)",
|
|
66
|
-
md: "repeat(2, 1fr)"
|
|
67
|
-
},
|
|
68
|
-
gap: 2.5,
|
|
69
|
-
...rest.sx
|
|
70
|
-
},
|
|
71
|
-
children: passports.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_Passport.default, {
|
|
72
|
-
passport: x,
|
|
73
|
-
user,
|
|
74
|
-
color: window.blocklet.passportColor,
|
|
75
|
-
createPassportSvg: _utils.createPassportSvg,
|
|
76
|
-
title: currentRole && currentRole.role === x.role ? t("currentPassport") : "",
|
|
43
|
+
return /* @__PURE__ */ jsx(
|
|
44
|
+
Box,
|
|
45
|
+
{
|
|
46
|
+
...rest,
|
|
77
47
|
sx: {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
height: 166,
|
|
84
|
-
borderRadius: 2,
|
|
85
|
-
px: 2,
|
|
86
|
-
display: "flex",
|
|
87
|
-
justifyContent: "center",
|
|
88
|
-
backgroundColor: _Colors.temp.backgroundsBgComponent,
|
|
89
|
-
boxShadow: currentRole && currentRole.role === x.role ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important` : "unset"
|
|
48
|
+
display: "grid",
|
|
49
|
+
gridTemplateColumns: {
|
|
50
|
+
xs: "repeat(2, 1fr)",
|
|
51
|
+
sm: "repeat(3, 1fr)",
|
|
52
|
+
md: "repeat(2, 1fr)"
|
|
90
53
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
54
|
+
gap: 2.5,
|
|
55
|
+
...rest.sx
|
|
56
|
+
},
|
|
57
|
+
children: passports.map((x) => /* @__PURE__ */ jsx(
|
|
58
|
+
PassportItem,
|
|
59
|
+
{
|
|
60
|
+
passport: x,
|
|
61
|
+
user,
|
|
62
|
+
color: window.blocklet.passportColor,
|
|
63
|
+
createPassportSvg,
|
|
64
|
+
title: currentRole && currentRole.role === x.role ? t("currentPassport") : "",
|
|
65
|
+
sx: {
|
|
66
|
+
flexDirection: "column",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
gap: 1,
|
|
69
|
+
".passport-item__display": {
|
|
70
|
+
width: 166,
|
|
71
|
+
height: 166,
|
|
72
|
+
borderRadius: 2,
|
|
73
|
+
px: 2,
|
|
74
|
+
display: "flex",
|
|
75
|
+
justifyContent: "center",
|
|
76
|
+
backgroundColor: colors.backgroundsBgComponent,
|
|
77
|
+
boxShadow: currentRole && currentRole.role === x.role ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important` : "unset"
|
|
78
|
+
},
|
|
79
|
+
".passport-item__body": {
|
|
80
|
+
marginLeft: "0 !important"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
x.id
|
|
85
|
+
))
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -1,101 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _utils = require("../libs/utils");
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
function Privacy({
|
|
20
|
-
configList,
|
|
21
|
-
onSave
|
|
22
|
-
}) {
|
|
23
|
-
const [dataList, setDataList] = (0, _react.useState)(configList);
|
|
24
|
-
const {
|
|
25
|
-
locale
|
|
26
|
-
} = (0, _context.useLocaleContext)();
|
|
27
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
28
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
3
|
+
import Switch from "@arcblock/ux/lib/Switch";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useMemoizedFn } from "ahooks";
|
|
6
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
8
|
+
import Toast from "@arcblock/ux/lib/Toast";
|
|
9
|
+
import { translations } from "../libs/locales.js";
|
|
10
|
+
import { client } from "../../libs/client.js";
|
|
11
|
+
import { formatAxiosError } from "../libs/utils.js";
|
|
12
|
+
export default function Privacy({ configList, onSave }) {
|
|
13
|
+
const [dataList, setDataList] = useState(configList);
|
|
14
|
+
const { locale } = useLocaleContext();
|
|
15
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
16
|
+
return translate(translations, key, locale, "en", data);
|
|
29
17
|
});
|
|
30
|
-
const handleChangeSwitch =
|
|
18
|
+
const handleChangeSwitch = useMemoizedFn(async (type, value) => {
|
|
31
19
|
try {
|
|
32
|
-
const result = await
|
|
20
|
+
const result = await client.user.saveUserPrivacyConfig({
|
|
33
21
|
[type]: !value
|
|
34
22
|
});
|
|
35
|
-
setDataList(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
setDataList(
|
|
24
|
+
dataList.map((item) => {
|
|
25
|
+
return {
|
|
26
|
+
...item,
|
|
27
|
+
value: result?.[item.key] ?? item.value
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
);
|
|
31
|
+
Toast.success(t("saveSuccess"));
|
|
42
32
|
onSave();
|
|
43
33
|
} catch (err) {
|
|
44
|
-
|
|
34
|
+
Toast.error(formatAxiosError(err));
|
|
45
35
|
}
|
|
46
36
|
});
|
|
47
|
-
return /* @__PURE__ */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
".MuiFormControlLabel-root": {
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
Box,
|
|
39
|
+
{
|
|
40
|
+
sx: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
54
43
|
gap: 1,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
alignItems: "start",
|
|
45
|
+
".MuiFormControlLabel-root": {
|
|
46
|
+
gap: 1,
|
|
47
|
+
m: 0,
|
|
48
|
+
flexDirection: {
|
|
49
|
+
xs: "row-reverse",
|
|
50
|
+
md: "row"
|
|
51
|
+
},
|
|
52
|
+
width: {
|
|
53
|
+
xs: "100%",
|
|
54
|
+
md: "unset"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
".MuiSwitch-track": {
|
|
58
|
+
borderRadius: "100vw"
|
|
59
59
|
},
|
|
60
|
-
width: {
|
|
61
|
-
xs: "100%",
|
|
62
|
-
md: "unset"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
".MuiSwitch-track": {
|
|
66
|
-
borderRadius: "100vw"
|
|
67
|
-
},
|
|
68
|
-
".MuiSwitch-thumb": {
|
|
69
|
-
borderRadius: "100%"
|
|
70
|
-
},
|
|
71
|
-
".MuiSwitch-root.MuiSwitch-sizeSmall": {
|
|
72
|
-
height: "20px",
|
|
73
|
-
width: "36px",
|
|
74
60
|
".MuiSwitch-thumb": {
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
borderRadius: "100%"
|
|
62
|
+
},
|
|
63
|
+
".MuiSwitch-root.MuiSwitch-sizeSmall": {
|
|
64
|
+
height: "20px",
|
|
65
|
+
width: "36px",
|
|
66
|
+
".MuiSwitch-thumb": {
|
|
67
|
+
width: "16px",
|
|
68
|
+
height: "16px"
|
|
69
|
+
}
|
|
77
70
|
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
children: dataList.map(item => /* @__PURE__ */(0, _jsxRuntime.jsx)(_Switch.default, {
|
|
81
|
-
checked: !item.value,
|
|
82
|
-
labelProps: {
|
|
83
|
-
label: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
84
|
-
color: "text.primary",
|
|
85
|
-
sx: {
|
|
86
|
-
fontSize: 14,
|
|
87
|
-
display: "flex",
|
|
88
|
-
flexFlow: "wrap",
|
|
89
|
-
columnGap: 1,
|
|
90
|
-
flex: 1
|
|
91
|
-
},
|
|
92
|
-
children: t("toPublic", {
|
|
93
|
-
name: item.name
|
|
94
|
-
})
|
|
95
|
-
})
|
|
96
71
|
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
72
|
+
children: dataList.map((item) => /* @__PURE__ */ jsx(
|
|
73
|
+
Switch,
|
|
74
|
+
{
|
|
75
|
+
checked: !item.value,
|
|
76
|
+
labelProps: {
|
|
77
|
+
label: /* @__PURE__ */ jsx(
|
|
78
|
+
Typography,
|
|
79
|
+
{
|
|
80
|
+
color: "text.primary",
|
|
81
|
+
sx: {
|
|
82
|
+
fontSize: 14,
|
|
83
|
+
display: "flex",
|
|
84
|
+
flexFlow: "wrap",
|
|
85
|
+
columnGap: 1,
|
|
86
|
+
flex: 1
|
|
87
|
+
},
|
|
88
|
+
children: t("toPublic", { name: item.name })
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
},
|
|
92
|
+
size: "small",
|
|
93
|
+
onChange: (event) => handleChangeSwitch(item.key, event.target.checked)
|
|
94
|
+
},
|
|
95
|
+
item.key
|
|
96
|
+
))
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
@@ -1,38 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _privacy = _interopRequireDefault(require("./privacy"));
|
|
17
|
-
var _storage = _interopRequireDefault(require("./storage"));
|
|
18
|
-
var _UserSessions = require("../../UserSessions");
|
|
19
|
-
var _thirdPartyLogin = _interopRequireDefault(require("./third-party-login"));
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
function Settings({
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Tabs from "@arcblock/ux/lib/Tabs";
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { useCreation, useMemoizedFn, useReactive } from "ahooks";
|
|
5
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
6
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
import { ConfigUserSpaceProvider } from "../../contexts/config-user-space.js";
|
|
8
|
+
import { translations } from "../libs/locales.js";
|
|
9
|
+
import Notification from "./notification.js";
|
|
10
|
+
import Privacy from "./privacy.js";
|
|
11
|
+
import DidSpace from "./storage/index.js";
|
|
12
|
+
import { UserSessions } from "../../UserSessions/index.js";
|
|
13
|
+
import ThirdPartyLogin from "./third-party-login/index.js";
|
|
14
|
+
import ConfigProfile from "./config-profile.js";
|
|
15
|
+
export default function Settings({
|
|
22
16
|
user,
|
|
23
17
|
settings,
|
|
24
18
|
onSave,
|
|
25
19
|
...rest
|
|
26
20
|
}) {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
31
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
21
|
+
const { locale } = useLocaleContext();
|
|
22
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
23
|
+
return translate(translations, key, locale, "en", data);
|
|
32
24
|
});
|
|
33
|
-
const privacyConfigList =
|
|
25
|
+
const privacyConfigList = useCreation(() => {
|
|
34
26
|
const userCenterTabs = settings?.userCenterTabs || [];
|
|
35
|
-
return userCenterTabs.map(item => {
|
|
27
|
+
return userCenterTabs.map((item) => {
|
|
36
28
|
return {
|
|
37
29
|
key: item.value,
|
|
38
30
|
name: item.label,
|
|
@@ -40,66 +32,64 @@ function Settings({
|
|
|
40
32
|
};
|
|
41
33
|
});
|
|
42
34
|
}, [settings?.userCenterTabs]);
|
|
43
|
-
const tabs =
|
|
44
|
-
return [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
user
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
user
|
|
74
|
-
}
|
|
75
|
-
|
|
35
|
+
const tabs = useCreation(() => {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
label: t("commonSetting.title"),
|
|
39
|
+
value: "common",
|
|
40
|
+
content: /* @__PURE__ */ jsx(ConfigProfile, { user })
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
label: t("notificationManagement"),
|
|
44
|
+
value: "notification",
|
|
45
|
+
content: /* @__PURE__ */ jsx(Notification, { user })
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
label: t("thirdPartyLogin.title"),
|
|
49
|
+
value: "thirdPartyLogin",
|
|
50
|
+
content: /* @__PURE__ */ jsx(ThirdPartyLogin, { user })
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: t("privacyManagement"),
|
|
54
|
+
value: "privacy",
|
|
55
|
+
content: /* @__PURE__ */ jsx(Privacy, { configList: privacyConfigList, onSave })
|
|
56
|
+
},
|
|
57
|
+
user?.didSpace?.endpoint && {
|
|
58
|
+
label: t("storageManagement"),
|
|
59
|
+
value: "storage",
|
|
60
|
+
content: /* @__PURE__ */ jsx(ConfigUserSpaceProvider, { children: /* @__PURE__ */ jsx(DidSpace, {}) })
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: t("sessionManagement"),
|
|
64
|
+
value: "session",
|
|
65
|
+
content: /* @__PURE__ */ jsx(UserSessions, { user })
|
|
66
|
+
}
|
|
67
|
+
].filter(Boolean);
|
|
76
68
|
}, [user, privacyConfigList]);
|
|
77
|
-
const currentState =
|
|
69
|
+
const currentState = useReactive({
|
|
78
70
|
tab: tabs[0].value
|
|
79
71
|
});
|
|
80
|
-
const currentTab =
|
|
81
|
-
return tabs.find(x => x.value === currentState.tab);
|
|
72
|
+
const currentTab = useCreation(() => {
|
|
73
|
+
return tabs.find((x) => x.value === currentState.tab);
|
|
82
74
|
}, [currentState.tab, tabs]);
|
|
83
|
-
const handleChangeTab =
|
|
75
|
+
const handleChangeTab = useMemoizedFn((value) => {
|
|
84
76
|
currentState.tab = value;
|
|
85
77
|
});
|
|
86
|
-
return currentTab && /* @__PURE__ */
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
...rest
|
|
90
|
-
|
|
91
|
-
|
|
78
|
+
return currentTab && /* @__PURE__ */ jsxs(
|
|
79
|
+
Box,
|
|
80
|
+
{
|
|
81
|
+
...rest,
|
|
82
|
+
sx: {
|
|
83
|
+
...rest?.sx,
|
|
84
|
+
minWidth: {
|
|
85
|
+
md: 500
|
|
86
|
+
},
|
|
87
|
+
maxWidth: "100%"
|
|
92
88
|
},
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
101
|
-
mt: 2.5,
|
|
102
|
-
children: currentTab.content
|
|
103
|
-
})]
|
|
104
|
-
});
|
|
105
|
-
}
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx(Tabs, { variant: "card", tabs, current: currentTab.value, onChange: handleChangeTab }),
|
|
91
|
+
/* @__PURE__ */ jsx(Box, { mt: 2.5, children: currentTab.content })
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|