@blocklet/ui-react 2.9.22 → 2.9.24
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/Footer/index.js +12 -2
- package/es/Header/index.js +5 -1
- package/es/UserCenter/components/passport.d.ts +2 -2
- package/es/UserCenter/components/passport.js +44 -29
- package/es/UserCenter/components/user-basic-info.d.ts +3 -2
- package/es/UserCenter/components/user-basic-info.js +6 -11
- package/es/UserCenter/components/user-center.d.ts +2 -2
- package/es/UserCenter/components/user-center.js +160 -100
- package/es/UserCenter/components/user-info-item.js +12 -21
- package/es/UserCenter/components/user-info.d.ts +2 -2
- package/es/UserCenter/components/user-info.js +13 -16
- package/es/UserCenter/libs/locales.d.ts +6 -0
- package/es/UserCenter/libs/locales.js +8 -2
- package/lib/Footer/index.js +7 -2
- package/lib/Header/index.js +7 -1
- package/lib/UserCenter/components/passport.d.ts +2 -2
- package/lib/UserCenter/components/passport.js +17 -10
- package/lib/UserCenter/components/user-basic-info.d.ts +3 -2
- package/lib/UserCenter/components/user-basic-info.js +8 -11
- package/lib/UserCenter/components/user-center.d.ts +2 -2
- package/lib/UserCenter/components/user-center.js +135 -95
- package/lib/UserCenter/components/user-info-item.js +8 -16
- package/lib/UserCenter/components/user-info.d.ts +2 -2
- package/lib/UserCenter/components/user-info.js +18 -17
- package/lib/UserCenter/libs/locales.d.ts +6 -0
- package/lib/UserCenter/libs/locales.js +8 -2
- package/package.json +4 -4
- package/src/Footer/index.jsx +9 -3
- package/src/Header/index.jsx +6 -2
- package/src/UserCenter/components/passport.tsx +23 -9
- package/src/UserCenter/components/user-basic-info.tsx +8 -12
- package/src/UserCenter/components/user-center.tsx +147 -101
- package/src/UserCenter/components/user-info-item.tsx +6 -14
- package/src/UserCenter/components/user-info.tsx +18 -25
- package/src/UserCenter/libs/locales.ts +7 -1
package/es/Footer/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import { styled } from "@arcblock/ux/lib/Theme";
|
|
|
5
5
|
import { withErrorBoundary } from "react-error-boundary";
|
|
6
6
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
7
|
import { ErrorFallback } from "@arcblock/ux/lib/ErrorBoundary";
|
|
8
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
9
|
+
import omit from "lodash/omit";
|
|
8
10
|
import OverridableThemeProvider from "../common/overridable-theme-provider.js";
|
|
9
11
|
import InternalFooter from "./internal-footer.js";
|
|
10
12
|
import { mapRecursive } from "../utils.js";
|
|
@@ -49,7 +51,15 @@ function Footer({ meta, theme: themeOverrides, ...rest }) {
|
|
|
49
51
|
socialMedia: localized.socialMedia,
|
|
50
52
|
links: localized.links.map((item) => ({ ...item, label: item.title }))
|
|
51
53
|
};
|
|
52
|
-
return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(
|
|
54
|
+
return /* @__PURE__ */ jsx(OverridableThemeProvider, { theme: themeOverrides, children: /* @__PURE__ */ jsx(
|
|
55
|
+
StyledInternalFooter,
|
|
56
|
+
{
|
|
57
|
+
...props,
|
|
58
|
+
...omit(rest, ["bordered"]),
|
|
59
|
+
$bordered: rest?.bordered,
|
|
60
|
+
$bgcolor: theme?.background?.footer
|
|
61
|
+
}
|
|
62
|
+
) });
|
|
53
63
|
}
|
|
54
64
|
Footer.propTypes = {
|
|
55
65
|
meta: blockletMetaProps,
|
|
@@ -61,7 +71,7 @@ Footer.defaultProps = {
|
|
|
61
71
|
theme: null
|
|
62
72
|
};
|
|
63
73
|
const StyledInternalFooter = styled(InternalFooter)`
|
|
64
|
-
border-top: 1px solid #eee
|
|
74
|
+
${({ $bordered }) => `border-top: 1px solid ${$bordered ? colors.strokeSep : "#eee"};`}
|
|
65
75
|
color: ${(props) => props.theme.palette.grey[600]};
|
|
66
76
|
${({ $bgcolor }) => $bgcolor && `background-color: ${$bgcolor};`}
|
|
67
77
|
font-family: Inter, Avenir, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif,
|
package/es/Header/index.js
CHANGED
|
@@ -7,6 +7,8 @@ import { styled } from "@arcblock/ux/lib/Theme";
|
|
|
7
7
|
import { ResponsiveHeader } from "@arcblock/ux/lib/Header";
|
|
8
8
|
import NavMenu from "@arcblock/ux/lib/NavMenu";
|
|
9
9
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
10
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
11
|
+
import omit from "lodash/omit";
|
|
10
12
|
import Icon from "../Icon/index.js";
|
|
11
13
|
import OverridableThemeProvider from "../common/overridable-theme-provider.js";
|
|
12
14
|
import { blockletMetaProps, sessionManagerProps } from "../types.js";
|
|
@@ -75,7 +77,8 @@ function Header({ meta, addons, sessionManagerProps: sessionManagerProps2, homeL
|
|
|
75
77
|
homeLink,
|
|
76
78
|
logo: /* @__PURE__ */ jsx("img", { src: appLogoRect || appLogo, alt: "logo" }),
|
|
77
79
|
addons: headerAddons,
|
|
78
|
-
...rest,
|
|
80
|
+
...omit(rest, ["bordered"]),
|
|
81
|
+
$bordered: rest?.bordered,
|
|
79
82
|
$bgcolor: theme?.background?.header,
|
|
80
83
|
children: !navItems?.length ? null : ({ isMobile }) => /* @__PURE__ */ jsx(
|
|
81
84
|
NavMenu,
|
|
@@ -118,6 +121,7 @@ const StyledUxHeader = styled(ResponsiveHeader)`
|
|
|
118
121
|
.header-logo {
|
|
119
122
|
min-width: 44px;
|
|
120
123
|
}
|
|
124
|
+
${({ $bordered }) => $bordered ? `border-bottom: 1px solid ${colors.strokeSep};` : ""}
|
|
121
125
|
${(props) => props.theme.breakpoints.down("md")} {
|
|
122
126
|
.header-logo {
|
|
123
127
|
min-width: 32px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { BoxProps } from '@mui/material';
|
|
3
3
|
import type { User } from '../../@types';
|
|
4
4
|
export default function Passport({ user, ...rest }: {
|
|
5
5
|
user: User;
|
|
6
|
-
} &
|
|
6
|
+
} & BoxProps): import("react").JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
3
|
import Empty from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useTheme } from "@arcblock/ux/lib/Theme";
|
|
5
5
|
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
@@ -39,36 +39,51 @@ export default function Passport({ user, ...rest }) {
|
|
|
39
39
|
return theme?.palette?.primary?.main || colors.textBase;
|
|
40
40
|
}, [theme?.palette?.primary?.main]);
|
|
41
41
|
if (passports.length === 0) {
|
|
42
|
-
return /* @__PURE__ */ jsx(Empty, { children: t("noPassport") });
|
|
42
|
+
return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("noPassport") }) });
|
|
43
43
|
}
|
|
44
|
-
return /* @__PURE__ */ jsx(
|
|
45
|
-
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
45
|
+
Box,
|
|
46
46
|
{
|
|
47
|
-
|
|
48
|
-
user,
|
|
49
|
-
width: 200,
|
|
50
|
-
color: window.blocklet.passportColor,
|
|
51
|
-
createPassportSvg,
|
|
52
|
-
title: currentRole && currentRole.role === x.role ? t("currentPassport") : "",
|
|
47
|
+
...rest,
|
|
53
48
|
sx: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
height: 166,
|
|
60
|
-
borderRadius: 2,
|
|
61
|
-
px: 2,
|
|
62
|
-
display: "flex",
|
|
63
|
-
justifyContent: "center",
|
|
64
|
-
backgroundColor: "white",
|
|
65
|
-
boxShadow: currentRole && currentRole.role === x.role ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important` : "0px 2px 4px 0px rgba(2, 7, 19, 0.04), 0px 1px 2px -1px rgba(2, 7, 19, 0.08), 0px 0px 0px 1px rgba(2, 7, 19, 0.08) !important"
|
|
49
|
+
display: "grid",
|
|
50
|
+
gridTemplateColumns: {
|
|
51
|
+
xs: "repeat(2, 1fr)",
|
|
52
|
+
sm: "repeat(3, 1fr)",
|
|
53
|
+
md: "repeat(2, 1fr)"
|
|
66
54
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
gap: 2.5,
|
|
56
|
+
...rest.sx
|
|
57
|
+
},
|
|
58
|
+
children: passports.map((x) => /* @__PURE__ */ jsx(
|
|
59
|
+
PassportItem,
|
|
60
|
+
{
|
|
61
|
+
passport: x,
|
|
62
|
+
user,
|
|
63
|
+
color: window.blocklet.passportColor,
|
|
64
|
+
createPassportSvg,
|
|
65
|
+
title: currentRole && currentRole.role === x.role ? t("currentPassport") : "",
|
|
66
|
+
sx: {
|
|
67
|
+
flexDirection: "column",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
gap: 1,
|
|
70
|
+
".passport-item__display": {
|
|
71
|
+
width: 166,
|
|
72
|
+
height: 166,
|
|
73
|
+
borderRadius: 2,
|
|
74
|
+
px: 2,
|
|
75
|
+
display: "flex",
|
|
76
|
+
justifyContent: "center",
|
|
77
|
+
backgroundColor: colors.backgroundsBgComponent,
|
|
78
|
+
boxShadow: currentRole && currentRole.role === x.role ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important` : "unset"
|
|
79
|
+
},
|
|
80
|
+
".passport-item__body": {
|
|
81
|
+
marginLeft: "0 !important"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
x.id
|
|
86
|
+
))
|
|
87
|
+
}
|
|
88
|
+
);
|
|
74
89
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { BoxProps } from '@mui/material';
|
|
3
3
|
import type { User } from '../../@types';
|
|
4
|
-
export default function UserBasicInfo({ user, isMyself, switchPassport, switchProfile, openSettings, ...rest }: {
|
|
4
|
+
export default function UserBasicInfo({ user, isMyself, showFullDid, switchPassport, switchProfile, openSettings, ...rest }: {
|
|
5
5
|
user: User;
|
|
6
|
-
isMyself
|
|
6
|
+
isMyself?: boolean;
|
|
7
|
+
showFullDid?: boolean;
|
|
7
8
|
switchPassport: () => void;
|
|
8
9
|
switchProfile: () => void;
|
|
9
10
|
openSettings: () => void;
|
|
@@ -15,6 +15,7 @@ import { translations } from "../libs/locales.js";
|
|
|
15
15
|
export default function UserBasicInfo({
|
|
16
16
|
user,
|
|
17
17
|
isMyself = true,
|
|
18
|
+
showFullDid = true,
|
|
18
19
|
switchPassport,
|
|
19
20
|
switchProfile,
|
|
20
21
|
openSettings,
|
|
@@ -52,6 +53,7 @@ export default function UserBasicInfo({
|
|
|
52
53
|
backgroundColor: "#fff",
|
|
53
54
|
position: "relative",
|
|
54
55
|
overflow: "hidden",
|
|
56
|
+
mb: 1.5,
|
|
55
57
|
...isMyself ? {
|
|
56
58
|
cursor: "pointer",
|
|
57
59
|
"&:hover": {
|
|
@@ -80,7 +82,7 @@ export default function UserBasicInfo({
|
|
|
80
82
|
/* @__PURE__ */ jsxs(
|
|
81
83
|
Typography,
|
|
82
84
|
{
|
|
83
|
-
variant: "
|
|
85
|
+
variant: "h6",
|
|
84
86
|
sx: {
|
|
85
87
|
fontWeight: "bold",
|
|
86
88
|
display: "flex",
|
|
@@ -102,7 +104,7 @@ export default function UserBasicInfo({
|
|
|
102
104
|
fontSize: "12px",
|
|
103
105
|
color: colors.textBase,
|
|
104
106
|
borderColor: colors.strokeBorderStrong,
|
|
105
|
-
backgroundColor: "
|
|
107
|
+
backgroundColor: "transparent",
|
|
106
108
|
textTransform: "capitalize",
|
|
107
109
|
pr: 1,
|
|
108
110
|
pl: 0.5,
|
|
@@ -122,7 +124,7 @@ export default function UserBasicInfo({
|
|
|
122
124
|
]
|
|
123
125
|
}
|
|
124
126
|
),
|
|
125
|
-
/* @__PURE__ */ jsx(DID, { did: user.did, copyable: false }),
|
|
127
|
+
/* @__PURE__ */ jsx(DID, { did: user.did, copyable: false, compact: !showFullDid, responsive: !showFullDid }),
|
|
126
128
|
isMyself ? /* @__PURE__ */ jsx(
|
|
127
129
|
IconButton,
|
|
128
130
|
{
|
|
@@ -132,14 +134,7 @@ export default function UserBasicInfo({
|
|
|
132
134
|
backgroundColor: "white",
|
|
133
135
|
border: `1px solid ${colors.strokeBorderBase}`,
|
|
134
136
|
position: "absolute",
|
|
135
|
-
|
|
136
|
-
xs: "unset",
|
|
137
|
-
md: 0
|
|
138
|
-
},
|
|
139
|
-
top: {
|
|
140
|
-
xs: 0,
|
|
141
|
-
md: "unset"
|
|
142
|
-
},
|
|
137
|
+
top: 0,
|
|
143
138
|
right: 0
|
|
144
139
|
},
|
|
145
140
|
disableFocusRipple: true,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { BoxProps } from '@mui/material';
|
|
3
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
|
-
readonly contentProps?:
|
|
6
|
+
readonly contentProps?: BoxProps;
|
|
7
7
|
readonly disableAutoRedirect?: boolean;
|
|
8
8
|
readonly autoPopupSetting?: boolean;
|
|
9
9
|
readonly hideFooter?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext } from "react";
|
|
3
|
-
import { Box, CircularProgress,
|
|
3
|
+
import { Box, CircularProgress, Typography } from "@mui/material";
|
|
4
4
|
import { useCreation, useMemoizedFn, useMount, useRequest } from "ahooks";
|
|
5
5
|
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
6
6
|
import Tabs from "@arcblock/ux/lib/Tabs";
|
|
@@ -147,7 +147,6 @@ export default function UserCenter({
|
|
|
147
147
|
settings: {
|
|
148
148
|
userCenterTabs
|
|
149
149
|
},
|
|
150
|
-
sx: { mt: -2 },
|
|
151
150
|
onSave: async () => {
|
|
152
151
|
await privacyState.runAsync();
|
|
153
152
|
return privacyState.data;
|
|
@@ -175,106 +174,148 @@ export default function UserCenter({
|
|
|
175
174
|
};
|
|
176
175
|
return /* @__PURE__ */ jsx(ErrorFallback, { error: formatError });
|
|
177
176
|
}
|
|
178
|
-
return /* @__PURE__ */ jsxs(
|
|
179
|
-
Box,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
177
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
178
|
+
/* @__PURE__ */ jsxs(Box, { sx: { flex: 1 }, children: [
|
|
179
|
+
userState?.data?.fullName ? /* @__PURE__ */ jsx(
|
|
180
|
+
Typography,
|
|
181
|
+
{
|
|
182
|
+
variant: "h4",
|
|
183
|
+
sx: {
|
|
184
|
+
py: 1.5,
|
|
185
|
+
fontWeight: 700,
|
|
186
|
+
display: {
|
|
187
|
+
xs: "none",
|
|
188
|
+
md: "block"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
children: userState.data.fullName
|
|
192
|
+
}
|
|
193
|
+
) : null,
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
UserBasicInfo,
|
|
196
|
+
{
|
|
197
|
+
isMyself,
|
|
198
|
+
switchPassport: session.switchPassport,
|
|
199
|
+
switchProfile: session.switchProfile,
|
|
200
|
+
openSettings,
|
|
201
|
+
user: userState.data,
|
|
202
|
+
showFullDid: false,
|
|
203
|
+
sx: {
|
|
204
|
+
display: {
|
|
205
|
+
md: "none",
|
|
206
|
+
xs: "block"
|
|
207
207
|
},
|
|
208
|
-
|
|
209
|
-
/* @__PURE__ */ jsx(Tabs, { variant: "card", tabs: userCenterTabs, current: currentTab, onChange: handleChangeTab }),
|
|
210
|
-
!privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
|
|
211
|
-
Box,
|
|
212
|
-
{
|
|
213
|
-
sx: {
|
|
214
|
-
height: "100%",
|
|
215
|
-
minWidth: "160px",
|
|
216
|
-
minHeight: "160px",
|
|
217
|
-
display: "flex",
|
|
218
|
-
justifyContent: "center",
|
|
219
|
-
alignItems: "center"
|
|
220
|
-
},
|
|
221
|
-
children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
|
|
222
|
-
}
|
|
223
|
-
) : /* @__PURE__ */ jsx(Fragment, { children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Paper, { variant: "outlined", sx: { mt: 2, borderRadius: 2, p: 2 }, children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : /* @__PURE__ */ jsx(Fragment, { children: children && /* @__PURE__ */ jsx(
|
|
224
|
-
Paper,
|
|
225
|
-
{
|
|
226
|
-
...contentProps,
|
|
227
|
-
variant: "outlined",
|
|
228
|
-
sx: { mt: 2, borderRadius: 2, p: 2, ...contentProps?.sx },
|
|
229
|
-
children
|
|
230
|
-
}
|
|
231
|
-
) }) })
|
|
232
|
-
]
|
|
208
|
+
mb: 1.5
|
|
233
209
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
210
|
+
}
|
|
211
|
+
),
|
|
212
|
+
userCenterTabs.length > 0 && currentTab ? /* @__PURE__ */ jsxs(
|
|
213
|
+
Box,
|
|
214
|
+
{
|
|
215
|
+
sx: {
|
|
216
|
+
overflow: "auto",
|
|
217
|
+
padding: "1px"
|
|
218
|
+
},
|
|
219
|
+
children: [
|
|
220
|
+
/* @__PURE__ */ jsx(
|
|
221
|
+
Tabs,
|
|
245
222
|
{
|
|
246
|
-
variant: "
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}
|
|
251
|
-
children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
|
|
223
|
+
variant: "line",
|
|
224
|
+
tabs: userCenterTabs,
|
|
225
|
+
current: currentTab,
|
|
226
|
+
onChange: handleChangeTab,
|
|
227
|
+
sx: { mb: 1.5 }
|
|
252
228
|
}
|
|
253
|
-
)
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
257
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
258
|
-
/* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
|
|
259
|
-
/* @__PURE__ */ jsx(Passport, { user: userState.data })
|
|
260
|
-
] }),
|
|
261
|
-
/* @__PURE__ */ jsxs(Box, { children: [
|
|
262
|
-
/* @__PURE__ */ jsx(Typography, { variant: "h6", sx: { fontWeight: 600, mb: 1.5 }, children: t("userInfo") }),
|
|
263
|
-
/* @__PURE__ */ jsx(
|
|
264
|
-
UserInfo,
|
|
229
|
+
),
|
|
230
|
+
!privacyState.data || privacyState.loading ? /* @__PURE__ */ jsx(
|
|
231
|
+
Box,
|
|
265
232
|
{
|
|
266
|
-
user: userState.data,
|
|
267
233
|
sx: {
|
|
268
|
-
|
|
269
|
-
|
|
234
|
+
height: "100%",
|
|
235
|
+
minWidth: "160px",
|
|
236
|
+
minHeight: "160px",
|
|
237
|
+
display: "flex",
|
|
238
|
+
justifyContent: "center",
|
|
239
|
+
alignItems: "center"
|
|
240
|
+
},
|
|
241
|
+
children: /* @__PURE__ */ jsx(CircularProgress, { sx: { color: colors.primary100 } })
|
|
242
|
+
}
|
|
243
|
+
) : /* @__PURE__ */ jsx(Fragment, { children: currentActiveTab?.protected && !isMyself ? /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("underProtected") }) }) : /* @__PURE__ */ jsx(Fragment, { children: children && /* @__PURE__ */ jsx(Box, { ...contentProps, children }) }) })
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
) : null,
|
|
247
|
+
userCenterTabs.length === 0 ? /* @__PURE__ */ jsx(
|
|
248
|
+
Box,
|
|
249
|
+
{
|
|
250
|
+
sx: {
|
|
251
|
+
display: {
|
|
252
|
+
xs: isMyself ? "none" : "block",
|
|
253
|
+
md: "block"
|
|
254
|
+
},
|
|
255
|
+
py: 3
|
|
256
|
+
},
|
|
257
|
+
children: /* @__PURE__ */ jsx(Empty, { children: t("emptyContent") })
|
|
258
|
+
}
|
|
259
|
+
) : null
|
|
260
|
+
] }),
|
|
261
|
+
/* @__PURE__ */ jsx(
|
|
262
|
+
Box,
|
|
263
|
+
{
|
|
264
|
+
sx: {
|
|
265
|
+
display: {
|
|
266
|
+
xs: "none",
|
|
267
|
+
md: "block"
|
|
268
|
+
},
|
|
269
|
+
width: "1px",
|
|
270
|
+
my: -3,
|
|
271
|
+
backgroundColor: colors.strokeSep
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
),
|
|
275
|
+
/* @__PURE__ */ jsxs(
|
|
276
|
+
Box,
|
|
277
|
+
{
|
|
278
|
+
sx: {
|
|
279
|
+
width: {
|
|
280
|
+
sx: "100%",
|
|
281
|
+
md: 400
|
|
282
|
+
},
|
|
283
|
+
maxWidth: "100%",
|
|
284
|
+
display: "flex",
|
|
285
|
+
flexDirection: "column",
|
|
286
|
+
gap: 2.5
|
|
287
|
+
},
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ jsx(
|
|
290
|
+
UserBasicInfo,
|
|
291
|
+
{
|
|
292
|
+
isMyself,
|
|
293
|
+
switchPassport: session.switchPassport,
|
|
294
|
+
switchProfile: session.switchProfile,
|
|
295
|
+
openSettings,
|
|
296
|
+
user: userState.data,
|
|
297
|
+
sx: {
|
|
298
|
+
display: {
|
|
299
|
+
xs: "none",
|
|
300
|
+
md: "block"
|
|
270
301
|
}
|
|
271
302
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
303
|
+
}
|
|
304
|
+
),
|
|
305
|
+
isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
306
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
307
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("myInfo") }),
|
|
308
|
+
/* @__PURE__ */ jsx(UserInfo, { user: userState.data })
|
|
309
|
+
] }),
|
|
310
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
311
|
+
/* @__PURE__ */ jsx(Typography, { sx: { fontWeight: 600, mb: 1.5 }, children: t("passport") }),
|
|
312
|
+
/* @__PURE__ */ jsx(Passport, { user: userState.data })
|
|
313
|
+
] })
|
|
314
|
+
] }) : null
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] });
|
|
278
319
|
}, [userState, userCenterTabs]);
|
|
279
320
|
if (!disableAutoRedirect && !currentTab && formattedBlocklet?.navigation?.userCenter?.length > 0) {
|
|
280
321
|
window.location.replace(formattedBlocklet?.navigation?.userCenter[0]?.link);
|
|
@@ -290,12 +331,31 @@ export default function UserCenter({
|
|
|
290
331
|
flexDirection: "column"
|
|
291
332
|
},
|
|
292
333
|
children: [
|
|
293
|
-
/* @__PURE__ */ jsx(Header, { ...headerProps }),
|
|
294
|
-
/* @__PURE__ */ jsxs(
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
334
|
+
/* @__PURE__ */ jsx(Header, { bordered: true, ...headerProps }),
|
|
335
|
+
/* @__PURE__ */ jsxs(
|
|
336
|
+
Box,
|
|
337
|
+
{
|
|
338
|
+
flex: 1,
|
|
339
|
+
sx: {
|
|
340
|
+
width: "100%",
|
|
341
|
+
maxWidth: 1200,
|
|
342
|
+
margin: "0 auto",
|
|
343
|
+
p: 3,
|
|
344
|
+
display: "flex",
|
|
345
|
+
alignItems: "stretch",
|
|
346
|
+
flexDirection: {
|
|
347
|
+
xs: "column",
|
|
348
|
+
md: "row"
|
|
349
|
+
},
|
|
350
|
+
gap: 2.5
|
|
351
|
+
},
|
|
352
|
+
children: [
|
|
353
|
+
content,
|
|
354
|
+
confirmHolder
|
|
355
|
+
]
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
hideFooter ? null : /* @__PURE__ */ jsx(Footer, { bordered: true, ...footerProps })
|
|
299
359
|
]
|
|
300
360
|
}
|
|
301
361
|
);
|
|
@@ -7,35 +7,27 @@ export default function UserInfoItem({ data, ...rest }) {
|
|
|
7
7
|
{
|
|
8
8
|
...rest,
|
|
9
9
|
sx: {
|
|
10
|
-
display: "
|
|
11
|
-
gridTemplateColumns: "auto 1fr",
|
|
12
|
-
gridTemplateAreas: `"icon title" ". content"`,
|
|
10
|
+
display: "flex",
|
|
13
11
|
alignItems: "center",
|
|
14
|
-
|
|
15
|
-
columnGap: 1,
|
|
12
|
+
justifyContent: "space-between",
|
|
16
13
|
...rest.sx
|
|
17
14
|
},
|
|
18
15
|
children: [
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
Box,
|
|
21
|
-
{
|
|
22
|
-
sx: {
|
|
23
|
-
gridArea: "icon",
|
|
24
|
-
display: "flex",
|
|
25
|
-
alignItems: "center"
|
|
26
|
-
},
|
|
27
|
-
children: data.icon
|
|
28
|
-
}
|
|
29
|
-
),
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
16
|
+
/* @__PURE__ */ jsxs(
|
|
31
17
|
Typography,
|
|
32
18
|
{
|
|
33
19
|
sx: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
34
22
|
color: colors.textBase,
|
|
35
|
-
|
|
36
|
-
|
|
23
|
+
fontSize: "14px",
|
|
24
|
+
gap: 1,
|
|
25
|
+
fontWeight: 500
|
|
37
26
|
},
|
|
38
|
-
children:
|
|
27
|
+
children: [
|
|
28
|
+
data.icon,
|
|
29
|
+
data.title
|
|
30
|
+
]
|
|
39
31
|
}
|
|
40
32
|
),
|
|
41
33
|
/* @__PURE__ */ jsx(
|
|
@@ -44,7 +36,6 @@ export default function UserInfoItem({ data, ...rest }) {
|
|
|
44
36
|
sx: {
|
|
45
37
|
color: colors.textSubtitle,
|
|
46
38
|
whiteSpace: "pre-wrap",
|
|
47
|
-
gridArea: "content",
|
|
48
39
|
fontSize: "14px"
|
|
49
40
|
},
|
|
50
41
|
children: data.content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
2
|
+
import type { BoxProps } from '@mui/material';
|
|
3
3
|
import type { User } from '../../@types';
|
|
4
4
|
export default function UserInfo({ user, ...rest }: {
|
|
5
5
|
user: User;
|
|
6
|
-
} &
|
|
6
|
+
} & BoxProps): import("react").JSX.Element;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
3
|
import { Icon } from "@iconify/react";
|
|
4
4
|
import { useMemoizedFn, useCreation } from "ahooks";
|
|
5
5
|
import MailOutlineRoundedIcon from "@iconify-icons/material-symbols/mail-outline-rounded";
|
|
6
6
|
import ScheduleOutlineRoundedIcon from "@iconify-icons/material-symbols/schedule-outline-rounded";
|
|
7
7
|
import MoreTimeRoundedIcon from "@iconify-icons/material-symbols/more-time-rounded";
|
|
8
8
|
import CaptivePortalRoundedIcon from "@iconify-icons/material-symbols/captive-portal-rounded";
|
|
9
|
+
import SettingsInputAntennaRoundedIcon from "@iconify-icons/material-symbols/settings-input-antenna-rounded";
|
|
9
10
|
import RelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
10
11
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
11
12
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
@@ -34,12 +35,13 @@ export default function UserInfo({
|
|
|
34
35
|
});
|
|
35
36
|
userInfoListData.push({
|
|
36
37
|
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: ScheduleOutlineRoundedIcon }),
|
|
37
|
-
title: t("
|
|
38
|
-
content: /* @__PURE__ */ jsx(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
title: t("lastLoginAt"),
|
|
39
|
+
content: user?.lastLoginAt ? /* @__PURE__ */ jsx(RelativeTime, { locale, value: user?.lastLoginAt, relativeRange: 3 * 86400 * 1e3 }) : t("unknown")
|
|
40
|
+
});
|
|
41
|
+
userInfoListData.push({
|
|
42
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: SettingsInputAntennaRoundedIcon }),
|
|
43
|
+
title: t("lastLoginIp"),
|
|
44
|
+
content: user?.lastLoginIp || t("unknown")
|
|
43
45
|
});
|
|
44
46
|
userInfoListData.push({
|
|
45
47
|
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: MoreTimeRoundedIcon }),
|
|
@@ -52,18 +54,13 @@ export default function UserInfo({
|
|
|
52
54
|
content: readableProvider
|
|
53
55
|
});
|
|
54
56
|
return /* @__PURE__ */ jsx(
|
|
55
|
-
|
|
57
|
+
Box,
|
|
56
58
|
{
|
|
57
|
-
variant: "outlined",
|
|
58
59
|
...rest,
|
|
59
60
|
sx: {
|
|
60
61
|
display: "flex",
|
|
61
|
-
flexDirection:
|
|
62
|
-
|
|
63
|
-
md: "row"
|
|
64
|
-
},
|
|
65
|
-
alignItems: "flex-start",
|
|
66
|
-
gap: 3,
|
|
62
|
+
flexDirection: "column",
|
|
63
|
+
gap: 1.5,
|
|
67
64
|
...rest?.sx
|
|
68
65
|
},
|
|
69
66
|
children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 } }, item.title))
|