@blocklet/ui-react 2.9.17 → 2.9.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.
- package/build.config.ts +1 -1
- package/es/@types/index.d.ts +2 -0
- package/es/Dashboard/index.js +1 -1
- package/es/UserCenter/components/settings.d.ts +1 -2
- package/es/UserCenter/components/settings.js +8 -1
- package/es/UserCenter/components/storage/connect-to.d.ts +7 -0
- package/es/UserCenter/components/storage/connect-to.js +104 -0
- package/es/UserCenter/components/storage/connected.d.ts +7 -0
- package/es/UserCenter/components/storage/connected.js +21 -0
- package/es/UserCenter/components/storage/delete.d.ts +7 -0
- package/es/UserCenter/components/storage/delete.js +59 -0
- package/es/UserCenter/components/storage/disconnect.d.ts +3 -0
- package/es/UserCenter/components/storage/disconnect.js +23 -0
- package/es/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
- package/es/UserCenter/components/storage/icons/long-arrow.svg +5 -0
- package/es/UserCenter/components/storage/icons/space-connected.svg +3 -0
- package/es/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
- package/es/UserCenter/components/storage/index.d.ts +3 -0
- package/es/UserCenter/components/storage/index.js +25 -0
- package/es/UserCenter/components/storage/item.d.ts +9 -0
- package/es/UserCenter/components/storage/item.js +147 -0
- package/es/UserCenter/components/storage/preview-nft.d.ts +6 -0
- package/es/UserCenter/components/storage/preview-nft.js +80 -0
- package/es/UserCenter/components/user-basic-info.d.ts +3 -1
- package/es/UserCenter/components/user-basic-info.js +133 -46
- package/es/UserCenter/components/user-center.d.ts +9 -6
- package/es/UserCenter/components/user-center.js +39 -138
- package/es/UserCenter/components/user-info-item.d.ts +2 -1
- package/es/UserCenter/components/user-info-item.js +4 -2
- package/es/UserCenter/components/user-info.js +6 -2
- package/es/UserCenter/libs/api.d.ts +3 -0
- package/es/UserCenter/libs/api.js +4 -0
- package/es/UserCenter/libs/locales.d.ts +6 -0
- package/es/UserCenter/libs/locales.js +8 -2
- package/es/contexts/config-user-space.d.ts +26 -0
- package/es/contexts/config-user-space.js +53 -0
- package/es/hooks/use-mobile.d.ts +4 -0
- package/es/hooks/use-mobile.js +5 -0
- package/es/libs/spaces.d.ts +1 -0
- package/es/libs/spaces.js +7 -0
- package/lib/@types/index.d.ts +2 -0
- package/lib/Dashboard/index.js +2 -0
- package/lib/UserCenter/components/settings.d.ts +1 -2
- package/lib/UserCenter/components/settings.js +9 -1
- package/lib/UserCenter/components/storage/connect-to.d.ts +7 -0
- package/lib/UserCenter/components/storage/connect-to.js +127 -0
- package/lib/UserCenter/components/storage/connected.d.ts +7 -0
- package/lib/UserCenter/components/storage/connected.js +45 -0
- package/lib/UserCenter/components/storage/delete.d.ts +7 -0
- package/lib/UserCenter/components/storage/delete.js +71 -0
- package/lib/UserCenter/components/storage/disconnect.d.ts +3 -0
- package/lib/UserCenter/components/storage/disconnect.js +37 -0
- package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
- package/lib/UserCenter/components/storage/icons/long-arrow.svg +5 -0
- package/lib/UserCenter/components/storage/icons/space-connected.svg +3 -0
- package/lib/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
- package/lib/UserCenter/components/storage/index.d.ts +3 -0
- package/lib/UserCenter/components/storage/index.js +56 -0
- package/lib/UserCenter/components/storage/item.d.ts +9 -0
- package/lib/UserCenter/components/storage/item.js +179 -0
- package/lib/UserCenter/components/storage/preview-nft.d.ts +6 -0
- package/lib/UserCenter/components/storage/preview-nft.js +88 -0
- package/lib/UserCenter/components/user-basic-info.d.ts +3 -1
- package/lib/UserCenter/components/user-basic-info.js +81 -4
- package/lib/UserCenter/components/user-center.d.ts +9 -6
- package/lib/UserCenter/components/user-center.js +36 -95
- package/lib/UserCenter/components/user-info-item.d.ts +2 -1
- package/lib/UserCenter/components/user-info-item.js +5 -2
- package/lib/UserCenter/components/user-info.js +9 -2
- package/lib/UserCenter/libs/api.d.ts +3 -0
- package/lib/UserCenter/libs/api.js +16 -0
- package/lib/UserCenter/libs/locales.d.ts +6 -0
- package/lib/UserCenter/libs/locales.js +8 -2
- package/lib/contexts/config-user-space.d.ts +26 -0
- package/lib/contexts/config-user-space.js +61 -0
- package/lib/hooks/use-mobile.d.ts +4 -0
- package/lib/hooks/use-mobile.js +13 -0
- package/lib/libs/spaces.d.ts +1 -0
- package/lib/libs/spaces.js +13 -0
- package/package.json +6 -4
- package/src/@types/index.ts +3 -0
- package/src/Dashboard/index.jsx +1 -1
- package/src/UserCenter/components/settings.tsx +8 -2
- package/src/UserCenter/components/storage/connect-to.tsx +117 -0
- package/src/UserCenter/components/storage/connected.tsx +29 -0
- package/src/UserCenter/components/storage/delete.tsx +66 -0
- package/src/UserCenter/components/storage/disconnect.tsx +27 -0
- package/src/UserCenter/components/storage/icons/empty-spaces-nft.svg +58 -0
- package/src/UserCenter/components/storage/icons/long-arrow.svg +5 -0
- package/src/UserCenter/components/storage/icons/space-connected.svg +3 -0
- package/src/UserCenter/components/storage/icons/space-disconnect.svg +3 -0
- package/src/UserCenter/components/storage/index.tsx +47 -0
- package/src/UserCenter/components/storage/item.tsx +150 -0
- package/src/UserCenter/components/storage/preview-nft.tsx +72 -0
- package/src/UserCenter/components/user-basic-info.tsx +88 -5
- package/src/UserCenter/components/user-center.tsx +36 -115
- package/src/UserCenter/components/user-info-item.tsx +4 -2
- package/src/UserCenter/components/user-info.tsx +6 -2
- package/src/UserCenter/libs/api.ts +7 -0
- package/src/UserCenter/libs/locales.ts +6 -0
- package/src/contexts/config-user-space.tsx +86 -0
- package/src/hooks/use-mobile.tsx +6 -0
- package/src/libs/spaces.tsx +10 -0
- package/babel.config.es.js +0 -8
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
4
|
+
declare function SpaceItem({ spaceGateway, connected, onDisconnect, ...rest }: {
|
|
5
|
+
spaceGateway: SpaceGateway;
|
|
6
|
+
connected: boolean;
|
|
7
|
+
onDisconnect: Function;
|
|
8
|
+
} & BoxProps): import("react").JSX.Element;
|
|
9
|
+
export default SpaceItem;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Chip, Typography } from "@mui/material";
|
|
3
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
+
import toast from "@arcblock/ux/lib/Toast";
|
|
5
|
+
import CheckIcon from "@mui/icons-material/Check";
|
|
6
|
+
import styled from "@emotion/styled";
|
|
7
|
+
import SpacesConnectedSvg from "./icons/space-connected.svg?react";
|
|
8
|
+
import DidAddress from "@arcblock/ux/lib/DID";
|
|
9
|
+
import PreviewSpaceNft from "./preview-nft.js";
|
|
10
|
+
import useMobile from "../../../hooks/use-mobile.js";
|
|
11
|
+
import { getSpaceNftDisplayUrlFromEndpoint } from "../../../libs/spaces.js";
|
|
12
|
+
function SpaceItem({ spaceGateway, connected, onDisconnect, ...rest }) {
|
|
13
|
+
const isMobile = useMobile({});
|
|
14
|
+
const { t } = useLocaleContext();
|
|
15
|
+
const handleOnDisconnect = async () => {
|
|
16
|
+
try {
|
|
17
|
+
await onDisconnect();
|
|
18
|
+
toast.success(t("storage.spaces.gateway.delete.succeeded", { name: spaceGateway.name }));
|
|
19
|
+
} catch (error) {
|
|
20
|
+
console.error(error);
|
|
21
|
+
toast.error(error.message);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
BoxContainer,
|
|
26
|
+
{
|
|
27
|
+
style: {
|
|
28
|
+
position: "relative"
|
|
29
|
+
},
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxs(
|
|
32
|
+
Box,
|
|
33
|
+
{
|
|
34
|
+
sx: {
|
|
35
|
+
backgroundColor: connected ? "#F0FDFF" : "inherit",
|
|
36
|
+
"&:hover": {
|
|
37
|
+
backgroundColor: connected ? "#F0FDFF" : "#FBFBFB"
|
|
38
|
+
},
|
|
39
|
+
borderRadius: "8px"
|
|
40
|
+
},
|
|
41
|
+
display: "flex",
|
|
42
|
+
padding: "12px 20px",
|
|
43
|
+
...rest,
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(PreviewSpaceNft, { alt: spaceGateway.did, src: getSpaceNftDisplayUrlFromEndpoint(spaceGateway.endpoint) }) }),
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
Box,
|
|
48
|
+
{
|
|
49
|
+
className: "spaces-info",
|
|
50
|
+
display: "flex",
|
|
51
|
+
flexGrow: 1,
|
|
52
|
+
flexDirection: "column",
|
|
53
|
+
sx: { marginLeft: "20px", padding: "0px 0px" },
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsxs(Box, { className: "spaces-info", display: "flex", maxWidth: "360px", alignItems: "center", children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Typography, { color: connected ? "primary" : "inherit", fontSize: "1rem", fontWeight: "bold", children: spaceGateway.name }),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
Chip,
|
|
59
|
+
{
|
|
60
|
+
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
+
/* @__PURE__ */ jsx(SpacesConnectedSvg, { style: { marginRight: "4px" } }),
|
|
62
|
+
t("storage.spaces.connected.tag")
|
|
63
|
+
] }),
|
|
64
|
+
variant: "outlined",
|
|
65
|
+
size: "small",
|
|
66
|
+
style: { marginLeft: isMobile ? void 0 : "20px", fontWeight: "bold" }
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
] }),
|
|
70
|
+
/* @__PURE__ */ jsx(Box, { className: "spaces-address", display: "flex", color: "#9397A1", marginTop: "8px", children: /* @__PURE__ */ jsx(
|
|
71
|
+
Typography,
|
|
72
|
+
{
|
|
73
|
+
sx: {
|
|
74
|
+
display: "inline-flex",
|
|
75
|
+
alignItems: "center",
|
|
76
|
+
fontSize: "14px"
|
|
77
|
+
},
|
|
78
|
+
color: "#9397A1",
|
|
79
|
+
children: spaceGateway.did && /* @__PURE__ */ jsx(DidAddress, { copyable: false, size: 14, compact: true, responsive: false, did: spaceGateway.did })
|
|
80
|
+
}
|
|
81
|
+
) })
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
),
|
|
88
|
+
/* @__PURE__ */ jsx(Box, { className: "selected-container selected", children: /* @__PURE__ */ jsx(CheckIcon, { className: "selected-icon" }) })
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
const BoxContainer = styled(Box)`
|
|
94
|
+
.selected-container {
|
|
95
|
+
position: absolute;
|
|
96
|
+
right: 0px;
|
|
97
|
+
bottom: 0px;
|
|
98
|
+
display: flex;
|
|
99
|
+
-webkit-box-pack: end;
|
|
100
|
+
justify-content: flex-end;
|
|
101
|
+
align-items: flex-end;
|
|
102
|
+
width: 32px;
|
|
103
|
+
height: 32px;
|
|
104
|
+
border-radius: 0px 0px 8px;
|
|
105
|
+
color: rgb(255, 255, 255);
|
|
106
|
+
overflow: hidden;
|
|
107
|
+
transition: all 0.4s ease 0s;
|
|
108
|
+
|
|
109
|
+
&::after {
|
|
110
|
+
position: absolute;
|
|
111
|
+
z-index: 0;
|
|
112
|
+
left: 60px;
|
|
113
|
+
top: 60px;
|
|
114
|
+
display: block;
|
|
115
|
+
width: 0px;
|
|
116
|
+
height: 0px;
|
|
117
|
+
border-width: 16px;
|
|
118
|
+
border-style: solid;
|
|
119
|
+
border-color: transparent #1dc1c7 #1dc1c7 transparent;
|
|
120
|
+
transition: all 0.1s ease 0s;
|
|
121
|
+
content: '';
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.selected-icon {
|
|
125
|
+
visibility: hidden;
|
|
126
|
+
width: 60%;
|
|
127
|
+
height: 60%;
|
|
128
|
+
position: relative;
|
|
129
|
+
z-index: 2;
|
|
130
|
+
margin: 0px 1px 1px 0px;
|
|
131
|
+
font-size: 16px;
|
|
132
|
+
transition: all 0.2s ease 0s;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.selected-container.selected {
|
|
137
|
+
&::after {
|
|
138
|
+
left: 0px;
|
|
139
|
+
top: 0px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.selected-icon {
|
|
143
|
+
visibility: visible;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
export default SpaceItem;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import ReactPlaceholder from "react-placeholder";
|
|
4
|
+
import { Dialog, DialogContent, IconButton } from "@mui/material";
|
|
5
|
+
import CloseOutlinedIcon from "@mui/icons-material/CloseOutlined";
|
|
6
|
+
import EmptySpacesNFT from "./icons/empty-spaces-nft.svg?react";
|
|
7
|
+
function PreviewSpaceNft({ src, alt }) {
|
|
8
|
+
const [showEmptySpaceNFT, setShowEmptySpaceNFT] = useState(false);
|
|
9
|
+
const [open, setOpen] = useState(false);
|
|
10
|
+
const handleOpen = () => setOpen(true);
|
|
11
|
+
const handleClose = () => setOpen(false);
|
|
12
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ jsx(
|
|
14
|
+
ReactPlaceholder,
|
|
15
|
+
{
|
|
16
|
+
ready: showEmptySpaceNFT,
|
|
17
|
+
customPlaceholder: (
|
|
18
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
19
|
+
/* @__PURE__ */ jsx(
|
|
20
|
+
"img",
|
|
21
|
+
{
|
|
22
|
+
style: { cursor: "pointer" },
|
|
23
|
+
alt,
|
|
24
|
+
src,
|
|
25
|
+
width: "58px",
|
|
26
|
+
height: "58px",
|
|
27
|
+
onError: () => setShowEmptySpaceNFT(true),
|
|
28
|
+
onClick: handleOpen
|
|
29
|
+
}
|
|
30
|
+
)
|
|
31
|
+
),
|
|
32
|
+
children: /* @__PURE__ */ jsx(EmptySpacesNFT, { style: { cursor: "pointer", width: "58px", height: "58px" }, onClick: handleOpen })
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
Dialog,
|
|
37
|
+
{
|
|
38
|
+
open,
|
|
39
|
+
onClose: handleClose,
|
|
40
|
+
"aria-labelledby": "preview-space-nft-display",
|
|
41
|
+
"aria-describedby": "preview space nft display",
|
|
42
|
+
fullWidth: true,
|
|
43
|
+
maxWidth: "md",
|
|
44
|
+
children: /* @__PURE__ */ jsxs(DialogContent, { style: { padding: "8px 8px", backgroundColor: "rgba(0,0,0,0.8)" }, children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
IconButton,
|
|
47
|
+
{
|
|
48
|
+
color: "inherit",
|
|
49
|
+
onClick: handleClose,
|
|
50
|
+
"aria-label": "close",
|
|
51
|
+
style: { position: "absolute", top: 8, right: 8, color: "white" },
|
|
52
|
+
children: /* @__PURE__ */ jsx(CloseOutlinedIcon, {})
|
|
53
|
+
}
|
|
54
|
+
),
|
|
55
|
+
showEmptySpaceNFT ? /* @__PURE__ */ jsx(
|
|
56
|
+
EmptySpacesNFT,
|
|
57
|
+
{
|
|
58
|
+
style: {
|
|
59
|
+
width: "100%",
|
|
60
|
+
height: "75vh"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
) : /* @__PURE__ */ jsx(
|
|
64
|
+
"img",
|
|
65
|
+
{
|
|
66
|
+
src,
|
|
67
|
+
alt: "",
|
|
68
|
+
style: {
|
|
69
|
+
width: "100%",
|
|
70
|
+
height: "75vh",
|
|
71
|
+
objectFit: "contain"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] })
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
] });
|
|
79
|
+
}
|
|
80
|
+
export default PreviewSpaceNft;
|
|
@@ -1,8 +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, ...rest }: {
|
|
4
|
+
export default function UserBasicInfo({ user, isMyself, switchPassport, switchProfile, openSettings, ...rest }: {
|
|
5
5
|
user: User;
|
|
6
6
|
isMyself: boolean;
|
|
7
7
|
switchPassport: () => void;
|
|
8
|
+
switchProfile: () => void;
|
|
9
|
+
openSettings: () => void;
|
|
8
10
|
} & BoxProps): import("react").JSX.Element;
|
|
@@ -1,66 +1,153 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Chip, Typography } from "@mui/material";
|
|
2
|
+
import { Box, Chip, IconButton, Typography } from "@mui/material";
|
|
3
3
|
import { Icon } from "@iconify/react";
|
|
4
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";
|
|
5
7
|
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
8
|
+
import { useTheme } from "@arcblock/ux/lib/Theme";
|
|
6
9
|
import DID from "@arcblock/ux/lib/DID";
|
|
7
|
-
import { useCreation } from "ahooks";
|
|
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";
|
|
8
15
|
export default function UserBasicInfo({
|
|
9
16
|
user,
|
|
10
17
|
isMyself = true,
|
|
11
18
|
switchPassport,
|
|
19
|
+
switchProfile,
|
|
20
|
+
openSettings,
|
|
12
21
|
...rest
|
|
13
22
|
}) {
|
|
23
|
+
const { locale } = useLocaleContext();
|
|
24
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
25
|
+
return translate(translations, key, locale, "en", data);
|
|
26
|
+
});
|
|
14
27
|
const currentRole = useCreation(
|
|
15
28
|
() => (user?.passports || [])?.find((item) => item.name === user.role),
|
|
16
29
|
[user?.passports, user?.role]
|
|
17
30
|
);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
backgroundColor: "white",
|
|
45
|
-
textTransform: "capitalize",
|
|
46
|
-
pr: 1,
|
|
47
|
-
pl: 0.5,
|
|
31
|
+
const theme = useTheme();
|
|
32
|
+
const isSmallView = theme.breakpoints.down("md");
|
|
33
|
+
return /* @__PURE__ */ jsxs(
|
|
34
|
+
Box,
|
|
35
|
+
{
|
|
36
|
+
...rest,
|
|
37
|
+
sx: {
|
|
38
|
+
position: "relative",
|
|
39
|
+
...rest.sx
|
|
40
|
+
},
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
Avatar,
|
|
44
|
+
{
|
|
45
|
+
src: user?.avatar,
|
|
46
|
+
did: user?.did,
|
|
47
|
+
size: isSmallView ? 64 : 80,
|
|
48
|
+
variant: "circle",
|
|
49
|
+
shape: "circle",
|
|
50
|
+
sx: {
|
|
51
|
+
borderRadius: "100%",
|
|
52
|
+
backgroundColor: "#fff",
|
|
53
|
+
position: "relative",
|
|
54
|
+
overflow: "hidden",
|
|
55
|
+
...isMyself ? {
|
|
56
|
+
cursor: "pointer",
|
|
48
57
|
"&:hover": {
|
|
49
|
-
|
|
58
|
+
"&::after": {
|
|
59
|
+
content: `"${t("switchProfile")}"`
|
|
60
|
+
}
|
|
50
61
|
},
|
|
51
|
-
"
|
|
52
|
-
|
|
62
|
+
"&::after": {
|
|
63
|
+
color: "white",
|
|
64
|
+
position: "absolute",
|
|
65
|
+
fontSize: "12px",
|
|
66
|
+
bottom: 0,
|
|
67
|
+
left: 0,
|
|
68
|
+
right: 0,
|
|
69
|
+
height: "50%",
|
|
70
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
71
|
+
display: "flex",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
alignItems: "center"
|
|
53
74
|
}
|
|
75
|
+
} : {}
|
|
76
|
+
},
|
|
77
|
+
onClick: isMyself ? switchProfile : noop
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
/* @__PURE__ */ jsxs(
|
|
81
|
+
Typography,
|
|
82
|
+
{
|
|
83
|
+
variant: "h5",
|
|
84
|
+
sx: {
|
|
85
|
+
fontWeight: "bold",
|
|
86
|
+
display: "flex",
|
|
87
|
+
alignItems: "center",
|
|
88
|
+
gap: 1,
|
|
89
|
+
fontSize: "24px !important"
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
user?.fullName,
|
|
93
|
+
isMyself ? /* @__PURE__ */ jsx(
|
|
94
|
+
Chip,
|
|
95
|
+
{
|
|
96
|
+
label: currentRole?.title || user?.role || "Guest",
|
|
97
|
+
size: "small",
|
|
98
|
+
variant: "outlined",
|
|
99
|
+
sx: {
|
|
100
|
+
flexShrink: 0,
|
|
101
|
+
fontWeight: "bold",
|
|
102
|
+
fontSize: "12px",
|
|
103
|
+
color: colors.textBase,
|
|
104
|
+
borderColor: colors.strokeBorderStrong,
|
|
105
|
+
backgroundColor: "white",
|
|
106
|
+
textTransform: "capitalize",
|
|
107
|
+
pr: 1,
|
|
108
|
+
pl: 0.5,
|
|
109
|
+
"&:hover": {
|
|
110
|
+
backgroundColor: "rgba(0, 0, 0, 0.04)"
|
|
111
|
+
},
|
|
112
|
+
"&:active": {
|
|
113
|
+
boxShadow: "none"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
clickable: true,
|
|
117
|
+
deleteIcon: /* @__PURE__ */ jsx(Icon, { icon: SwapHorizRoundedIcon, color: colors.textBase }),
|
|
118
|
+
onDelete: switchPassport,
|
|
119
|
+
onClick: switchPassport
|
|
120
|
+
}
|
|
121
|
+
) : null
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
/* @__PURE__ */ jsx(DID, { did: user.did, copyable: false }),
|
|
126
|
+
isMyself ? /* @__PURE__ */ jsx(
|
|
127
|
+
IconButton,
|
|
128
|
+
{
|
|
129
|
+
sx: {
|
|
130
|
+
borderRadius: 2,
|
|
131
|
+
color: colors.textBase,
|
|
132
|
+
backgroundColor: "white",
|
|
133
|
+
border: `1px solid ${colors.strokeBorderBase}`,
|
|
134
|
+
position: "absolute",
|
|
135
|
+
bottom: {
|
|
136
|
+
xs: "unset",
|
|
137
|
+
md: 0
|
|
138
|
+
},
|
|
139
|
+
top: {
|
|
140
|
+
xs: 0,
|
|
141
|
+
md: "unset"
|
|
54
142
|
},
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
] });
|
|
143
|
+
right: 0
|
|
144
|
+
},
|
|
145
|
+
disableFocusRipple: true,
|
|
146
|
+
onClick: openSettings,
|
|
147
|
+
children: /* @__PURE__ */ jsx(Icon, { icon: SettingsOutlineRoundedIcon })
|
|
148
|
+
}
|
|
149
|
+
) : null
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
);
|
|
66
153
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { PaperProps } from '@mui/material';
|
|
3
|
-
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, }: {
|
|
4
|
-
children: any;
|
|
5
|
-
currentTab: string;
|
|
6
|
-
contentProps?: PaperProps;
|
|
7
|
-
disableAutoRedirect?: boolean;
|
|
8
|
-
autoPopupSetting?: boolean;
|
|
3
|
+
export default function UserCenter({ children, currentTab, contentProps, disableAutoRedirect, autoPopupSetting, hideFooter, headerProps, footerProps, }: {
|
|
4
|
+
readonly children: any;
|
|
5
|
+
readonly currentTab: string;
|
|
6
|
+
readonly contentProps?: PaperProps;
|
|
7
|
+
readonly disableAutoRedirect?: boolean;
|
|
8
|
+
readonly autoPopupSetting?: boolean;
|
|
9
|
+
readonly hideFooter?: boolean;
|
|
10
|
+
readonly headerProps?: object;
|
|
11
|
+
readonly footerProps?: object;
|
|
9
12
|
}): import("react").JSX.Element | null;
|