@blocklet/ui-react 2.13.18 → 2.13.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.
@@ -5,6 +5,7 @@ import { useCreation, useMemoizedFn } from "ahooks";
5
5
  import { translate } from "@arcblock/ux/lib/Locale/util";
6
6
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
7
7
  import { mergeSx } from "@arcblock/ux/lib/Util/style";
8
+ import useBrowser from "@arcblock/react-hooks/lib/useBrowser";
8
9
  import { translations } from "../libs/locales.js";
9
10
  import Notification from "./notification.js";
10
11
  import Privacy from "./privacy.js";
@@ -20,6 +21,8 @@ export default function Settings({
20
21
  ...rest
21
22
  }) {
22
23
  const { locale } = useLocaleContext();
24
+ const browser = useBrowser();
25
+ const isArcSphere = browser.arcSphere;
23
26
  const t = useMemoizedFn((key, data = {}) => {
24
27
  return translate(translations, key, locale, "en", data);
25
28
  });
@@ -36,11 +39,11 @@ export default function Settings({
36
39
  }, [settings?.userCenterTabs]);
37
40
  const tabs = useCreation(() => {
38
41
  return [
39
- {
42
+ !isArcSphere ? {
40
43
  label: t("commonSetting.title"),
41
44
  value: "common",
42
45
  content: /* @__PURE__ */ jsx(ConfigProfile, { user, onSave })
43
- },
46
+ } : void 0,
44
47
  {
45
48
  label: t("notificationManagement"),
46
49
  value: "notification",
@@ -101,38 +104,43 @@ export default function Settings({
101
104
  },
102
105
  maxWidth: "100%"
103
106
  },
104
- children: tabs.map((tab) => /* @__PURE__ */ jsxs(
105
- Box,
106
- {
107
- id: tab.value,
108
- sx: mergeSx(
109
- {
110
- border: "1px solid",
111
- borderColor: "divider",
112
- borderRadius: 1,
113
- p: 2,
114
- "&:last-child": {
115
- mb: 5
116
- }
117
- },
118
- tab.sx
119
- ),
120
- children: [
121
- /* @__PURE__ */ jsx(
122
- Typography,
107
+ children: tabs.map((tab) => {
108
+ if (!tab) {
109
+ return null;
110
+ }
111
+ return /* @__PURE__ */ jsxs(
112
+ Box,
113
+ {
114
+ id: tab.value,
115
+ sx: mergeSx(
123
116
  {
124
- sx: {
125
- color: "text.primary",
126
- fontWeight: 600
127
- },
128
- children: tab.label
129
- }
117
+ border: "1px solid",
118
+ borderColor: "divider",
119
+ borderRadius: 1,
120
+ p: 2,
121
+ "&:last-child": {
122
+ mb: 5
123
+ }
124
+ },
125
+ tab.sx
130
126
  ),
131
- /* @__PURE__ */ jsx(Box, { mt: 2.5, children: tab.content })
132
- ]
133
- },
134
- tab.value
135
- ))
127
+ children: [
128
+ /* @__PURE__ */ jsx(
129
+ Typography,
130
+ {
131
+ sx: {
132
+ color: "text.primary",
133
+ fontWeight: 600
134
+ },
135
+ children: tab.label
136
+ }
137
+ ),
138
+ /* @__PURE__ */ jsx(Box, { mt: 2.5, children: tab.content })
139
+ ]
140
+ },
141
+ tab.value
142
+ );
143
+ })
136
144
  }
137
145
  );
138
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.13.18",
3
+ "version": "2.13.19",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -34,8 +34,8 @@
34
34
  "dependencies": {
35
35
  "@abtnode/constant": "^1.16.42",
36
36
  "@abtnode/util": "^1.16.42",
37
- "@arcblock/bridge": "^2.13.18",
38
- "@arcblock/react-hooks": "^2.13.18",
37
+ "@arcblock/bridge": "^2.13.19",
38
+ "@arcblock/react-hooks": "^2.13.19",
39
39
  "@arcblock/ws": "^1.20.2",
40
40
  "@blocklet/constant": "^1.16.42",
41
41
  "@blocklet/did-space-react": "^1.0.48",
@@ -94,5 +94,5 @@
94
94
  "jest": "^29.7.0",
95
95
  "unbuild": "^2.0.0"
96
96
  },
97
- "gitHead": "7bb88b45cd68de7eb079b590d0d73fd41d303917"
97
+ "gitHead": "64c12fb7646d2323f1be0bef7a3901261687b165"
98
98
  }
@@ -5,7 +5,7 @@ import { useCreation, useMemoizedFn } from 'ahooks';
5
5
  import { translate } from '@arcblock/ux/lib/Locale/util';
6
6
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
7
7
  import { mergeSx } from '@arcblock/ux/lib/Util/style';
8
-
8
+ import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
9
9
  import { translations } from '../libs/locales';
10
10
  import Notification from './notification';
11
11
  import Privacy from './privacy';
@@ -29,6 +29,8 @@ export default function Settings({
29
29
  };
30
30
  } & BoxProps) {
31
31
  const { locale } = useLocaleContext();
32
+ const browser = useBrowser();
33
+ const isArcSphere = browser.arcSphere;
32
34
  const t = useMemoizedFn((key, data = {}) => {
33
35
  return translate(translations, key, locale, 'en', data);
34
36
  });
@@ -45,11 +47,13 @@ export default function Settings({
45
47
  }, [settings?.userCenterTabs]);
46
48
  const tabs = useCreation(() => {
47
49
  return [
48
- {
49
- label: t('commonSetting.title'),
50
- value: 'common',
51
- content: <ConfigProfile user={user} onSave={onSave} />,
52
- },
50
+ !isArcSphere
51
+ ? {
52
+ label: t('commonSetting.title'),
53
+ value: 'common',
54
+ content: <ConfigProfile user={user} onSave={onSave} />,
55
+ }
56
+ : undefined,
53
57
  {
54
58
  label: t('notificationManagement'),
55
59
  value: 'notification',
@@ -111,32 +115,37 @@ export default function Settings({
111
115
  },
112
116
  maxWidth: '100%',
113
117
  }}>
114
- {tabs.map((tab) => (
115
- <Box
116
- id={tab.value}
117
- key={tab.value}
118
- sx={mergeSx(
119
- {
120
- border: '1px solid',
121
- borderColor: 'divider',
122
- borderRadius: 1,
123
- p: 2,
124
- '&:last-child': {
125
- mb: 5,
118
+ {tabs.map((tab) => {
119
+ if (!tab) {
120
+ return null;
121
+ }
122
+ return (
123
+ <Box
124
+ id={tab.value}
125
+ key={tab.value}
126
+ sx={mergeSx(
127
+ {
128
+ border: '1px solid',
129
+ borderColor: 'divider',
130
+ borderRadius: 1,
131
+ p: 2,
132
+ '&:last-child': {
133
+ mb: 5,
134
+ },
126
135
  },
127
- },
128
- tab.sx
129
- )}>
130
- <Typography
131
- sx={{
132
- color: 'text.primary',
133
- fontWeight: 600,
134
- }}>
135
- {tab.label}
136
- </Typography>
137
- <Box mt={2.5}>{tab.content}</Box>
138
- </Box>
139
- ))}
136
+ tab.sx
137
+ )}>
138
+ <Typography
139
+ sx={{
140
+ color: 'text.primary',
141
+ fontWeight: 600,
142
+ }}>
143
+ {tab.label}
144
+ </Typography>
145
+ <Box mt={2.5}>{tab.content}</Box>
146
+ </Box>
147
+ );
148
+ })}
140
149
  </Box>
141
150
  );
142
151
  }