@blocklet/ui-react 2.12.59 → 2.12.61

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.
@@ -166,17 +166,18 @@ export default function UserCenter({
166
166
  }
167
167
  }, []);
168
168
  const defaultTabs = useCreation(() => {
169
- let tabs = [];
169
+ const nftTab = {
170
+ label: t("common.nft"),
171
+ protected: false,
172
+ isPrivate: false,
173
+ // true: 隐私数据,仅自己可见
174
+ value: nftsLink,
175
+ url: getLink(nftsLink, locale)
176
+ };
177
+ let tabs = [nftTab];
170
178
  if (isMyself) {
171
179
  tabs = [
172
- {
173
- label: t("common.nft"),
174
- protected: true,
175
- isPrivate: true,
176
- // 隐私数据,仅自己可见
177
- value: nftsLink,
178
- url: getLink(nftsLink, locale)
179
- },
180
+ nftTab,
180
181
  {
181
182
  label: t("common.setting"),
182
183
  protected: true,
@@ -206,7 +207,7 @@ export default function UserCenter({
206
207
  label: x.title || x.label,
207
208
  url: x.link || x.url,
208
209
  protected: privacyState?.data?.[value] ?? false,
209
- isPrivate: x.isPrivate || x.private || x._rawLink.includes("/customer")
210
+ isPrivate: x.isPrivate || x.private || (x?._rawLink?.includes("/customer") ?? false)
210
211
  // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
211
212
  // icon: x.icon,
212
213
  };
@@ -263,7 +264,7 @@ export default function UserCenter({
263
264
  }
264
265
  });
265
266
  const renderDefaultTab = useCreation(() => {
266
- if (isNftsTab && isMyself) {
267
+ if (isNftsTab) {
267
268
  return /* @__PURE__ */ jsxs(
268
269
  Box,
269
270
  {
@@ -273,7 +274,7 @@ export default function UserCenter({
273
274
  gap: 2.5
274
275
  },
275
276
  children: [
276
- /* @__PURE__ */ jsxs(Box, { sx: { border: `1px solid ${colors.dividerColor}`, borderRadius: 2, p: 2 }, children: [
277
+ isMyself ? /* @__PURE__ */ jsxs(Box, { sx: { border: `1px solid ${colors.dividerColor}`, borderRadius: 2, p: 2 }, children: [
277
278
  /* @__PURE__ */ jsx(
278
279
  Typography,
279
280
  {
@@ -286,7 +287,7 @@ export default function UserCenter({
286
287
  }
287
288
  ),
288
289
  /* @__PURE__ */ jsx(Passport, { user: userState.data })
289
- ] }),
290
+ ] }) : null,
290
291
  /* @__PURE__ */ jsx(Nft, { user: userState.data })
291
292
  ]
292
293
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "2.12.59",
3
+ "version": "2.12.61",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -33,8 +33,8 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@abtnode/constant": "^1.16.41",
36
- "@arcblock/bridge": "^2.12.59",
37
- "@arcblock/react-hooks": "^2.12.59",
36
+ "@arcblock/bridge": "^2.12.61",
37
+ "@arcblock/react-hooks": "^2.12.61",
38
38
  "@arcblock/ws": "^1.19.18",
39
39
  "@blocklet/did-space-react": "^1.0.41",
40
40
  "@iconify-icons/logos": "^1.2.36",
@@ -87,5 +87,5 @@
87
87
  "jest": "^29.7.0",
88
88
  "unbuild": "^2.0.0"
89
89
  },
90
- "gitHead": "01a024341e2608cf33a91060b9a5f25e7773b268"
90
+ "gitHead": "ba8229f0a4a824a565e04056b78130c75b5bae14"
91
91
  }
@@ -40,6 +40,15 @@ const nftsLink = joinURL(PROFILE_URL, '/nfts');
40
40
  const settingsLink = joinURL(PROFILE_URL, '/settings');
41
41
  const didSpacesLink = joinURL(PROFILE_URL, '/did-spaces');
42
42
 
43
+ interface NavigationTabProps {
44
+ label: string;
45
+ protected: boolean;
46
+ isPrivate: boolean;
47
+ value: string;
48
+ url: string;
49
+ [key: string]: any;
50
+ }
51
+
43
52
  const Main = styled(Box)(({ theme }) => ({
44
53
  flex: 1,
45
54
  boxSizing: 'border-box',
@@ -198,17 +207,18 @@ export default function UserCenter({
198
207
  }
199
208
  }, []);
200
209
 
201
- const defaultTabs = useCreation((): any => {
202
- let tabs: any = [];
210
+ const defaultTabs = useCreation((): NavigationTabProps[] => {
211
+ const nftTab = {
212
+ label: t('common.nft'),
213
+ protected: false,
214
+ isPrivate: false, // true: 隐私数据,仅自己可见
215
+ value: nftsLink,
216
+ url: getLink(nftsLink, locale),
217
+ };
218
+ let tabs: NavigationTabProps[] = [nftTab];
203
219
  if (isMyself) {
204
220
  tabs = [
205
- {
206
- label: t('common.nft'),
207
- protected: true,
208
- isPrivate: true, // 隐私数据,仅自己可见
209
- value: nftsLink,
210
- url: getLink(nftsLink, locale),
211
- },
221
+ nftTab,
212
222
  {
213
223
  label: t('common.setting'),
214
224
  protected: true,
@@ -241,7 +251,7 @@ export default function UserCenter({
241
251
  label: x.title || x.label,
242
252
  url: x.link || x.url,
243
253
  protected: privacyState?.data?.[value] ?? false,
244
- isPrivate: x.isPrivate || x.private || x._rawLink.includes('/customer'), // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
254
+ isPrivate: x.isPrivate || x.private || (x?._rawLink?.includes('/customer') ?? false), // FIXME: HACK: 隐藏 /customer 菜单, 需要一个通用的解决方案,在嵌入的时候就决定是否是私有的
245
255
  // icon: x.icon,
246
256
  };
247
257
  })
@@ -309,7 +319,7 @@ export default function UserCenter({
309
319
  });
310
320
 
311
321
  const renderDefaultTab = useCreation(() => {
312
- if (isNftsTab && isMyself) {
322
+ if (isNftsTab) {
313
323
  return (
314
324
  <Box
315
325
  sx={{
@@ -317,17 +327,19 @@ export default function UserCenter({
317
327
  flexDirection: 'column',
318
328
  gap: 2.5,
319
329
  }}>
320
- <Box sx={{ border: `1px solid ${colors.dividerColor}`, borderRadius: 2, p: 2 }}>
321
- <Typography
322
- sx={{
323
- color: colors.foregroundsFgBase,
324
- fontWeight: 600,
325
- mb: 2.5,
326
- }}>
327
- {t('passport')}
328
- </Typography>
329
- <Passport user={userState.data as User} />
330
- </Box>
330
+ {isMyself ? (
331
+ <Box sx={{ border: `1px solid ${colors.dividerColor}`, borderRadius: 2, p: 2 }}>
332
+ <Typography
333
+ sx={{
334
+ color: colors.foregroundsFgBase,
335
+ fontWeight: 600,
336
+ mb: 2.5,
337
+ }}>
338
+ {t('passport')}
339
+ </Typography>
340
+ <Passport user={userState.data as User} />
341
+ </Box>
342
+ ) : null}
331
343
  <Nft user={userState.data as User} />
332
344
  </Box>
333
345
  );