@blocklet/ui-react 2.9.17 → 2.9.19

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 (104) hide show
  1. package/build.config.ts +1 -1
  2. package/es/@types/index.d.ts +2 -0
  3. package/es/Dashboard/index.js +1 -1
  4. package/es/UserCenter/components/settings.d.ts +1 -2
  5. package/es/UserCenter/components/settings.js +8 -1
  6. package/es/UserCenter/components/storage/connect-to.d.ts +7 -0
  7. package/es/UserCenter/components/storage/connect-to.js +104 -0
  8. package/es/UserCenter/components/storage/connected.d.ts +7 -0
  9. package/es/UserCenter/components/storage/connected.js +21 -0
  10. package/es/UserCenter/components/storage/delete.d.ts +7 -0
  11. package/es/UserCenter/components/storage/delete.js +59 -0
  12. package/es/UserCenter/components/storage/disconnect.d.ts +3 -0
  13. package/es/UserCenter/components/storage/disconnect.js +23 -0
  14. package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
  15. package/es/UserCenter/components/storage/icons/long-arrow.svg +5 -0
  16. package/es/UserCenter/components/storage/icons/space-connected.svg +3 -0
  17. package/es/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
  18. package/es/UserCenter/components/storage/index.d.ts +3 -0
  19. package/es/UserCenter/components/storage/index.js +25 -0
  20. package/es/UserCenter/components/storage/item.d.ts +9 -0
  21. package/es/UserCenter/components/storage/item.js +147 -0
  22. package/es/UserCenter/components/storage/preview-nft.d.ts +6 -0
  23. package/es/UserCenter/components/storage/preview-nft.js +80 -0
  24. package/es/UserCenter/components/user-basic-info.d.ts +3 -1
  25. package/es/UserCenter/components/user-basic-info.js +133 -46
  26. package/es/UserCenter/components/user-center.d.ts +9 -6
  27. package/es/UserCenter/components/user-center.js +39 -138
  28. package/es/UserCenter/components/user-info-item.d.ts +2 -1
  29. package/es/UserCenter/components/user-info-item.js +4 -2
  30. package/es/UserCenter/components/user-info.js +6 -2
  31. package/es/UserCenter/libs/api.d.ts +3 -0
  32. package/es/UserCenter/libs/api.js +4 -0
  33. package/es/UserCenter/libs/locales.d.ts +6 -0
  34. package/es/UserCenter/libs/locales.js +8 -2
  35. package/es/contexts/config-user-space.d.ts +26 -0
  36. package/es/contexts/config-user-space.js +53 -0
  37. package/es/hooks/use-mobile.d.ts +4 -0
  38. package/es/hooks/use-mobile.js +5 -0
  39. package/es/libs/spaces.d.ts +1 -0
  40. package/es/libs/spaces.js +7 -0
  41. package/lib/@types/index.d.ts +2 -0
  42. package/lib/Dashboard/index.js +2 -0
  43. package/lib/UserCenter/components/settings.d.ts +1 -2
  44. package/lib/UserCenter/components/settings.js +9 -1
  45. package/lib/UserCenter/components/storage/connect-to.d.ts +7 -0
  46. package/lib/UserCenter/components/storage/connect-to.js +127 -0
  47. package/lib/UserCenter/components/storage/connected.d.ts +7 -0
  48. package/lib/UserCenter/components/storage/connected.js +45 -0
  49. package/lib/UserCenter/components/storage/delete.d.ts +7 -0
  50. package/lib/UserCenter/components/storage/delete.js +71 -0
  51. package/lib/UserCenter/components/storage/disconnect.d.ts +3 -0
  52. package/lib/UserCenter/components/storage/disconnect.js +37 -0
  53. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
  54. package/lib/UserCenter/components/storage/icons/long-arrow.svg +5 -0
  55. package/lib/UserCenter/components/storage/icons/space-connected.svg +3 -0
  56. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
  57. package/lib/UserCenter/components/storage/index.d.ts +3 -0
  58. package/lib/UserCenter/components/storage/index.js +56 -0
  59. package/lib/UserCenter/components/storage/item.d.ts +9 -0
  60. package/lib/UserCenter/components/storage/item.js +179 -0
  61. package/lib/UserCenter/components/storage/preview-nft.d.ts +6 -0
  62. package/lib/UserCenter/components/storage/preview-nft.js +88 -0
  63. package/lib/UserCenter/components/user-basic-info.d.ts +3 -1
  64. package/lib/UserCenter/components/user-basic-info.js +81 -4
  65. package/lib/UserCenter/components/user-center.d.ts +9 -6
  66. package/lib/UserCenter/components/user-center.js +36 -95
  67. package/lib/UserCenter/components/user-info-item.d.ts +2 -1
  68. package/lib/UserCenter/components/user-info-item.js +5 -2
  69. package/lib/UserCenter/components/user-info.js +9 -2
  70. package/lib/UserCenter/libs/api.d.ts +3 -0
  71. package/lib/UserCenter/libs/api.js +16 -0
  72. package/lib/UserCenter/libs/locales.d.ts +6 -0
  73. package/lib/UserCenter/libs/locales.js +8 -2
  74. package/lib/contexts/config-user-space.d.ts +26 -0
  75. package/lib/contexts/config-user-space.js +61 -0
  76. package/lib/hooks/use-mobile.d.ts +4 -0
  77. package/lib/hooks/use-mobile.js +13 -0
  78. package/lib/libs/spaces.d.ts +1 -0
  79. package/lib/libs/spaces.js +13 -0
  80. package/package.json +6 -4
  81. package/src/@types/index.ts +3 -0
  82. package/src/Dashboard/index.jsx +1 -1
  83. package/src/UserCenter/components/settings.tsx +8 -2
  84. package/src/UserCenter/components/storage/connect-to.tsx +117 -0
  85. package/src/UserCenter/components/storage/connected.tsx +29 -0
  86. package/src/UserCenter/components/storage/delete.tsx +66 -0
  87. package/src/UserCenter/components/storage/disconnect.tsx +27 -0
  88. package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
  89. package/src/UserCenter/components/storage/icons/long-arrow.svg +5 -0
  90. package/src/UserCenter/components/storage/icons/space-connected.svg +3 -0
  91. package/src/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
  92. package/src/UserCenter/components/storage/index.tsx +47 -0
  93. package/src/UserCenter/components/storage/item.tsx +150 -0
  94. package/src/UserCenter/components/storage/preview-nft.tsx +72 -0
  95. package/src/UserCenter/components/user-basic-info.tsx +88 -5
  96. package/src/UserCenter/components/user-center.tsx +36 -115
  97. package/src/UserCenter/components/user-info-item.tsx +4 -2
  98. package/src/UserCenter/components/user-info.tsx +6 -2
  99. package/src/UserCenter/libs/api.ts +7 -0
  100. package/src/UserCenter/libs/locales.ts +6 -0
  101. package/src/contexts/config-user-space.tsx +86 -0
  102. package/src/hooks/use-mobile.tsx +6 -0
  103. package/src/libs/spaces.tsx +10 -0
  104. package/babel.config.es.js +0 -8
