@blocklet/ui-react 2.11.13 → 2.11.15

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useEffect } from "react";
2
3
  import { Box, Divider, Typography } from "@mui/material";
3
4
  import { useCreation, useMemoizedFn } from "ahooks";
4
5
  import { translate } from "@arcblock/ux/lib/Locale/util";
@@ -33,9 +34,6 @@ export default function Settings({
33
34
  };
34
35
  });
35
36
  }, [settings?.userCenterTabs]);
36
- const showStorage = window?.blocklet?.componentMountPoints.some(
37
- (v) => v.capabilities?.didSpace === "requiredOnConnect"
38
- );
39
37
  const tabs = useCreation(() => {
40
38
  return [
41
39
  {
@@ -58,7 +56,7 @@ export default function Settings({
58
56
  value: "privacy",
59
57
  content: /* @__PURE__ */ jsx(Privacy, { configList: privacyConfigList, onSave })
60
58
  },
61
- showStorage && {
59
+ {
62
60
  label: t("storageManagement"),
63
61
  value: "storage",
64
62
  content: /* @__PURE__ */ jsx(ConfigUserSpaceProvider, { children: /* @__PURE__ */ jsx(DidSpace, {}) })
@@ -70,6 +68,13 @@ export default function Settings({
70
68
  }
71
69
  ].filter(Boolean);
72
70
  }, [user, privacyConfigList]);
71
+ useEffect(() => {
72
+ const id = window.location.hash.slice(1);
73
+ if (id) {
74
+ const element = document.getElementById(id);
75
+ element?.scrollIntoView({ behavior: "smooth" });
76
+ }
77
+ }, []);
73
78
  return /* @__PURE__ */ jsx(
74
79
  Box,
75
80
  {
@@ -81,7 +86,7 @@ export default function Settings({
81
86
  },
82
87
  maxWidth: "100%"
83
88
  },
84
- children: tabs.map((tab, index) => /* @__PURE__ */ jsxs(Box, { children: [
89
+ children: tabs.map((tab, index) => /* @__PURE__ */ jsxs(Box, { id: tab.value, children: [
85
90
  /* @__PURE__ */ jsx(
86
91
  Typography,
87
92
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.11.13",
3
+ "version": "2.11.15",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -32,8 +32,8 @@
32
32
  "url": "https://github.com/ArcBlock/ux/issues"
33
33
  },
34
34
  "dependencies": {
35
- "@arcblock/bridge": "^2.11.13",
36
- "@arcblock/react-hooks": "^2.11.13",
35
+ "@arcblock/bridge": "^2.11.15",
36
+ "@arcblock/react-hooks": "^2.11.15",
37
37
  "@blocklet/did-space-react": "^0.6.0",
38
38
  "@iconify-icons/logos": "^1.2.36",
39
39
  "@iconify-icons/material-symbols": "^1.2.58",
@@ -81,5 +81,5 @@
81
81
  "jest": "^29.7.0",
82
82
  "unbuild": "^2.0.0"
83
83
  },
84
- "gitHead": "0be0694186c9696374c4adfa5c7fa530b2ca0050"
84
+ "gitHead": "08b1daa5c17ade28952f1c44fb4e6f79f1c3b178"
85
85
  }
@@ -1,3 +1,4 @@
1
+ import { useEffect } from 'react';
1
2
  import { Box, Divider, Typography } from '@mui/material';
2
3
  import type { BoxProps } from '@mui/material';
3
4
  import { useCreation, useMemoizedFn } from 'ahooks';
@@ -42,9 +43,6 @@ export default function Settings({
42
43
  };
43
44
  });
44
45
  }, [settings?.userCenterTabs]);
45
- const showStorage = window?.blocklet?.componentMountPoints.some(
46
- (v: any) => v.capabilities?.didSpace === 'requiredOnConnect'
47
- );
48
46
  const tabs = useCreation(() => {
49
47
  return [
50
48
  {
@@ -67,7 +65,7 @@ export default function Settings({
67
65
  value: 'privacy',
68
66
  content: <Privacy configList={privacyConfigList} onSave={onSave} />,
69
67
  },
70
- showStorage && {
68
+ {
71
69
  label: t('storageManagement'),
72
70
  value: 'storage',
73
71
  content: (
@@ -84,6 +82,15 @@ export default function Settings({
84
82
  ].filter(Boolean);
85
83
  }, [user, privacyConfigList]);
86
84
 
85
+ // 支持 hash 锚点定位
86
+ useEffect(() => {
87
+ const id = window.location.hash.slice(1);
88
+ if (id) {
89
+ const element = document.getElementById(id);
90
+ element?.scrollIntoView({ behavior: 'smooth' });
91
+ }
92
+ }, []);
93
+
87
94
  return (
88
95
  <Box
89
96
  {...rest}
@@ -95,7 +102,7 @@ export default function Settings({
95
102
  maxWidth: '100%',
96
103
  }}>
97
104
  {tabs.map((tab, index) => (
98
- <Box key={tab.value}>
105
+ <Box id={tab.value} key={tab.value}>
99
106
  <Typography
100
107
  sx={{
101
108
  color: colors.foregroundsFgBase,