@blocklet/ui-react 2.9.91 → 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.
Files changed (209) hide show
  1. package/build.config.ts +1 -6
  2. package/lib/@types/index.d.ts +1 -0
  3. package/lib/@types/index.js +0 -1
  4. package/lib/BlockletStudio/index.js +50 -50
  5. package/lib/ComponentInstaller/index.js +122 -202
  6. package/lib/ComponentInstaller/installer-item.js +116 -138
  7. package/lib/ComponentInstaller/locales.js +5 -10
  8. package/lib/ComponentInstaller/use-component-installed.js +37 -41
  9. package/lib/ComponentManager/components/add-component.js +58 -67
  10. package/lib/ComponentManager/components/check-component.js +2 -9
  11. package/lib/ComponentManager/components/publish-component.js +50 -59
  12. package/lib/ComponentManager/components/resource-dialog.js +42 -39
  13. package/lib/ComponentManager/index.js +3 -27
  14. package/lib/ComponentManager/libs/locales.js +2 -8
  15. package/lib/Dashboard/index.js +74 -99
  16. package/lib/Footer/brand.js +21 -43
  17. package/lib/Footer/copyright.js +15 -24
  18. package/lib/Footer/index.js +47 -71
  19. package/lib/Footer/internal-footer.js +72 -100
  20. package/lib/Footer/layout/plain.js +26 -45
  21. package/lib/Footer/layout/row.js +12 -29
  22. package/lib/Footer/layout/standard.js +34 -64
  23. package/lib/Footer/links.js +74 -104
  24. package/lib/Footer/social-media.js +35 -42
  25. package/lib/Header/index.js +69 -117
  26. package/lib/Icon/index.js +18 -53
  27. package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
  28. package/lib/UserCenter/components/config-profile.js +67 -0
  29. package/lib/UserCenter/components/notification.js +203 -186
  30. package/lib/UserCenter/components/passport.js +70 -79
  31. package/lib/UserCenter/components/privacy.js +86 -88
  32. package/lib/UserCenter/components/settings.js +74 -84
  33. package/lib/UserCenter/components/storage/connect-to.js +56 -75
  34. package/lib/UserCenter/components/storage/connected.js +16 -37
  35. package/lib/UserCenter/components/storage/delete.js +42 -51
  36. package/lib/UserCenter/components/storage/disconnect.js +15 -29
  37. package/lib/UserCenter/components/storage/index.js +20 -54
  38. package/lib/UserCenter/components/storage/item.js +94 -122
  39. package/lib/UserCenter/components/storage/preview-nft.js +77 -85
  40. package/lib/UserCenter/components/third-party-login/index.js +49 -61
  41. package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
  42. package/lib/UserCenter/components/user-center.js +276 -287
  43. package/lib/UserCenter/components/user-info/index.js +3 -27
  44. package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
  45. package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
  46. package/lib/UserCenter/components/user-info/user-info.js +41 -74
  47. package/lib/UserCenter/components/webhook-item.js +184 -177
  48. package/lib/UserCenter/index.js +1 -13
  49. package/lib/UserCenter/libs/api.js +4 -16
  50. package/lib/UserCenter/libs/locales.d.ts +10 -0
  51. package/lib/UserCenter/libs/locales.js +12 -8
  52. package/lib/UserCenter/libs/utils.js +7 -17
  53. package/lib/UserSessions/components/user-session-info.js +88 -85
  54. package/lib/UserSessions/components/user-sessions.js +177 -213
  55. package/lib/UserSessions/index.js +1 -13
  56. package/lib/UserSessions/libs/locales.js +2 -8
  57. package/lib/UserSessions/libs/utils.js +4 -11
  58. package/lib/blocklets.js +59 -63
  59. package/lib/common/header-addons.js +44 -60
  60. package/lib/common/link-blocker.js +9 -18
  61. package/lib/common/overridable-theme-provider.js +10 -23
  62. package/lib/common/wallet-hidden-topbar.js +7 -14
  63. package/lib/contexts/config-user-space.js +38 -46
  64. package/lib/hooks/use-mobile.js +5 -13
  65. package/lib/index.js +10 -100
  66. package/lib/libs/client.js +2 -8
  67. package/lib/libs/spaces.js +6 -13
  68. package/lib/types.js +39 -41
  69. package/lib/utils.js +25 -44
  70. package/package.json +8 -38
  71. package/src/@types/index.ts +1 -0
  72. package/src/Footer/brand.jsx +6 -1
  73. package/src/UserCenter/components/config-profile.tsx +70 -0
  74. package/src/UserCenter/components/notification.tsx +63 -47
  75. package/src/UserCenter/components/settings.tsx +6 -0
  76. package/src/UserCenter/libs/locales.ts +10 -0
  77. package/es/@types/index.d.ts +0 -101
  78. package/es/@types/index.js +0 -0
  79. package/es/@types/shims.d.ts +0 -16
  80. package/es/BlockletStudio/index.d.ts +0 -28
  81. package/es/BlockletStudio/index.js +0 -114
  82. package/es/ComponentInstaller/index.d.ts +0 -37
  83. package/es/ComponentInstaller/index.js +0 -200
  84. package/es/ComponentInstaller/installer-item.d.ts +0 -21
  85. package/es/ComponentInstaller/installer-item.js +0 -139
  86. package/es/ComponentInstaller/locales.d.ts +0 -28
  87. package/es/ComponentInstaller/locales.js +0 -22
  88. package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
  89. package/es/ComponentInstaller/use-component-installed.js +0 -88
  90. package/es/ComponentManager/components/add-component.d.ts +0 -16
  91. package/es/ComponentManager/components/add-component.js +0 -114
  92. package/es/ComponentManager/components/check-component.d.ts +0 -2
  93. package/es/ComponentManager/components/check-component.js +0 -2
  94. package/es/ComponentManager/components/publish-component.d.ts +0 -10
  95. package/es/ComponentManager/components/publish-component.js +0 -76
  96. package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
  97. package/es/ComponentManager/components/resource-dialog.js +0 -74
  98. package/es/ComponentManager/index.d.ts +0 -3
  99. package/es/ComponentManager/index.js +0 -3
  100. package/es/ComponentManager/libs/locales.d.ts +0 -14
  101. package/es/ComponentManager/libs/locales.js +0 -14
  102. package/es/Dashboard/index.d.ts +0 -40
  103. package/es/Dashboard/index.js +0 -118
  104. package/es/Footer/brand.d.ts +0 -22
  105. package/es/Footer/brand.js +0 -73
  106. package/es/Footer/copyright.d.ts +0 -18
  107. package/es/Footer/copyright.js +0 -25
  108. package/es/Footer/index.d.ts +0 -6
  109. package/es/Footer/index.js +0 -82
  110. package/es/Footer/internal-footer.d.ts +0 -29
  111. package/es/Footer/internal-footer.js +0 -117
  112. package/es/Footer/layout/plain.d.ts +0 -15
  113. package/es/Footer/layout/plain.js +0 -39
  114. package/es/Footer/layout/row.d.ts +0 -18
  115. package/es/Footer/layout/row.js +0 -41
  116. package/es/Footer/layout/standard.d.ts +0 -15
  117. package/es/Footer/layout/standard.js +0 -53
  118. package/es/Footer/links.d.ts +0 -22
  119. package/es/Footer/links.js +0 -207
  120. package/es/Footer/social-media.d.ts +0 -14
  121. package/es/Footer/social-media.js +0 -60
  122. package/es/Header/index.d.ts +0 -10
  123. package/es/Header/index.js +0 -155
  124. package/es/Icon/index.d.ts +0 -23
  125. package/es/Icon/index.js +0 -55
  126. package/es/UserCenter/assets/banner.png +0 -0
  127. package/es/UserCenter/components/notification.js +0 -248
  128. package/es/UserCenter/components/passport.d.ts +0 -6
  129. package/es/UserCenter/components/passport.js +0 -88
  130. package/es/UserCenter/components/privacy.d.ts +0 -11
  131. package/es/UserCenter/components/privacy.js +0 -99
  132. package/es/UserCenter/components/settings.d.ts +0 -9
  133. package/es/UserCenter/components/settings.js +0 -89
  134. package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
  135. package/es/UserCenter/components/storage/connect-to.js +0 -108
  136. package/es/UserCenter/components/storage/connected.d.ts +0 -7
  137. package/es/UserCenter/components/storage/connected.js +0 -24
  138. package/es/UserCenter/components/storage/delete.d.ts +0 -7
  139. package/es/UserCenter/components/storage/delete.js +0 -62
  140. package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
  141. package/es/UserCenter/components/storage/disconnect.js +0 -23
  142. package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  143. package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  144. package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
  145. package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  146. package/es/UserCenter/components/storage/index.d.ts +0 -3
  147. package/es/UserCenter/components/storage/index.js +0 -27
  148. package/es/UserCenter/components/storage/item.d.ts +0 -9
  149. package/es/UserCenter/components/storage/item.js +0 -158
  150. package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
  151. package/es/UserCenter/components/storage/preview-nft.js +0 -80
  152. package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
  153. package/es/UserCenter/components/third-party-login/index.js +0 -110
  154. package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
  155. package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
  156. package/es/UserCenter/components/user-center.d.ts +0 -15
  157. package/es/UserCenter/components/user-center.js +0 -414
  158. package/es/UserCenter/components/user-info/index.d.ts +0 -3
  159. package/es/UserCenter/components/user-info/index.js +0 -3
  160. package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
  161. package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
  162. package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
  163. package/es/UserCenter/components/user-info/user-info-item.js +0 -47
  164. package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
  165. package/es/UserCenter/components/user-info/user-info.js +0 -66
  166. package/es/UserCenter/components/webhook-item.d.ts +0 -3
  167. package/es/UserCenter/components/webhook-item.js +0 -243
  168. package/es/UserCenter/index.d.ts +0 -1
  169. package/es/UserCenter/index.js +0 -1
  170. package/es/UserCenter/libs/api.d.ts +0 -3
  171. package/es/UserCenter/libs/api.js +0 -4
  172. package/es/UserCenter/libs/locales.d.ts +0 -162
  173. package/es/UserCenter/libs/locales.js +0 -162
  174. package/es/UserCenter/libs/utils.d.ts +0 -4
  175. package/es/UserCenter/libs/utils.js +0 -14
  176. package/es/UserSessions/components/user-session-info.d.ts +0 -6
  177. package/es/UserSessions/components/user-session-info.js +0 -92
  178. package/es/UserSessions/components/user-sessions.d.ts +0 -9
  179. package/es/UserSessions/components/user-sessions.js +0 -265
  180. package/es/UserSessions/index.d.ts +0 -1
  181. package/es/UserSessions/index.js +0 -1
  182. package/es/UserSessions/libs/locales.d.ts +0 -58
  183. package/es/UserSessions/libs/locales.js +0 -58
  184. package/es/UserSessions/libs/utils.d.ts +0 -2
  185. package/es/UserSessions/libs/utils.js +0 -73
  186. package/es/blocklets.d.ts +0 -16
  187. package/es/blocklets.js +0 -178
  188. package/es/common/header-addons.d.ts +0 -21
  189. package/es/common/header-addons.js +0 -83
  190. package/es/common/link-blocker.d.ts +0 -7
  191. package/es/common/link-blocker.js +0 -18
  192. package/es/common/overridable-theme-provider.d.ts +0 -18
  193. package/es/common/overridable-theme-provider.js +0 -15
  194. package/es/common/wallet-hidden-topbar.d.ts +0 -1
  195. package/es/common/wallet-hidden-topbar.js +0 -14
  196. package/es/contexts/config-user-space.d.ts +0 -26
  197. package/es/contexts/config-user-space.js +0 -53
  198. package/es/hooks/use-mobile.d.ts +0 -4
  199. package/es/hooks/use-mobile.js +0 -5
  200. package/es/index.d.ts +0 -10
  201. package/es/index.js +0 -10
  202. package/es/libs/client.d.ts +0 -2
  203. package/es/libs/client.js +0 -2
  204. package/es/libs/spaces.d.ts +0 -2
  205. package/es/libs/spaces.js +0 -13
  206. package/es/types.d.ts +0 -2
  207. package/es/types.js +0 -43
  208. package/es/utils.d.ts +0 -8
  209. package/es/utils.js +0 -78
