@blocklet/ui-react 2.9.91 → 2.10.1
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/build.config.ts +1 -6
- package/lib/@types/index.d.ts +1 -0
- package/lib/@types/index.js +0 -1
- package/lib/BlockletStudio/index.js +50 -50
- package/lib/ComponentInstaller/index.js +122 -202
- package/lib/ComponentInstaller/installer-item.js +116 -138
- package/lib/ComponentInstaller/locales.js +5 -10
- package/lib/ComponentInstaller/use-component-installed.js +37 -41
- package/lib/ComponentManager/components/add-component.js +58 -67
- package/lib/ComponentManager/components/check-component.js +2 -9
- package/lib/ComponentManager/components/publish-component.js +50 -59
- package/lib/ComponentManager/components/resource-dialog.js +42 -39
- package/lib/ComponentManager/index.js +3 -27
- package/lib/ComponentManager/libs/locales.js +2 -8
- package/lib/Dashboard/index.js +74 -99
- package/lib/Footer/brand.js +21 -43
- package/lib/Footer/copyright.js +15 -24
- package/lib/Footer/index.js +47 -71
- package/lib/Footer/internal-footer.js +72 -100
- package/lib/Footer/layout/plain.js +26 -45
- package/lib/Footer/layout/row.js +12 -29
- package/lib/Footer/layout/standard.js +34 -64
- package/lib/Footer/links.js +74 -104
- package/lib/Footer/social-media.js +35 -42
- package/lib/Header/index.js +69 -117
- package/lib/Icon/index.js +18 -53
- package/{es/UserCenter/components/notification.d.ts → lib/UserCenter/components/config-profile.d.ts} +1 -1
- package/lib/UserCenter/components/config-profile.js +67 -0
- package/lib/UserCenter/components/notification.js +203 -186
- package/lib/UserCenter/components/passport.js +70 -79
- package/lib/UserCenter/components/privacy.js +86 -88
- package/lib/UserCenter/components/settings.js +74 -84
- package/lib/UserCenter/components/storage/connect-to.js +56 -75
- package/lib/UserCenter/components/storage/connected.js +16 -37
- package/lib/UserCenter/components/storage/delete.js +42 -51
- package/lib/UserCenter/components/storage/disconnect.js +15 -29
- package/lib/UserCenter/components/storage/index.js +20 -54
- package/lib/UserCenter/components/storage/item.js +94 -122
- package/lib/UserCenter/components/storage/preview-nft.js +77 -85
- package/lib/UserCenter/components/third-party-login/index.js +49 -61
- package/lib/UserCenter/components/third-party-login/third-party-item.js +159 -176
- package/lib/UserCenter/components/user-center.js +276 -287
- package/lib/UserCenter/components/user-info/index.js +3 -27
- package/lib/UserCenter/components/user-info/user-basic-info.js +134 -129
- package/lib/UserCenter/components/user-info/user-info-item.js +43 -37
- package/lib/UserCenter/components/user-info/user-info.js +41 -74
- package/lib/UserCenter/components/webhook-item.js +184 -177
- package/lib/UserCenter/index.js +1 -13
- package/lib/UserCenter/libs/api.js +4 -16
- package/lib/UserCenter/libs/locales.d.ts +10 -0
- package/lib/UserCenter/libs/locales.js +12 -8
- package/lib/UserCenter/libs/utils.js +7 -17
- package/lib/UserSessions/components/user-session-info.js +88 -85
- package/lib/UserSessions/components/user-sessions.js +177 -213
- package/lib/UserSessions/index.js +1 -13
- package/lib/UserSessions/libs/locales.js +2 -8
- package/lib/UserSessions/libs/utils.js +4 -11
- package/lib/blocklets.js +59 -63
- package/lib/common/header-addons.js +44 -60
- package/lib/common/link-blocker.js +9 -18
- package/lib/common/overridable-theme-provider.js +10 -23
- package/lib/common/wallet-hidden-topbar.js +7 -14
- package/lib/contexts/config-user-space.js +38 -46
- package/lib/hooks/use-mobile.js +5 -13
- package/lib/index.js +10 -100
- package/lib/libs/client.js +2 -8
- package/lib/libs/spaces.js +6 -13
- package/lib/types.js +39 -41
- package/lib/utils.js +25 -44
- package/package.json +8 -38
- package/src/@types/index.ts +1 -0
- package/src/Footer/brand.jsx +6 -1
- package/src/UserCenter/components/config-profile.tsx +70 -0
- package/src/UserCenter/components/notification.tsx +63 -47
- package/src/UserCenter/components/settings.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +10 -0
- package/es/@types/index.d.ts +0 -101
- package/es/@types/index.js +0 -0
- package/es/@types/shims.d.ts +0 -16
- package/es/BlockletStudio/index.d.ts +0 -28
- package/es/BlockletStudio/index.js +0 -114
- package/es/ComponentInstaller/index.d.ts +0 -37
- package/es/ComponentInstaller/index.js +0 -200
- package/es/ComponentInstaller/installer-item.d.ts +0 -21
- package/es/ComponentInstaller/installer-item.js +0 -139
- package/es/ComponentInstaller/locales.d.ts +0 -28
- package/es/ComponentInstaller/locales.js +0 -22
- package/es/ComponentInstaller/use-component-installed.d.ts +0 -12
- package/es/ComponentInstaller/use-component-installed.js +0 -88
- package/es/ComponentManager/components/add-component.d.ts +0 -16
- package/es/ComponentManager/components/add-component.js +0 -114
- package/es/ComponentManager/components/check-component.d.ts +0 -2
- package/es/ComponentManager/components/check-component.js +0 -2
- package/es/ComponentManager/components/publish-component.d.ts +0 -10
- package/es/ComponentManager/components/publish-component.js +0 -76
- package/es/ComponentManager/components/resource-dialog.d.ts +0 -14
- package/es/ComponentManager/components/resource-dialog.js +0 -74
- package/es/ComponentManager/index.d.ts +0 -3
- package/es/ComponentManager/index.js +0 -3
- package/es/ComponentManager/libs/locales.d.ts +0 -14
- package/es/ComponentManager/libs/locales.js +0 -14
- package/es/Dashboard/index.d.ts +0 -40
- package/es/Dashboard/index.js +0 -118
- package/es/Footer/brand.d.ts +0 -22
- package/es/Footer/brand.js +0 -73
- package/es/Footer/copyright.d.ts +0 -18
- package/es/Footer/copyright.js +0 -25
- package/es/Footer/index.d.ts +0 -6
- package/es/Footer/index.js +0 -82
- package/es/Footer/internal-footer.d.ts +0 -29
- package/es/Footer/internal-footer.js +0 -117
- package/es/Footer/layout/plain.d.ts +0 -15
- package/es/Footer/layout/plain.js +0 -39
- package/es/Footer/layout/row.d.ts +0 -18
- package/es/Footer/layout/row.js +0 -41
- package/es/Footer/layout/standard.d.ts +0 -15
- package/es/Footer/layout/standard.js +0 -53
- package/es/Footer/links.d.ts +0 -22
- package/es/Footer/links.js +0 -207
- package/es/Footer/social-media.d.ts +0 -14
- package/es/Footer/social-media.js +0 -60
- package/es/Header/index.d.ts +0 -10
- package/es/Header/index.js +0 -155
- package/es/Icon/index.d.ts +0 -23
- package/es/Icon/index.js +0 -55
- package/es/UserCenter/assets/banner.png +0 -0
- package/es/UserCenter/components/notification.js +0 -248
- package/es/UserCenter/components/passport.d.ts +0 -6
- package/es/UserCenter/components/passport.js +0 -88
- package/es/UserCenter/components/privacy.d.ts +0 -11
- package/es/UserCenter/components/privacy.js +0 -99
- package/es/UserCenter/components/settings.d.ts +0 -9
- package/es/UserCenter/components/settings.js +0 -89
- package/es/UserCenter/components/storage/connect-to.d.ts +0 -7
- package/es/UserCenter/components/storage/connect-to.js +0 -108
- package/es/UserCenter/components/storage/connected.d.ts +0 -7
- package/es/UserCenter/components/storage/connected.js +0 -24
- package/es/UserCenter/components/storage/delete.d.ts +0 -7
- package/es/UserCenter/components/storage/delete.js +0 -62
- package/es/UserCenter/components/storage/disconnect.d.ts +0 -3
- package/es/UserCenter/components/storage/disconnect.js +0 -23
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
- package/es/UserCenter/components/storage/icons/long-arrow.svg +0 -5
- package/es/UserCenter/components/storage/icons/space-connected.svg +0 -3
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
- package/es/UserCenter/components/storage/index.d.ts +0 -3
- package/es/UserCenter/components/storage/index.js +0 -27
- package/es/UserCenter/components/storage/item.d.ts +0 -9
- package/es/UserCenter/components/storage/item.js +0 -158
- package/es/UserCenter/components/storage/preview-nft.d.ts +0 -6
- package/es/UserCenter/components/storage/preview-nft.js +0 -80
- package/es/UserCenter/components/third-party-login/index.d.ts +0 -5
- package/es/UserCenter/components/third-party-login/index.js +0 -110
- package/es/UserCenter/components/third-party-login/third-party-item.d.ts +0 -13
- package/es/UserCenter/components/third-party-login/third-party-item.js +0 -224
- package/es/UserCenter/components/user-center.d.ts +0 -15
- package/es/UserCenter/components/user-center.js +0 -414
- package/es/UserCenter/components/user-info/index.d.ts +0 -3
- package/es/UserCenter/components/user-info/index.js +0 -3
- package/es/UserCenter/components/user-info/user-basic-info.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-basic-info.js +0 -151
- package/es/UserCenter/components/user-info/user-info-item.d.ts +0 -11
- package/es/UserCenter/components/user-info/user-info-item.js +0 -47
- package/es/UserCenter/components/user-info/user-info.d.ts +0 -6
- package/es/UserCenter/components/user-info/user-info.js +0 -66
- package/es/UserCenter/components/webhook-item.d.ts +0 -3
- package/es/UserCenter/components/webhook-item.js +0 -243
- package/es/UserCenter/index.d.ts +0 -1
- package/es/UserCenter/index.js +0 -1
- package/es/UserCenter/libs/api.d.ts +0 -3
- package/es/UserCenter/libs/api.js +0 -4
- package/es/UserCenter/libs/locales.d.ts +0 -162
- package/es/UserCenter/libs/locales.js +0 -162
- package/es/UserCenter/libs/utils.d.ts +0 -4
- package/es/UserCenter/libs/utils.js +0 -14
- package/es/UserSessions/components/user-session-info.d.ts +0 -6
- package/es/UserSessions/components/user-session-info.js +0 -92
- package/es/UserSessions/components/user-sessions.d.ts +0 -9
- package/es/UserSessions/components/user-sessions.js +0 -265
- package/es/UserSessions/index.d.ts +0 -1
- package/es/UserSessions/index.js +0 -1
- package/es/UserSessions/libs/locales.d.ts +0 -58
- package/es/UserSessions/libs/locales.js +0 -58
- package/es/UserSessions/libs/utils.d.ts +0 -2
- package/es/UserSessions/libs/utils.js +0 -73
- package/es/blocklets.d.ts +0 -16
- package/es/blocklets.js +0 -178
- package/es/common/header-addons.d.ts +0 -21
- package/es/common/header-addons.js +0 -83
- package/es/common/link-blocker.d.ts +0 -7
- package/es/common/link-blocker.js +0 -18
- package/es/common/overridable-theme-provider.d.ts +0 -18
- package/es/common/overridable-theme-provider.js +0 -15
- package/es/common/wallet-hidden-topbar.d.ts +0 -1
- package/es/common/wallet-hidden-topbar.js +0 -14
- package/es/contexts/config-user-space.d.ts +0 -26
- package/es/contexts/config-user-space.js +0 -53
- package/es/hooks/use-mobile.d.ts +0 -4
- package/es/hooks/use-mobile.js +0 -5
- package/es/index.d.ts +0 -10
- package/es/index.js +0 -10
- package/es/libs/client.d.ts +0 -2
- package/es/libs/client.js +0 -2
- package/es/libs/spaces.d.ts +0 -2
- package/es/libs/spaces.js +0 -13
- package/es/types.d.ts +0 -2
- package/es/types.js +0 -43
- package/es/utils.d.ts +0 -8
- package/es/utils.js +0 -78
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "UserBasicInfo", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function () {
|
|
9
|
-
return _userBasicInfo.default;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "UserInfo", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _userInfo.default;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "UserInfoItem", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function () {
|
|
21
|
-
return _userInfoItem.default;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
var _userBasicInfo = _interopRequireDefault(require("./user-basic-info"));
|
|
25
|
-
var _userInfoItem = _interopRequireDefault(require("./user-info-item"));
|
|
26
|
-
var _userInfo = _interopRequireDefault(require("./user-info"));
|
|
27
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
export { default as UserBasicInfo } from "./user-basic-info.js";
|
|
2
|
+
export { default as UserInfoItem } from "./user-info-item.js";
|
|
3
|
+
export { default as UserInfo } from "./user-info.js";
|
|
@@ -1,25 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _ahooks = require("ahooks");
|
|
17
|
-
var _util = require("@arcblock/ux/lib/Locale/util");
|
|
18
|
-
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
|
-
var _noop = _interopRequireDefault(require("lodash/noop"));
|
|
20
|
-
var _locales = require("../../libs/locales");
|
|
21
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
22
|
-
function UserBasicInfo({
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Chip, IconButton, Typography } from "@mui/material";
|
|
3
|
+
import { Icon } from "@iconify/react";
|
|
4
|
+
import SwapHorizRoundedIcon from "@iconify-icons/material-symbols/swap-horiz-rounded";
|
|
5
|
+
import SettingsOutlineRoundedIcon from "@iconify-icons/material-symbols/settings-outline-rounded";
|
|
6
|
+
import Avatar from "@arcblock/ux/lib/Avatar";
|
|
7
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
8
|
+
import { useTheme } from "@arcblock/ux/lib/Theme";
|
|
9
|
+
import DID from "@arcblock/ux/lib/DID";
|
|
10
|
+
import { useCreation, useMemoizedFn } from "ahooks";
|
|
11
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
12
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
13
|
+
import noop from "lodash/noop";
|
|
14
|
+
import { translations } from "../../libs/locales.js";
|
|
15
|
+
export default function UserBasicInfo({
|
|
23
16
|
user,
|
|
24
17
|
isMyself = true,
|
|
25
18
|
showFullDid = true,
|
|
@@ -28,119 +21,131 @@ function UserBasicInfo({
|
|
|
28
21
|
openSettings,
|
|
29
22
|
...rest
|
|
30
23
|
}) {
|
|
31
|
-
const {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
35
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
24
|
+
const { locale } = useLocaleContext();
|
|
25
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
26
|
+
return translate(translations, key, locale, "en", data);
|
|
36
27
|
});
|
|
37
|
-
const currentRole =
|
|
38
|
-
|
|
28
|
+
const currentRole = useCreation(
|
|
29
|
+
() => (user?.passports || [])?.find((item) => item.name === user.role),
|
|
30
|
+
[user?.passports, user?.role]
|
|
31
|
+
);
|
|
32
|
+
const theme = useTheme();
|
|
39
33
|
const isSmallView = theme.breakpoints.down("md");
|
|
40
34
|
if (!user) {
|
|
41
35
|
return null;
|
|
42
36
|
}
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
...rest.sx
|
|
48
|
-
},
|
|
49
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
50
|
-
src: user?.avatar,
|
|
51
|
-
did: user?.did,
|
|
52
|
-
size: isSmallView ? 64 : 80,
|
|
53
|
-
variant: "circle",
|
|
54
|
-
shape: "circle",
|
|
37
|
+
return /* @__PURE__ */ jsxs(
|
|
38
|
+
Box,
|
|
39
|
+
{
|
|
40
|
+
...rest,
|
|
55
41
|
sx: {
|
|
56
|
-
borderRadius: "100%",
|
|
57
|
-
backgroundColor: "#fff",
|
|
58
42
|
position: "relative",
|
|
59
|
-
|
|
60
|
-
mb: 1.5,
|
|
61
|
-
...(isMyself ? {
|
|
62
|
-
cursor: "pointer",
|
|
63
|
-
"&:hover": {
|
|
64
|
-
"&::after": {
|
|
65
|
-
content: `"${t("switchProfile")}"`
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"&::after": {
|
|
69
|
-
color: "white",
|
|
70
|
-
position: "absolute",
|
|
71
|
-
fontSize: "12px",
|
|
72
|
-
bottom: 0,
|
|
73
|
-
left: 0,
|
|
74
|
-
right: 0,
|
|
75
|
-
height: "50%",
|
|
76
|
-
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
77
|
-
display: "flex",
|
|
78
|
-
justifyContent: "center",
|
|
79
|
-
alignItems: "center"
|
|
80
|
-
}
|
|
81
|
-
} : {})
|
|
82
|
-
},
|
|
83
|
-
onClick: isMyself ? switchProfile : _noop.default
|
|
84
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
85
|
-
variant: "h6",
|
|
86
|
-
sx: {
|
|
87
|
-
fontWeight: "bold",
|
|
88
|
-
display: "flex",
|
|
89
|
-
alignItems: "center",
|
|
90
|
-
gap: 1,
|
|
91
|
-
fontSize: "24px !important"
|
|
43
|
+
...rest.sx
|
|
92
44
|
},
|
|
93
|
-
children: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Avatar,
|
|
48
|
+
{
|
|
49
|
+
src: user?.avatar,
|
|
50
|
+
did: user?.did,
|
|
51
|
+
size: isSmallView ? 64 : 80,
|
|
52
|
+
variant: "circle",
|
|
53
|
+
shape: "circle",
|
|
54
|
+
sx: {
|
|
55
|
+
borderRadius: "100%",
|
|
56
|
+
backgroundColor: "#fff",
|
|
57
|
+
position: "relative",
|
|
58
|
+
overflow: "hidden",
|
|
59
|
+
mb: 1.5,
|
|
60
|
+
...isMyself ? {
|
|
61
|
+
cursor: "pointer",
|
|
62
|
+
"&:hover": {
|
|
63
|
+
"&::after": {
|
|
64
|
+
content: `"${t("switchProfile")}"`
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"&::after": {
|
|
68
|
+
color: "white",
|
|
69
|
+
position: "absolute",
|
|
70
|
+
fontSize: "12px",
|
|
71
|
+
bottom: 0,
|
|
72
|
+
left: 0,
|
|
73
|
+
right: 0,
|
|
74
|
+
height: "50%",
|
|
75
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
76
|
+
display: "flex",
|
|
77
|
+
justifyContent: "center",
|
|
78
|
+
alignItems: "center"
|
|
79
|
+
}
|
|
80
|
+
} : {}
|
|
81
|
+
},
|
|
82
|
+
onClick: isMyself ? switchProfile : noop
|
|
112
83
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsxs(
|
|
86
|
+
Typography,
|
|
87
|
+
{
|
|
88
|
+
variant: "h6",
|
|
89
|
+
sx: {
|
|
90
|
+
fontWeight: "bold",
|
|
91
|
+
display: "flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
gap: 1,
|
|
94
|
+
fontSize: "24px !important"
|
|
95
|
+
},
|
|
96
|
+
children: [
|
|
97
|
+
user?.fullName,
|
|
98
|
+
isMyself ? /* @__PURE__ */ jsx(
|
|
99
|
+
Chip,
|
|
100
|
+
{
|
|
101
|
+
label: currentRole?.title || user?.role || "Guest",
|
|
102
|
+
size: "small",
|
|
103
|
+
variant: "outlined",
|
|
104
|
+
sx: {
|
|
105
|
+
flexShrink: 0,
|
|
106
|
+
fontWeight: "bold",
|
|
107
|
+
fontSize: "12px",
|
|
108
|
+
color: colors.textBase,
|
|
109
|
+
borderColor: colors.strokeBorderStrong,
|
|
110
|
+
backgroundColor: "transparent",
|
|
111
|
+
textTransform: "capitalize",
|
|
112
|
+
pr: 1,
|
|
113
|
+
pl: 0.5,
|
|
114
|
+
"&:hover": {
|
|
115
|
+
backgroundColor: "rgba(0, 0, 0, 0.04)"
|
|
116
|
+
},
|
|
117
|
+
"&:active": {
|
|
118
|
+
boxShadow: "none"
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
clickable: true,
|
|
122
|
+
deleteIcon: /* @__PURE__ */ jsx(Icon, { icon: SwapHorizRoundedIcon, color: colors.textBase }),
|
|
123
|
+
onDelete: switchPassport,
|
|
124
|
+
onClick: switchPassport
|
|
125
|
+
}
|
|
126
|
+
) : null
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
),
|
|
130
|
+
/* @__PURE__ */ jsx(DID, { did: user.did, showQrcode: true, copyable: true, compact: !showFullDid, responsive: !showFullDid, locale }),
|
|
131
|
+
isMyself ? /* @__PURE__ */ jsx(
|
|
132
|
+
IconButton,
|
|
133
|
+
{
|
|
134
|
+
sx: {
|
|
135
|
+
borderRadius: 2,
|
|
136
|
+
color: colors.textBase,
|
|
137
|
+
backgroundColor: "white",
|
|
138
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
139
|
+
position: "absolute",
|
|
140
|
+
top: 0,
|
|
141
|
+
right: 0
|
|
142
|
+
},
|
|
143
|
+
disableFocusRipple: true,
|
|
144
|
+
onClick: openSettings,
|
|
145
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: SettingsOutlineRoundedIcon })
|
|
146
|
+
}
|
|
147
|
+
) : null
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -1,41 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _Colors = require("@arcblock/ux/lib/Colors");
|
|
10
|
-
function UserInfoItem({
|
|
11
|
-
data,
|
|
12
|
-
...rest
|
|
13
|
-
}) {
|
|
14
|
-
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
15
|
-
...rest,
|
|
16
|
-
sx: {
|
|
17
|
-
display: "flex",
|
|
18
|
-
alignItems: "center",
|
|
19
|
-
justifyContent: "space-between",
|
|
20
|
-
...rest.sx
|
|
21
|
-
},
|
|
22
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from "@mui/material";
|
|
3
|
+
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
4
|
+
export default function UserInfoItem({ data, ...rest }) {
|
|
5
|
+
return /* @__PURE__ */ jsxs(
|
|
6
|
+
Box,
|
|
7
|
+
{
|
|
8
|
+
...rest,
|
|
23
9
|
sx: {
|
|
24
10
|
display: "flex",
|
|
25
11
|
alignItems: "center",
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
gap: 1,
|
|
29
|
-
fontWeight: 500
|
|
12
|
+
justifyContent: "space-between",
|
|
13
|
+
...rest.sx
|
|
30
14
|
},
|
|
31
|
-
children: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(
|
|
17
|
+
Typography,
|
|
18
|
+
{
|
|
19
|
+
sx: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
alignItems: "center",
|
|
22
|
+
color: colors.textBase,
|
|
23
|
+
fontSize: "14px",
|
|
24
|
+
gap: 1,
|
|
25
|
+
fontWeight: 500
|
|
26
|
+
},
|
|
27
|
+
children: [
|
|
28
|
+
data.icon,
|
|
29
|
+
data.title
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Typography,
|
|
35
|
+
{
|
|
36
|
+
sx: {
|
|
37
|
+
color: colors.textSubtitle,
|
|
38
|
+
whiteSpace: "pre-wrap",
|
|
39
|
+
fontSize: "14px"
|
|
40
|
+
},
|
|
41
|
+
children: data.content
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
@@ -1,99 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
var _util = require("@arcblock/ux/lib/Locale/util");
|
|
18
|
-
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
19
|
-
var _constant = require("@arcblock/ux/lib/Util/constant");
|
|
20
|
-
var _locales = require("../../libs/locales");
|
|
21
|
-
var _userInfoItem = _interopRequireDefault(require("./user-info-item"));
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
function UserInfo({
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { Icon } from "@iconify/react";
|
|
4
|
+
import { useMemoizedFn, useCreation } from "ahooks";
|
|
5
|
+
import MailOutlineRoundedIcon from "@iconify-icons/material-symbols/mail-outline-rounded";
|
|
6
|
+
import ScheduleOutlineRoundedIcon from "@iconify-icons/material-symbols/schedule-outline-rounded";
|
|
7
|
+
import MoreTimeRoundedIcon from "@iconify-icons/material-symbols/more-time-rounded";
|
|
8
|
+
import CaptivePortalRoundedIcon from "@iconify-icons/material-symbols/captive-portal-rounded";
|
|
9
|
+
import SettingsInputAntennaRoundedIcon from "@iconify-icons/material-symbols/settings-input-antenna-rounded";
|
|
10
|
+
import RelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
11
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
12
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
13
|
+
import { LOGIN_PROVIDER_NAME } from "@arcblock/ux/lib/Util/constant";
|
|
14
|
+
import { translations } from "../../libs/locales.js";
|
|
15
|
+
import UserInfoItem from "./user-info-item.js";
|
|
16
|
+
export default function UserInfo({
|
|
24
17
|
user,
|
|
25
18
|
...rest
|
|
26
19
|
}) {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
31
|
-
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
20
|
+
const { locale } = useLocaleContext();
|
|
21
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
22
|
+
return translate(translations, key, locale, "en", data);
|
|
32
23
|
});
|
|
33
|
-
const readableProvider =
|
|
34
|
-
return user?.sourceProvider &&
|
|
24
|
+
const readableProvider = useCreation(() => {
|
|
25
|
+
return user?.sourceProvider && LOGIN_PROVIDER_NAME[user.sourceProvider] || t("unknown");
|
|
35
26
|
}, [user?.sourceProvider]);
|
|
36
27
|
const userInfoListData = [];
|
|
37
28
|
userInfoListData.push({
|
|
38
|
-
icon: /* @__PURE__ */
|
|
39
|
-
fontSize: 16,
|
|
40
|
-
icon: _mailOutlineRounded.default
|
|
41
|
-
}),
|
|
29
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: MailOutlineRoundedIcon }),
|
|
42
30
|
title: t("email"),
|
|
43
31
|
content: user?.email || t("emptyField")
|
|
44
32
|
});
|
|
45
33
|
userInfoListData.push({
|
|
46
|
-
icon: /* @__PURE__ */
|
|
47
|
-
fontSize: 16,
|
|
48
|
-
icon: _scheduleOutlineRounded.default
|
|
49
|
-
}),
|
|
34
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: ScheduleOutlineRoundedIcon }),
|
|
50
35
|
title: t("lastLoginAt"),
|
|
51
|
-
content: user?.lastLoginAt ? /* @__PURE__ */
|
|
52
|
-
locale,
|
|
53
|
-
value: user?.lastLoginAt,
|
|
54
|
-
relativeRange: 3 * 86400 * 1e3
|
|
55
|
-
}) : t("unknown")
|
|
36
|
+
content: user?.lastLoginAt ? /* @__PURE__ */ jsx(RelativeTime, { locale, value: user?.lastLoginAt, relativeRange: 3 * 86400 * 1e3 }) : t("unknown")
|
|
56
37
|
});
|
|
57
38
|
userInfoListData.push({
|
|
58
|
-
icon: /* @__PURE__ */
|
|
59
|
-
fontSize: 16,
|
|
60
|
-
icon: _settingsInputAntennaRounded.default
|
|
61
|
-
}),
|
|
39
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: SettingsInputAntennaRoundedIcon }),
|
|
62
40
|
title: t("lastLoginIp"),
|
|
63
41
|
content: user?.lastLoginIp || t("unknown")
|
|
64
42
|
});
|
|
65
43
|
userInfoListData.push({
|
|
66
|
-
icon: /* @__PURE__ */
|
|
67
|
-
fontSize: 16,
|
|
68
|
-
icon: _moreTimeRounded.default
|
|
69
|
-
}),
|
|
44
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: MoreTimeRoundedIcon }),
|
|
70
45
|
title: t("createdAt"),
|
|
71
|
-
content: user?.createdAt ? /* @__PURE__ */
|
|
72
|
-
locale,
|
|
73
|
-
value: user?.createdAt
|
|
74
|
-
}) : t("unknown")
|
|
46
|
+
content: user?.createdAt ? /* @__PURE__ */ jsx(RelativeTime, { locale, value: user?.createdAt }) : t("unknown")
|
|
75
47
|
});
|
|
76
48
|
userInfoListData.push({
|
|
77
|
-
icon: /* @__PURE__ */
|
|
78
|
-
fontSize: 16,
|
|
79
|
-
icon: _captivePortalRounded.default
|
|
80
|
-
}),
|
|
49
|
+
icon: /* @__PURE__ */ jsx(Icon, { fontSize: 16, icon: CaptivePortalRoundedIcon }),
|
|
81
50
|
title: t("registerFrom"),
|
|
82
51
|
content: readableProvider
|
|
83
52
|
});
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
flexDirection: "column",
|
|
89
|
-
gap: 1.5,
|
|
90
|
-
...rest?.sx
|
|
91
|
-
},
|
|
92
|
-
children: userInfoListData.map(item => /* @__PURE__ */(0, _jsxRuntime.jsx)(_userInfoItem.default, {
|
|
93
|
-
data: item,
|
|
53
|
+
return /* @__PURE__ */ jsx(
|
|
54
|
+
Box,
|
|
55
|
+
{
|
|
56
|
+
...rest,
|
|
94
57
|
sx: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
58
|
+
display: "flex",
|
|
59
|
+
flexDirection: "column",
|
|
60
|
+
gap: 1.5,
|
|
61
|
+
...rest?.sx
|
|
62
|
+
},
|
|
63
|
+
children: userInfoListData.map((item) => /* @__PURE__ */ jsx(UserInfoItem, { data: item, sx: { flex: 1 } }, item.title))
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
}
|