@blocklet/ui-react 2.9.19 → 2.9.20
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.
- package/es/UserCenter/components/user-center.d.ts +2 -1
- package/es/UserCenter/components/user-center.js +8 -4
- package/lib/UserCenter/components/user-center.d.ts +2 -1
- package/lib/UserCenter/components/user-center.js +10 -6
- package/package.json +4 -4
- package/src/UserCenter/components/user-center.tsx +9 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PaperProps } from '@mui/material';
|
|
3
|
-
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, }: {
|
|
3
|
+
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, }: {
|
|
4
4
|
readonly children: any;
|
|
5
5
|
readonly currentTab: string;
|
|
6
6
|
readonly contentProps?: PaperProps;
|
|
@@ -9,4 +9,5 @@ export default function UserCenter({ children, currentTab, contentProps, disable
|
|
|
9
9
|
readonly hideFooter?: boolean;
|
|
10
10
|
readonly headerProps?: object;
|
|
11
11
|
readonly footerProps?: object;
|
|
12
|
+
readonly userDid?: string;
|
|
12
13
|
}): import("react").JSX.Element | null;
|
|
@@ -28,7 +28,8 @@ export default function UserCenter({
|
|
|
28
28
|
autoPopupSetting = false,
|
|
29
29
|
hideFooter = false,
|
|
30
30
|
headerProps = {},
|
|
31
|
-
footerProps = {}
|
|
31
|
+
footerProps = {},
|
|
32
|
+
userDid
|
|
32
33
|
}) {
|
|
33
34
|
const { locale } = useLocaleContext();
|
|
34
35
|
const t = useMemoizedFn((key, data = {}) => {
|
|
@@ -37,6 +38,9 @@ export default function UserCenter({
|
|
|
37
38
|
const sessionCtx = useContext(SessionContext);
|
|
38
39
|
const session = sessionCtx?.session;
|
|
39
40
|
const currentDid = useCreation(() => {
|
|
41
|
+
if (userDid) {
|
|
42
|
+
return userDid;
|
|
43
|
+
}
|
|
40
44
|
const currentUrl = window.location.href;
|
|
41
45
|
const query = getQuery(currentUrl);
|
|
42
46
|
if (query?.did) {
|
|
@@ -46,7 +50,7 @@ export default function UserCenter({
|
|
|
46
50
|
return query.did;
|
|
47
51
|
}
|
|
48
52
|
return session?.user?.did;
|
|
49
|
-
}, [session?.user?.did]);
|
|
53
|
+
}, [session?.user?.did, userDid]);
|
|
50
54
|
const isMyself = useCreation(() => {
|
|
51
55
|
if (session?.user) {
|
|
52
56
|
return currentDid === session?.user?.did;
|
|
@@ -251,11 +255,11 @@ export default function UserCenter({
|
|
|
251
255
|
) : null,
|
|
252
256
|
isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
253
257
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
254
|
-
/* @__PURE__ */ jsx(Typography, { variant: "
|
|
258
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
|
|
255
259
|
/* @__PURE__ */ jsx(Passport, { user: userState.data })
|
|
256
260
|
] }),
|
|
257
261
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
258
|
-
/* @__PURE__ */ jsx(Typography, { variant: "
|
|
262
|
+
/* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600, mb: 1.5 }, children: t("userInfo") }),
|
|
259
263
|
/* @__PURE__ */ jsx(
|
|
260
264
|
UserInfo,
|
|
261
265
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PaperProps } from '@mui/material';
|
|
3
|
-
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, }: {
|
|
3
|
+
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, userDid, }: {
|
|
4
4
|
readonly children: any;
|
|
5
5
|
readonly currentTab: string;
|
|
6
6
|
readonly contentProps?: PaperProps;
|
|
@@ -9,4 +9,5 @@ export default function UserCenter({ children, currentTab, contentProps, disable
|
|
|
9
9
|
readonly hideFooter?: boolean;
|
|
10
10
|
readonly headerProps?: object;
|
|
11
11
|
readonly footerProps?: object;
|
|
12
|
+
readonly userDid?: string;
|
|
12
13
|
}): import("react").JSX.Element | null;
|
|
@@ -35,7 +35,8 @@ function UserCenter({
|
|
|
35
35
|
autoPopupSetting = false,
|
|
36
36
|
hideFooter = false,
|
|
37
37
|
headerProps = {},
|
|
38
|
-
footerProps = {}
|
|
38
|
+
footerProps = {},
|
|
39
|
+
userDid
|
|
39
40
|
}) {
|
|
40
41
|
const {
|
|
41
42
|
locale
|
|
@@ -46,6 +47,9 @@ function UserCenter({
|
|
|
46
47
|
const sessionCtx = (0, _react.useContext)(_Session.SessionContext);
|
|
47
48
|
const session = sessionCtx?.session;
|
|
48
49
|
const currentDid = (0, _ahooks.useCreation)(() => {
|
|
50
|
+
if (userDid) {
|
|
51
|
+
return userDid;
|
|
52
|
+
}
|
|
49
53
|
const currentUrl = window.location.href;
|
|
50
54
|
const query = (0, _ufo.getQuery)(currentUrl);
|
|
51
55
|
if (query?.did) {
|
|
@@ -55,7 +59,7 @@ function UserCenter({
|
|
|
55
59
|
return query.did;
|
|
56
60
|
}
|
|
57
61
|
return session?.user?.did;
|
|
58
|
-
}, [session?.user?.did]);
|
|
62
|
+
}, [session?.user?.did, userDid]);
|
|
59
63
|
const isMyself = (0, _ahooks.useCreation)(() => {
|
|
60
64
|
if (session?.user) {
|
|
61
65
|
return currentDid === session?.user?.did;
|
|
@@ -266,9 +270,9 @@ function UserCenter({
|
|
|
266
270
|
}) : null, isMyself ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
267
271
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
268
272
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
269
|
-
variant: "
|
|
273
|
+
variant: "h6",
|
|
270
274
|
sx: {
|
|
271
|
-
fontWeight:
|
|
275
|
+
fontWeight: 600,
|
|
272
276
|
mb: 1.5
|
|
273
277
|
},
|
|
274
278
|
children: t("passport")
|
|
@@ -277,9 +281,9 @@ function UserCenter({
|
|
|
277
281
|
})]
|
|
278
282
|
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
279
283
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
280
|
-
variant: "
|
|
284
|
+
variant: "h6",
|
|
281
285
|
sx: {
|
|
282
|
-
fontWeight:
|
|
286
|
+
fontWeight: 600,
|
|
283
287
|
mb: 1.5
|
|
284
288
|
},
|
|
285
289
|
children: t("userInfo")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.20",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@abtnode/constant": "1.16.23-beta-aeb9f5bd",
|
|
66
|
-
"@arcblock/did-connect": "^2.9.
|
|
67
|
-
"@arcblock/ux": "^2.9.
|
|
66
|
+
"@arcblock/did-connect": "^2.9.20",
|
|
67
|
+
"@arcblock/ux": "^2.9.20",
|
|
68
68
|
"@blocklet/js-sdk": "1.16.23-beta-aeb9f5bd",
|
|
69
69
|
"@emotion/react": "^11.10.4",
|
|
70
70
|
"@emotion/styled": "^11.10.4",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"jest": "^28.1.3",
|
|
99
99
|
"unbuild": "^2.0.0"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "56354c3f25c0d62ae39d79f07c648a7c0d9e66f7"
|
|
102
102
|
}
|
|
@@ -36,6 +36,7 @@ export default function UserCenter({
|
|
|
36
36
|
hideFooter = false,
|
|
37
37
|
headerProps = {},
|
|
38
38
|
footerProps = {},
|
|
39
|
+
userDid,
|
|
39
40
|
}: {
|
|
40
41
|
readonly children: any;
|
|
41
42
|
readonly currentTab: string;
|
|
@@ -45,6 +46,7 @@ export default function UserCenter({
|
|
|
45
46
|
readonly hideFooter?: boolean;
|
|
46
47
|
readonly headerProps?: object;
|
|
47
48
|
readonly footerProps?: object;
|
|
49
|
+
readonly userDid?: string;
|
|
48
50
|
}) {
|
|
49
51
|
const { locale } = useLocaleContext();
|
|
50
52
|
const t = useMemoizedFn((key, data = {}) => {
|
|
@@ -54,6 +56,10 @@ export default function UserCenter({
|
|
|
54
56
|
const session = sessionCtx?.session;
|
|
55
57
|
|
|
56
58
|
const currentDid = useCreation(() => {
|
|
59
|
+
if (userDid) {
|
|
60
|
+
return userDid;
|
|
61
|
+
}
|
|
62
|
+
|
|
57
63
|
const currentUrl = window.location.href;
|
|
58
64
|
const query = getQuery(currentUrl);
|
|
59
65
|
if (query?.did) {
|
|
@@ -63,7 +69,7 @@ export default function UserCenter({
|
|
|
63
69
|
return query.did;
|
|
64
70
|
}
|
|
65
71
|
return session?.user?.did;
|
|
66
|
-
}, [session?.user?.did]);
|
|
72
|
+
}, [session?.user?.did, userDid]);
|
|
67
73
|
|
|
68
74
|
const isMyself = useCreation(() => {
|
|
69
75
|
if (session?.user) {
|
|
@@ -284,13 +290,13 @@ export default function UserCenter({
|
|
|
284
290
|
{isMyself ? (
|
|
285
291
|
<>
|
|
286
292
|
<Box>
|
|
287
|
-
<Typography variant="
|
|
293
|
+
<Typography variant="h6" sx={{ fontWeight: 600, mb: 1.5 }}>
|
|
288
294
|
{t('passport')}
|
|
289
295
|
</Typography>
|
|
290
296
|
<Passport user={userState.data} />
|
|
291
297
|
</Box>
|
|
292
298
|
<Box>
|
|
293
|
-
<Typography variant="
|
|
299
|
+
<Typography variant="h6" sx={{ fontWeight: 600, mb: 1.5 }}>
|
|
294
300
|
{t('userInfo')}
|
|
295
301
|
</Typography>
|
|
296
302
|
<UserInfo
|