@@ -1,11 +1,8 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useContext } from "react";
3
- import { Box, CircularProgress, IconButton, Paper, Typography } from "@mui/material";
3
+ import { Box, CircularProgress, Paper, Typography } from "@mui/material";
4
4
  import { useCreation, useMemoizedFn, useMount, useRequest } from "ahooks";
5
- import { Icon } from "@iconify/react";
6
- import SettingsOutlineRoundedIcon from "@iconify-icons/material-symbols/settings-outline-rounded";
7
5
  import { SessionContext } from "@arcblock/did-connect/lib/Session";
8
- import Avatar from "@arcblock/ux/lib/Avatar";
9
6
  import Tabs from "@arcblock/ux/lib/Tabs";
10
7
  import Empty from "@arcblock/ux/lib/Empty";
11
8
  import { temp as colors } from "@arcblock/ux/lib/Colors";
@@ -15,9 +12,8 @@ import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
15
12
  import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
16
13
  import cloneDeep from "lodash/cloneDeep";
17
14
  import { getQuery, withQuery } from "ufo";
18
- import Header from "../../Header/index.js";
15
+ import { Header, Footer } from "../..//index.js";
19
16
  import { translations } from "../libs/locales.js";
20
- import banner from "../assets/banner.png";
21
17
  import UserInfo from "./user-info.js";