@@ -1,38 +1,26 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = Passport;
7
- var _jsxRuntime = require("react/jsx-runtime");
8
- var _material = require("@mui/material");
9
- var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
10
- var _Theme = require("@arcblock/ux/lib/Theme");
11
- var _Colors = require("@arcblock/ux/lib/Colors");
12
- var _Passport = _interopRequireDefault(require("@arcblock/ux/lib/Passport"));
13
- var _constant = require("@arcblock/ux/lib/Util/constant");
14
- var _ahooks = require("ahooks");
15
- var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
16
- var _util = require("@arcblock/ux/lib/Locale/util");
17
- var _context = require("@arcblock/ux/lib/Locale/context");
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 = (0, _Theme.useTheme)();
32
- const passports = (0, _ahooks.useCreation)(() => {
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 === _constant.PASSPORT_STATUS.REVOKED
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 (0, _uniqBy.default)(passportList, "role");
34
+ return uniqBy(passportList, "role");
47
35
  }, [user?.passports]);
48
- const currentRole = (0, _ahooks.useCreation)(() => passports?.find(item => item.name === user.role), [passports, user?.role]);
49
- const activeColor = (0, _ahooks.useCreation)(() => {
50
- return theme?.palette?.primary?.main || _Colors.temp.textBase;
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__ */(0, _jsxRuntime.jsx)(_material.Box, {
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__ */(0, _jsxRuntime.jsx)(_material.Box, {
60
- ...rest,
61
- sx: {
62
- display: "grid",
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
- flexDirection: "column",
79
- alignItems: "center",
80
- gap: 1,
81
- ".passport-item__display": {
82
- width: 166,
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
- ".passport-item__body": {
92
- marginLeft: "0 !important"
93
- }
94
- }
95
- }, x.id))
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
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = Privacy;
7
- var _jsxRuntime = require("react/jsx-runtime");
8
- var _material = require("@mui/material");
9
- var _Switch = _interopRequireDefault(require("@arcblock/ux/lib/Switch"));
10
- var _react = require("react");
11
- var _ahooks = require("ahooks");
12
- var _util = require("@arcblock/ux/lib/Locale/util");
13
- var _context = require("@arcblock/ux/lib/Locale/context");
14
- var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
15
- var _locales = require("../libs/locales");
16
- var _client = require("../../libs/client");
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 = (0, _ahooks.useMemoizedFn)(async (type, value) => {
18
+ const handleChangeSwitch = useMemoizedFn(async (type, value) => {
31
19
  try {
32
- const result = await _client.client.user.saveUserPrivacyConfig({
20
+ const result = await client.user.saveUserPrivacyConfig({
33
21
  [type]: !value
34
22
  });
35
- setDataList(dataList.map(item => {
36
- return {
37
- ...item,
38
- value: result?.[item.key] ?? item.value
39
- };
40
- }));
41
- _Toast.default.success(t("saveSuccess"));
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
- _Toast.default.error((0, _utils.formatAxiosError)(err));
34
+ Toast.error(formatAxiosError(err));
45
35
  }
46
36
  });
47
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
48
- sx: {
49
- display: "flex",
50
- flexDirection: "column",
51
- gap: 1,
52
- alignItems: "start",
53
- ".MuiFormControlLabel-root": {
37
+ return /* @__PURE__ */ jsx(
38
+ Box,
39
+ {
40
+ sx: {
41
+ display: "flex",
42
+ flexDirection: "column",
54
43
  gap: 1,
55
- m: 0,
56
- flexDirection: {
57
- xs: "row-reverse",
58
- md: "row"
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
- width: "16px",
76
- height: "16px"
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
- size: "small",
98
- onChange: event => handleChangeSwitch(item.key, event.target.checked)
99
- }, item.key))
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
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- module.exports = Settings;
7
- var _jsxRuntime = require("react/jsx-runtime");
8
- var _Tabs = _interopRequireDefault(require("@arcblock/ux/lib/Tabs"));
9
- var _material = require("@mui/material");
10
- var _ahooks = require("ahooks");
11
- var _util = require("@arcblock/ux/lib/Locale/util");
12
- var _context = require("@arcblock/ux/lib/Locale/context");
13
- var _configUserSpace = require("../../contexts/config-user-space");
14
- var _locales = require("../libs/locales");
15
- var _notification = _interopRequireDefault(require("./notification"));
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
- locale
29
- } = (0, _context.useLocaleContext)();
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 = (0, _ahooks.useCreation)(() => {
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 = (0, _ahooks.useCreation)(() => {
44
- return [{
45
- label: t("notificationManagement"),
46
- value: "notification",
47
- content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_notification.default, {
48
- user
49
- })
50
- }, {
51
- label: t("thirdPartyLogin.title"),
52
- value: "thirdPartyLogin",
53
- content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_thirdPartyLogin.default, {
54
- user
55
- })
56
- }, {
57
- label: t("privacyManagement"),
58
- value: "privacy",
59
- content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_privacy.default, {
60
- configList: privacyConfigList,
61
- onSave
62
- })
63
- }, user?.didSpace?.endpoint && {
64
- label: t("storageManagement"),
65
- value: "storage",
66
- content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_configUserSpace.ConfigUserSpaceProvider, {
67
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_storage.default, {})
68
- })
69
- }, {
70
- label: t("sessionManagement"),
71
- value: "session",
72
- content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_UserSessions.UserSessions, {
73
- user
74
- })
75
- }].filter(Boolean);
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 = (0, _ahooks.useReactive)({
69
+ const currentState = useReactive({
78
70
  tab: tabs[0].value
79
71
  });
80
- const currentTab = (0, _ahooks.useCreation)(() => {
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 = (0, _ahooks.useMemoizedFn)(value => {
75
+ const handleChangeTab = useMemoizedFn((value) => {
84
76
  currentState.tab = value;
85
77
  });
86
- return currentTab && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
87
- ...rest,
88
- sx: {
89
- ...rest?.sx,
90
- minWidth: {
91
- md: 500
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
- maxWidth: "100%"
94
- },
95
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Tabs.default, {
96
- variant: "card",
97
- tabs,
98
- current: currentTab.value,
99
- onChange: handleChangeTab
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
+ }