22
18
  import UserBasicInfo from "./user-basic-info.js";
23
19
  import { formatBlockletInfo, getLocalizedNavigation } from "../../blocklets.js";
@@ -29,7 +25,10 @@ export default function UserCenter({
29
25
  currentTab,
30
26
  contentProps = {},
31
27
  disableAutoRedirect = false,
32
- autoPopupSetting = false
28
+ autoPopupSetting = false,
29
+ hideFooter = false,
30
+ headerProps = {},
31
+ footerProps = {}
33
32
  }) {
34
33
  const { locale } = useLocaleContext();
35
34
  const t = useMemoizedFn((key, data = {}) => {
@@ -134,26 +133,6 @@ export default function UserCenter({
134
133
  });
135
134
  }
136
135
  });
137
- const xsGridTemplateAreas = useCreation(() => {
138
- return [
139
- '"avatar settings"',
140
- '"basicInfo basicInfo"',
141
- userCenterTabs.length > 0 || !isMyself ? '"tabs tabs"' : null,
142
- isMyself ? '"passport passport"' : null,
143
- isMyself ? '"extraInfo extraInfo"' : null
144
- ];
145
- }, [userCenterTabs, isMyself]);
146
- const mdGridTemplateAreas = useCreation(() => {
147
- if (!isMyself) {
148
- return ['"avatar"', '"basicInfo"', '"tabs"'];
149
- }
150
- return [
151
- '"avatar settings"',
152
- '"basicInfo extraInfo"',
153
- userCenterTabs.length > 0 ? '"tabs extraInfo"' : null,
154
- '"passport extraInfo"'
155
- ];
156
- }, [userCenterTabs, isMyself]);
157
136
  const openSettings = useMemoizedFn(() => {
158
137
  confirmApi.open({
159
138
  title: t("settings"),
@@ -196,77 +175,22 @@ export default function UserCenter({
196
175
  Box,
197
176
  {
198
177
  sx: {
199
- maxWidth: 1200,
178
+ maxWidth: 880,
200
179
  margin: "0 auto",
201
- px: 3,
202
- pb: 3,
203
- display: "grid",
180
+ p: 3,
181
+ display: "flex",
204
182
  gap: 2.5,
205
- gridTemplateAreas: {
206
- xs: xsGridTemplateAreas.filter(Boolean).join(" "),
207
- md: mdGridTemplateAreas.filter(Boolean).join(" ")
208
- },
209
- gridTemplateRows: {
210
- xs: "64px auto auto auto",
211
- md: "64px auto 1fr"
212
- },
213
- gridTemplateColumns: {
214
- xs: "1fr",
215
- md: isMyself ? "1fr 300px" : "1fr"
216
- }
183
+ flexDirection: "column"
217
184
  },
218
185
  children: [
219
- /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
220
- Avatar,
221
- {
222
- src: userState.data?.avatar,
223
- did: userState.data?.did,
224
- size: 120,
225
- variant: "circle",
226
- shape: "circle",
227
- style: {
228
- border: "4px solid #fff",
229
- transform: "translateY(-50%)",
230
- borderRadius: "100%",
231
- gridArea: "avatar",
232
- backgroundColor: "#fff"
233
- }
234
- }
235
- ) }),
236
- isMyself ? /* @__PURE__ */ jsx(
237
- Box,
238
- {
239
- sx: {
240
- gridArea: "settings",
241
- display: "flex",
242
- justifyContent: "flex-end",
243
- alignItems: "center"
244
- },
245
- children: /* @__PURE__ */ jsx(
246
- IconButton,
247
- {
248
- sx: {
249
- borderRadius: 2,
250
- color: colors.textBase,
251
- backgroundColor: "white",
252
- border: `1px solid ${colors.strokeBorderBase}`
253
- },
254
- disableFocusRipple: true,
255
- onClick: openSettings,
256
- children: /* @__PURE__ */ jsx(Icon, { icon: SettingsOutlineRoundedIcon })
257
- }
258
- )
259
- }
260
- ) : null,
261
186
  /* @__PURE__ */ jsx(
262
187
  UserBasicInfo,
263
188
  {
264
189
  isMyself,
265
190
  switchPassport: session.switchPassport,
266
- user: userState.data,
267
- sx: {
268
- gridArea: "basicInfo"
269
- }
191
+ switchProfile: session.switchProfile,
192
+ openSettings,
193
+ user: userState.data
270
194
  }
271
195
  ),
272
196
  userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
@@ -326,41 +250,28 @@ export default function UserCenter({
326
250
  }
327
251
  ) : null,
328
252
  isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
329
- /* @__PURE__ */ jsxs(
330
- Box,
331
- {
332
- sx: {
333
- gridArea: "passport"
334
- },
335
- children: [
336
- /* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { fontWeight: "bold", mb: 1.5 }, children: "Passport" }),
337
- /* @__PURE__ */ jsx(Passport, { user: userState.data })
338
- ]
339
- }
340
- ),
341
- /* @__PURE__ */ jsx(
342
- Box,
343
- {
344
- sx: {
345
- gridArea: "extraInfo"
346
- },
347
- children: /* @__PURE__ */ jsx(
348
- UserInfo,
349
- {
350
- user: userState.data,
351
- sx: {
352
- padding: 3,
353
- borderRadius: 3
354
- }
253
+ /* @__PURE__ */ jsxs(Box, { children: [
254
+ /* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { fontWeight: "bold", mb: 1.5 }, children: t("passport") }),
255
+ /* @__PURE__ */ jsx(Passport, { user: userState.data })
256
+ ] }),
257
+ /* @__PURE__ */ jsxs(Box, { children: [
258
+ /* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { fontWeight: "bold", mb: 1.5 }, children: t("userInfo") }),
259
+ /* @__PURE__ */ jsx(
260
+ UserInfo,
261
+ {
262
+ user: userState.data,
263
+ sx: {
264
+ padding: 3,
265
+ borderRadius: 3
355
266
  }
356
- )
357
- }
358
- )
267
+ }
268
+ )
269
+ ] })
359
270
  ] }) : null
360
271
  ]
361
272
  }
362
273
  );
363
- }, [userState, userCenterTabs, mdGridTemplateAreas, xsGridTemplateAreas]);
274
+ }, [userState, userCenterTabs]);
364
275
  if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
365
276
  window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
366
277
  return null;
@@ -370,27 +281,17 @@ export default function UserCenter({
370
281
  {
371
282
  sx: {
372
283
  backgroundColor: colors.backgroundsBgSubtitle,
373
- minHeight: "100vh"
284
+ minHeight: "100vh",
285
+ display: "flex",
286
+ flexDirection: "column"
374
287
  },
375
288
  children: [
376
- /* @__PURE__ */ jsx(Header, {}),
377
- /* @__PURE__ */ jsx(
378
- Box,
379
- {
380
- sx: {
381
- pt: {
382
- xs: `${400 / 1280 * 100}%`,
383
- sm: `${300 / 1280 * 100}%`,
384
- md: `${200 / 1280 * 100}%`
385
- },
386
- backgroundImage: `url(${banner})`,
387
- backgroundSize: "cover",
388
- minHeight: "60px"
389
- }
390
- }
391
- ),
392
- content,
393
- confirmHolder
289
+ /* @__PURE__ */ jsx(Header, { ...headerProps }),
290
+ /* @__PURE__ */ jsxs(Box, { flex: 1, children: [
291
+ content,
292
+ confirmHolder
293
+ ] }),
294
+ hideFooter ? null : /* @__PURE__ */ jsx(Footer, { ...footerProps })
394
295
  ]
395
296
  }
396
297
  );
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { BoxProps } from '@mui/material';
2
3
  type TUserInfoItemProps = {
3
4
  data: {
4
5
  icon: any;
@@ -6,5 +7,5 @@ type TUserInfoItemProps = {
6
7
  content: any;
7
8
  };
8
9
  };
9
- export default function UserInfoItem({ data }: TUserInfoItemProps): import("react").JSX.Element;
10
+ export default function UserInfoItem({ data, ...rest }: TUserInfoItemProps & BoxProps): import("react").JSX.Element;
10
11
  export {};
@@ -1,17 +1,19 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Box, Typography } from "@mui/material";
3
3
  import { temp as colors } from "@arcblock/ux/lib/Colors";
4
- export default function UserInfoItem({ data }) {
4
+ export default function UserInfoItem({ data, ...rest }) {
5
5
  return /* @__PURE__ */ jsxs(
6
6
  Box,
7
7
  {
8
+ ...rest,
8
9
  sx: {
9
10
  display: "grid",
10
11
  gridTemplateColumns: "auto 1fr",
11
12
  gridTemplateAreas: `"icon title" ". content"`,
12
13
  alignItems: "center",
13
14
  rowGap: 0.75,
14
- columnGap: 1
15
+ columnGap: 1,
16
+ ...rest.sx
15
17
  },
16
18
  children: [
17
19
  /* @__PURE__ */ jsx(
@@ -58,11 +58,15 @@ export default function UserInfo({
58
58
  ...rest,
59
59
  sx: {
60
60
  display: "flex",
61
- flexDirection: "column",
61
+ flexDirection: {
62
+ xs: "column",
63
+ md: "row"
64
+ },
65
+ alignItems: "flex-start",
62
66
  gap: 3,
63
67
  ...rest?.sx
64
68
  },
65
- children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item }, item.title))
69
+ children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 } }, item.title))
66
70
  }
67
71
  );
68
72
  }
@@ -0,0 +1,3 @@
1
+ import axios from 'axios';
2
+ declare const api: import("axios").AxiosInstance;
3
+ export { axios, api };
@@ -0,0 +1,4 @@
1
+ import axios from "axios";
2
+ axios.defaults.timeout = 10 * 1e3;
3
+ const api = axios.create();
4
+ export { axios, api };
@@ -23,6 +23,7 @@ export declare const translations: {
23
23
  noUserFound: string;
24
24
  notificationManagement: string;
25
25
  privacyManagement: string;
26
+ storageManagement: string;
26
27
  webhook: {
27
28
  url: string;
28
29
  slack: string;
@@ -33,6 +34,8 @@ export declare const translations: {
33
34
  };
34
35
  toPublic: string;
35
36
  currentPassport: string;
37
+ switchProfile: string;
38
+ userInfo: string;
36
39
  };
37
40
  en: {
38
41
  settings: string;
@@ -55,6 +58,7 @@ export declare const translations: {
55
58
  emptyField: string;
56
59
  notificationManagement: string;
57
60
  privacyManagement: string;
61
+ storageManagement: string;
58
62
  emptyContent: string;
59
63
  underProtected: string;
60
64
  noUserFound: string;
@@ -68,5 +72,7 @@ export declare const translations: {
68
72
  };
69
73
  toPublic: string;
70
74
  currentPassport: string;
75
+ switchProfile: string;
76
+ userInfo: string;
71
77
  };
72
78
  };
@@ -23,6 +23,7 @@ export const translations = {
23
23
  noUserFound: "\u672A\u627E\u5230\u6307\u5B9A\u7684\u7528\u6237",
24
24
  notificationManagement: "\u901A\u77E5\u7BA1\u7406",
25
25
  privacyManagement: "\u9690\u79C1\u7BA1\u7406",
26
+ storageManagement: "\u5B58\u50A8\u7BA1\u7406",
26
27
  webhook: {
27
28
  url: "\u81EA\u5B9A\u4E49URL",
28
29
  slack: "Slack"
@@ -32,7 +33,9 @@ export const translations = {
32
33
  invalid: "\u65E0\u6548"
33
34
  },
34
35
  toPublic: "\u516C\u5F00 \u201C{name}\u201D \u9875\u9762",
35
- currentPassport: "\u5F53\u524D\u4F7F\u7528\u7684\u901A\u884C\u8BC1"
36
+ currentPassport: "\u5F53\u524D\u4F7F\u7528\u7684\u901A\u884C\u8BC1",
37
+ switchProfile: "\u5207\u6362",
38
+ userInfo: "\u4E2A\u4EBA\u4FE1\u606F"
36
39
  },
37
40
  en: {
38
41
  settings: "Settings",
@@ -55,6 +58,7 @@ export const translations = {
55
58
  emptyField: "Empty field",
56
59
  notificationManagement: "Notification",
57
60
  privacyManagement: "Privacy",
61
+ storageManagement: "Storage",
58
62
  emptyContent: "Empty",
59
63
  underProtected: "This page has protected privacy",
60
64
  noUserFound: "No user found",
@@ -67,6 +71,8 @@ export const translations = {
67
71
  invalid: "Invalid"
68
72
  },
69
73
  toPublic: 'Public "{name}" page',
70
- currentPassport: "Passport currently in use"
74
+ currentPassport: "Passport currently in use",
75
+ switchProfile: "Switch",
76
+ userInfo: "User Info"
71
77
  }
72
78
  };
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ export interface SpaceGateway {
3
+ did: string;
4
+ name: string;
5
+ url: string;
6
+ endpoint: string;
7
+ }
8
+ export interface SettingStorageEndpoint {
9
+ (endpoint: string | undefined): void | Promise<void>;
10
+ }
11
+ interface ConfigUserSpaceContextType {
12
+ loading: boolean;
13
+ spaceGateway: SpaceGateway | undefined;
14
+ deleteSpaceGateway: (spaceGateway: SpaceGateway) => Promise<void>;
15
+ updateSpaceGateway: (updateSpaceGateway: SpaceGateway) => Promise<void>;
16
+ storageEndpoint: string;
17
+ settingStorageEndpoint: SettingStorageEndpoint;
18
+ hasStorageEndpoint: boolean;
19
+ }
20
+ declare const ConfigUserSpaceContext: import("react").Context<ConfigUserSpaceContextType>;
21
+ declare const Consumer: import("react").Consumer<ConfigUserSpaceContextType>;
22
+ declare function ConfigUserSpaceProvider({ children }: {
23
+ children: React.ReactNode;
24
+ }): import("react").JSX.Element;
25
+ declare function useConfigUserSpaceContext(): ConfigUserSpaceContextType;
26
+ export { ConfigUserSpaceContext, ConfigUserSpaceProvider, Consumer as ConfigUserSpaceConsumer, useConfigUserSpaceContext, };
@@ -0,0 +1,53 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo, useState, useEffect } from "react";
3
+ import { SessionContext } from "@arcblock/did-connect/lib/Session";
4
+ const ConfigUserSpaceContext = createContext({});
5
+ const { Provider, Consumer } = ConfigUserSpaceContext;
6
+ function ConfigUserSpaceProvider({ children }) {
7
+ const [loading] = useState(false);
8
+ const { session } = useContext(SessionContext);
9
+ const { user } = session;
10
+ const [spaceGateway, setSpaceGateway] = useState();
11
+ const storageEndpoint = useMemo(() => {
12
+ return user?.didSpace?.endpoint;
13
+ }, [user?.didSpace]);
14
+ useEffect(() => {
15
+ setSpaceGateway(user?.didSpace);
16
+ }, [user?.didSpace]);
17
+ const deleteSpaceGateway = async () => {
18
+ setSpaceGateway(void 0);
19
+ };
20
+ const updateSpaceGateway = async (x) => {
21
+ setSpaceGateway(x);
22
+ session.refresh();
23
+ await settingStorageEndpoint(x.endpoint);
24
+ };
25
+ const settingStorageEndpoint = (endpoint) => {
26
+ };
27
+ const hasStorageEndpoint = Boolean(storageEndpoint && spaceGateway);
28
+ return /* @__PURE__ */ jsx(
29
+ Provider,
30
+ {
31
+ value: {
32
+ loading,
33
+ spaceGateway,
34
+ deleteSpaceGateway,
35
+ updateSpaceGateway,
36
+ storageEndpoint,
37
+ settingStorageEndpoint,
38
+ hasStorageEndpoint
39
+ },
40
+ children
41
+ }
42
+ );
43
+ }
44
+ function useConfigUserSpaceContext() {
45
+ const res = useContext(ConfigUserSpaceContext);
46
+ return res;
47
+ }
48
+ export {
49
+ ConfigUserSpaceContext,
50
+ ConfigUserSpaceProvider,
51
+ Consumer as ConfigUserSpaceConsumer,
52
+ useConfigUserSpaceContext
53
+ };
@@ -0,0 +1,4 @@
1
+ import { Breakpoint } from '@mui/material';
2
+ export default function useMobile({ key }: {
3
+ key?: number | Breakpoint;
4
+ }): boolean;
@@ -0,0 +1,5 @@
1
+ import { useTheme, useMediaQuery } from "@mui/material";
2
+ export default function useMobile({ key = "sm" }) {
3
+ const theme = useTheme();
4
+ return useMediaQuery(theme.breakpoints.down(key));
5
+ }
@@ -0,0 +1 @@
1
+ export declare function getSpaceNftDisplayUrlFromEndpoint(endpoint: string): string;
@@ -0,0 +1,7 @@
1
+ import { joinURL } from "ufo";
2
+ export function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
3
+ const prefix = endpoint.replace(/\/api\/space\/.+/, "");
4
+ const strArray = endpoint.replace(/\/$/, "").split("/");
5
+ const spaceDid = strArray.at(-4);
6
+ return joinURL(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
7
+ }
@@ -15,6 +15,7 @@ export type User = {
15
15
  lastLoginIp?: string;
16
16
  createdAt?: string;
17
17
  passports?: any[];
18
+ didSpace: Record<string, any>;
18
19
  };
19
20
  export type UserCenterTab = {
20
21
  value: string;
@@ -32,6 +33,7 @@ export type Session = {
32
33
  switchDid: any;
33
34
  switchProfile: any;
34
35
  switchPassport: any;
36
+ refresh: Function;
35
37
  };
36
38
  export type WebhookType = 'slack' | 'api';
37
39
  export type WebhookItemData = {
@@ -53,6 +53,8 @@ function Dashboard({
53
53
  title: item.title,
54
54
  url: item.link,
55
55
  icon: item.icon ? /* @__PURE__ */(0, _jsxRuntime.jsx)("iconify-icon", {
56
+ height: "100%",
57
+ width: "100%",
56
58
  icon: item.icon
57
59
  }) : null,
58
60
  // https://github.com/ArcBlock/ux/issues/755#issuecomment-1208692620
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { BoxProps } from '@mui/material';
3
2
  import { User, UserCenterTab } from '../../@types';
4
3
  export default function Settings({ user, settings, onSave, ...rest }: {
@@ -7,4 +6,4 @@ export default function Settings({ user, settings, onSave, ...rest }: {
7
6
  settings: {
8
7
  userCenterTabs: UserCenterTab[];
9
8
  };
10
- } & BoxProps): import("react").JSX.Element | undefined;
9
+ } & BoxProps): any;
@@ -10,9 +10,11 @@ var _material = require("@mui/material");
10
10
  var _ahooks = require("ahooks");
11
11
  var _util = require("@arcblock/ux/lib/Locale/util");
12
12
  var _context = require("@arcblock/ux/lib/Locale/context");
13
+ var _configUserSpace = require("../../contexts/config-user-space");
13
14
  var _locales = require("../libs/locales");
14
15
  var _notification = _interopRequireDefault(require("./notification"));
15
16
  var _privacy = _interopRequireDefault(require("./privacy"));
17
+ var _storage = _interopRequireDefault(require("./storage"));
16
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
19
  function Settings({
18
20
  user,
@@ -50,7 +52,13 @@ function Settings({
50
52
  configList: privacyConfigList,
51
53
  onSave
52
54
  })
53
- }];
55
+ }, user?.didSpace?.endpoint && {
56
+ label: t("storageManagement"),
57
+ value: "storage",
58
+ content: /* @__PURE__ */(0, _jsxRuntime.jsx)(_configUserSpace.ConfigUserSpaceProvider, {
59
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_storage.default, {})
60
+ })
61
+ }].filter(Boolean);
54
62
  }, [user, privacyConfigList]);
55
63
  const currentState = (0, _ahooks.useReactive)({
56
64
  tab: tabs[0].value
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { SpaceGateway } from '../../../contexts/config-user-space';
3
+ declare function ConnectTo({ onConnect, storageEndpoint, ...rest }: {
4
+ onConnect: (spaceGateway: SpaceGateway) => Promise<void>;
5
+ storageEndpoint: string;
6
+ }): import("react").JSX.Element;
7
+ export default ConnectTo;