@blocklet/ui-react 2.10.50 → 2.10.52
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/lib/UserCenter/components/settings.js +4 -1
- package/lib/UserCenter/components/storage/connected.d.ts +2 -3
- package/lib/UserCenter/components/storage/connected.js +22 -13
- package/lib/UserCenter/components/storage/index.js +2 -2
- package/lib/UserCenter/components/user-center.js +3 -0
- package/package.json +5 -4
- package/src/UserCenter/components/settings.tsx +4 -1
- package/src/UserCenter/components/storage/connected.tsx +24 -17
- package/src/UserCenter/components/storage/index.tsx +2 -11
- package/src/UserCenter/components/user-center.tsx +3 -0
- package/lib/UserCenter/components/storage/item.d.ts +0 -8
- package/lib/UserCenter/components/storage/item.js +0 -158
- package/src/UserCenter/components/storage/item.tsx +0 -159
|
@@ -32,6 +32,9 @@ export default function Settings({
|
|
|
32
32
|
};
|
|
33
33
|
});
|
|
34
34
|
}, [settings?.userCenterTabs]);
|
|
35
|
+
const showStorage = window?.blocklet?.componentMountPoints.some(
|
|
36
|
+
(v) => v.capabilities?.didSpace === "requiredOnConnect"
|
|
37
|
+
);
|
|
35
38
|
const tabs = useCreation(() => {
|
|
36
39
|
return [
|
|
37
40
|
{
|
|
@@ -54,7 +57,7 @@ export default function Settings({
|
|
|
54
57
|
value: "privacy",
|
|
55
58
|
content: /* @__PURE__ */ jsx(Privacy, { configList: privacyConfigList, onSave })
|
|
56
59
|
},
|
|
57
|
-
|
|
60
|
+
showStorage && {
|
|
58
61
|
label: t("storageManagement"),
|
|
59
62
|
value: "storage",
|
|
60
63
|
content: /* @__PURE__ */ jsx(ConfigUserSpaceProvider, { children: /* @__PURE__ */ jsx(DidSpace, {}) })
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
declare function Connected({ spaceGateway
|
|
1
|
+
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
2
|
+
declare function Connected({ spaceGateway }: {
|
|
3
3
|
spaceGateway: SpaceGateway | undefined;
|
|
4
|
-
settingStorageEndpoint: SettingStorageEndpoint;
|
|
5
4
|
}): import("react").JSX.Element;
|
|
6
5
|
export default Connected;
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
3
|
-
import { Box, Typography } from "@mui/material";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}) {
|
|
3
|
+
import { Box, IconButton, Link, Typography } from "@mui/material";
|
|
4
|
+
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
5
|
+
import SpaceCard from "@blocklet/did-space-react/lib/components/SpaceCard";
|
|
6
|
+
import { getSpaceHomeUrl } from "../../../libs/spaces.js";
|
|
7
|
+
function Connected({ spaceGateway }) {
|
|
9
8
|
const { t } = useLocaleContext();
|
|
10
9
|
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", children: [
|
|
11
10
|
/* @__PURE__ */ jsx(Box, { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: "12px", children: /* @__PURE__ */ jsx(Typography, { fontSize: "16px", fontWeight: "bold", children: t("storage.spaces.connected.title") }) }),
|
|
12
|
-
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
13
|
-
|
|
11
|
+
/* @__PURE__ */ jsx(Box, { children: spaceGateway && /* @__PURE__ */ jsx(
|
|
12
|
+
SpaceCard,
|
|
14
13
|
{
|
|
15
|
-
|
|
16
|
-
spaceGateway,
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
sx: { marginTop: "12px", "&.selected": { borderColor: "primary.main" } },
|
|
15
|
+
endpoint: spaceGateway.endpoint,
|
|
16
|
+
deps: [spaceGateway],
|
|
17
|
+
selected: true,
|
|
18
|
+
action: /* @__PURE__ */ jsx(
|
|
19
|
+
IconButton,
|
|
20
|
+
{
|
|
21
|
+
size: "small",
|
|
22
|
+
LinkComponent: Link,
|
|
23
|
+
href: getSpaceHomeUrl(spaceGateway.endpoint),
|
|
24
|
+
target: "_blank",
|
|
25
|
+
children: /* @__PURE__ */ jsx(OpenInNewIcon, {})
|
|
26
|
+
}
|
|
27
|
+
)
|
|
19
28
|
},
|
|
20
|
-
spaceGateway
|
|
29
|
+
spaceGateway.endpoint
|
|
21
30
|
) })
|
|
22
31
|
] });
|
|
23
32
|
}
|
|
@@ -9,12 +9,12 @@ import Connected from "./connected.js";
|
|
|
9
9
|
import Disconnect from "./disconnect.js";
|
|
10
10
|
import { translations } from "../../libs/locales.js";
|
|
11
11
|
function DidSpace() {
|
|
12
|
-
const { spaceGateway, updateSpaceGateway,
|
|
12
|
+
const { spaceGateway, updateSpaceGateway, hasStorageEndpoint, loading, storageEndpoint } = useConfigUserSpaceContext();
|
|
13
13
|
if (loading) {
|
|
14
14
|
return /* @__PURE__ */ jsx(Center, { relative: "parent", children: /* @__PURE__ */ jsx(CircularProgress, {}) });
|
|
15
15
|
}
|
|
16
16
|
return /* @__PURE__ */ jsx(LocaleProvider, { translations, children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
17
|
-
/* @__PURE__ */ jsx(Box, { maxWidth: "720px", children: hasStorageEndpoint ? /* @__PURE__ */ jsx(Connected, { spaceGateway
|
|
17
|
+
/* @__PURE__ */ jsx(Box, { maxWidth: "720px", children: hasStorageEndpoint ? /* @__PURE__ */ jsx(Connected, { spaceGateway }) : /* @__PURE__ */ jsx(Disconnect, {}) }),
|
|
18
18
|
/* @__PURE__ */ jsx(Box, { display: "flex", alignItems: "center", justifyContent: "center", paddingTop: "24px", children: /* @__PURE__ */ jsx(ConnectTo, { onConnect: updateSpaceGateway, storageEndpoint }) })
|
|
19
19
|
] }) });
|
|
20
20
|
}
|
|
@@ -23,6 +23,7 @@ import { formatBlockletInfo, getLocalizedNavigation } from "../../blocklets.js";
|
|
|
23
23
|
import Passport from "./passport.js";
|
|
24
24
|
import Settings from "./settings.js";
|
|
25
25
|
import { client } from "../../libs/client.js";
|
|
26
|
+
import useMobile from "../../hooks/use-mobile.js";
|
|
26
27
|
export default function UserCenter({
|
|
27
28
|
children,
|
|
28
29
|
notLoginContent = null,
|
|
@@ -37,6 +38,7 @@ export default function UserCenter({
|
|
|
37
38
|
stickySidebar = false
|
|
38
39
|
}) {
|
|
39
40
|
const { locale } = useLocaleContext();
|
|
41
|
+
const isMobile = useMobile({});
|
|
40
42
|
const t = useMemoizedFn((key, data = {}) => {
|
|
41
43
|
return translate(translations, key, locale, "en", data);
|
|
42
44
|
});
|
|
@@ -91,6 +93,7 @@ export default function UserCenter({
|
|
|
91
93
|
}
|
|
92
94
|
);
|
|
93
95
|
const { confirmHolder, confirmApi } = useConfirm({
|
|
96
|
+
fullScreen: isMobile,
|
|
94
97
|
sx: {
|
|
95
98
|
".MuiDialog-paper": {
|
|
96
99
|
borderRadius: 2,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.52",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -32,8 +32,9 @@
|
|
|
32
32
|
"url": "https://github.com/ArcBlock/ux/issues"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@arcblock/bridge": "^2.10.
|
|
36
|
-
"@arcblock/react-hooks": "^2.10.
|
|
35
|
+
"@arcblock/bridge": "^2.10.52",
|
|
36
|
+
"@arcblock/react-hooks": "^2.10.52",
|
|
37
|
+
"@blocklet/did-space-react": "^0.5.57",
|
|
37
38
|
"@iconify-icons/logos": "^1.2.36",
|
|
38
39
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
39
40
|
"@iconify/react": "^4.1.1",
|
|
@@ -79,5 +80,5 @@
|
|
|
79
80
|
"jest": "^29.7.0",
|
|
80
81
|
"unbuild": "^2.0.0"
|
|
81
82
|
},
|
|
82
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "81930383a1128ca408ac99b7aaf15be422929606"
|
|
83
84
|
}
|
|
@@ -41,6 +41,9 @@ export default function Settings({
|
|
|
41
41
|
};
|
|
42
42
|
});
|
|
43
43
|
}, [settings?.userCenterTabs]);
|
|
44
|
+
const showStorage = window?.blocklet?.componentMountPoints.some(
|
|
45
|
+
(v: any) => v.capabilities?.didSpace === 'requiredOnConnect'
|
|
46
|
+
);
|
|
44
47
|
const tabs = useCreation(() => {
|
|
45
48
|
return [
|
|
46
49
|
{
|
|
@@ -63,7 +66,7 @@ export default function Settings({
|
|
|
63
66
|
value: 'privacy',
|
|
64
67
|
content: <Privacy configList={privacyConfigList} onSave={onSave} />,
|
|
65
68
|
},
|
|
66
|
-
|
|
69
|
+
showStorage && {
|
|
67
70
|
label: t('storageManagement'),
|
|
68
71
|
value: 'storage',
|
|
69
72
|
content: (
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import { Box, Typography } from '@mui/material';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
2
|
+
import { Box, IconButton, Link, Typography } from '@mui/material';
|
|
3
|
+
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
4
|
+
import SpaceCard from '@blocklet/did-space-react/lib/components/SpaceCard';
|
|
5
|
+
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
6
|
+
import { getSpaceHomeUrl } from '../../../libs/spaces';
|
|
5
7
|
|
|
6
|
-
function Connected({
|
|
7
|
-
spaceGateway,
|
|
8
|
-
settingStorageEndpoint,
|
|
9
|
-
}: {
|
|
10
|
-
spaceGateway: SpaceGateway | undefined;
|
|
11
|
-
settingStorageEndpoint: SettingStorageEndpoint;
|
|
12
|
-
}) {
|
|
8
|
+
function Connected({ spaceGateway }: { spaceGateway: SpaceGateway | undefined }) {
|
|
13
9
|
const { t } = useLocaleContext();
|
|
14
10
|
|
|
15
11
|
return (
|
|
@@ -20,13 +16,24 @@ function Connected({
|
|
|
20
16
|
</Typography>
|
|
21
17
|
</Box>
|
|
22
18
|
<Box>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
19
|
+
{spaceGateway && (
|
|
20
|
+
<SpaceCard
|
|
21
|
+
sx={{ marginTop: '12px', '&.selected': { borderColor: 'primary.main' } }}
|
|
22
|
+
key={spaceGateway.endpoint}
|
|
23
|
+
endpoint={spaceGateway.endpoint}
|
|
24
|
+
deps={[spaceGateway]}
|
|
25
|
+
selected
|
|
26
|
+
action={
|
|
27
|
+
<IconButton
|
|
28
|
+
size="small"
|
|
29
|
+
LinkComponent={Link}
|
|
30
|
+
href={getSpaceHomeUrl(spaceGateway.endpoint)}
|
|
31
|
+
target="_blank">
|
|
32
|
+
<OpenInNewIcon />
|
|
33
|
+
</IconButton>
|
|
34
|
+
}
|
|
35
|
+
/>
|
|
36
|
+
)}
|
|
30
37
|
</Box>
|
|
31
38
|
</Box>
|
|
32
39
|
);
|
|
@@ -9,7 +9,7 @@ import Disconnect from './disconnect';
|
|
|
9
9
|
import { translations } from '../../libs/locales';
|
|
10
10
|
|
|
11
11
|
function DidSpace() {
|
|
12
|
-
const { spaceGateway, updateSpaceGateway,
|
|
12
|
+
const { spaceGateway, updateSpaceGateway, hasStorageEndpoint, loading, storageEndpoint } =
|
|
13
13
|
useConfigUserSpaceContext();
|
|
14
14
|
|
|
15
15
|
if (loading) {
|
|
@@ -23,16 +23,7 @@ function DidSpace() {
|
|
|
23
23
|
return (
|
|
24
24
|
<LocaleProvider translations={translations}>
|
|
25
25
|
<Container>
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
-
<Box maxWidth="720px">
|
|
29
|
-
{hasStorageEndpoint ? (
|
|
30
|
-
<Connected spaceGateway={spaceGateway} settingStorageEndpoint={settingStorageEndpoint} />
|
|
31
|
-
) : (
|
|
32
|
-
<Disconnect />
|
|
33
|
-
)}
|
|
34
|
-
</Box>
|
|
35
|
-
|
|
26
|
+
<Box maxWidth="720px">{hasStorageEndpoint ? <Connected spaceGateway={spaceGateway} /> : <Disconnect />}</Box>
|
|
36
27
|
<Box display="flex" alignItems="center" justifyContent="center" paddingTop="24px">
|
|
37
28
|
<ConnectTo onConnect={updateSpaceGateway} storageEndpoint={storageEndpoint} />
|
|
38
29
|
</Box>
|
|
@@ -29,6 +29,7 @@ import { formatBlockletInfo, getLocalizedNavigation } from '../../blocklets';
|
|
|
29
29
|
import Passport from './passport';
|
|
30
30
|
import Settings from './settings';
|
|
31
31
|
import { client } from '../../libs/client';
|
|
32
|
+
import useMobile from '../../hooks/use-mobile';
|
|
32
33
|
|
|
33
34
|
export default function UserCenter({
|
|
34
35
|
children,
|
|
@@ -57,6 +58,7 @@ export default function UserCenter({
|
|
|
57
58
|
readonly stickySidebar?: boolean;
|
|
58
59
|
}) {
|
|
59
60
|
const { locale } = useLocaleContext();
|
|
61
|
+
const isMobile = useMobile({});
|
|
60
62
|
const t = useMemoizedFn((key, data = {}) => {
|
|
61
63
|
return translate(translations, key, locale, 'en', data);
|
|
62
64
|
});
|
|
@@ -117,6 +119,7 @@ export default function UserCenter({
|
|
|
117
119
|
);
|
|
118
120
|
|
|
119
121
|
const { confirmHolder, confirmApi } = useConfirm({
|
|
122
|
+
fullScreen: isMobile,
|
|
120
123
|
sx: {
|
|
121
124
|
'.MuiDialog-paper': {
|
|
122
125
|
borderRadius: 2,
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { BoxProps } from '@mui/material';
|
|
2
|
-
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
3
|
-
declare function SpaceItem({ spaceGateway, connected, onDisconnect, ...rest }: {
|
|
4
|
-
spaceGateway: SpaceGateway;
|
|
5
|
-
connected: boolean;
|
|
6
|
-
onDisconnect: Function;
|
|
7
|
-
} & BoxProps): import("react").JSX.Element;
|
|
8
|
-
export default SpaceItem;
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Chip, IconButton, Link, Typography } from "@mui/material";
|
|
3
|
-
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
4
|
-
import CheckIcon from "@mui/icons-material/Check";
|
|
5
|
-
import styled from "@emotion/styled";
|
|
6
|
-
import DidAddress from "@arcblock/ux/lib/DID";
|
|
7
|
-
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
8
|
-
import SpacesConnectedSvg from "./icons/space-connected.svg?react";
|
|
9
|
-
import PreviewSpaceNft from "./preview-nft.js";
|
|
10
|
-
import useMobile from "../../../hooks/use-mobile.js";
|
|
11
|
-
import { getSpaceHomeUrl, getSpaceNftDisplayUrlFromEndpoint } from "../../../libs/spaces.js";
|
|
12
|
-
function SpaceItem({
|
|
13
|
-
spaceGateway,
|
|
14
|
-
connected,
|
|
15
|
-
onDisconnect,
|
|
16
|
-
...rest
|
|
17
|
-
}) {
|
|
18
|
-
const isMobile = useMobile({});
|
|
19
|
-
const { t } = useLocaleContext();
|
|
20
|
-
return /* @__PURE__ */ jsxs(
|
|
21
|
-
BoxContainer,
|
|
22
|
-
{
|
|
23
|
-
style: {
|
|
24
|
-
position: "relative"
|
|
25
|
-
},
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsxs(
|
|
28
|
-
Box,
|
|
29
|
-
{
|
|
30
|
-
sx: {
|
|
31
|
-
backgroundColor: connected ? "#F0FDFF" : "inherit",
|
|
32
|
-
"&:hover": {
|
|
33
|
-
backgroundColor: connected ? "#F0FDFF" : "#FBFBFB"
|
|
34
|
-
},
|
|
35
|
-
borderRadius: "8px"
|
|
36
|
-
},
|
|
37
|
-
display: "flex",
|
|
38
|
-
padding: "12px 20px",
|
|
39
|
-
...rest,
|
|
40
|
-
children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Box, { display: "flex", children: /* @__PURE__ */ jsx(PreviewSpaceNft, { alt: spaceGateway.did, src: getSpaceNftDisplayUrlFromEndpoint(spaceGateway.endpoint) }) }),
|
|
42
|
-
/* @__PURE__ */ jsxs(
|
|
43
|
-
Box,
|
|
44
|
-
{
|
|
45
|
-
className: "spaces-info",
|
|
46
|
-
display: "flex",
|
|
47
|
-
flexGrow: 1,
|
|
48
|
-
flexDirection: "column",
|
|
49
|
-
sx: { marginLeft: "20px", padding: "0px 0px", minWidth: "0px" },
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsxs(Box, { className: "spaces-info", display: "flex", alignItems: "center", children: [
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
Typography,
|
|
54
|
-
{
|
|
55
|
-
color: connected ? "primary" : "inherit",
|
|
56
|
-
fontWeight: "bold",
|
|
57
|
-
sx: {
|
|
58
|
-
display: "-webkit-box",
|
|
59
|
-
wordBreak: "break-word",
|
|
60
|
-
WebkitLineClamp: 2,
|
|
61
|
-
WebkitBoxOrient: "vertical",
|
|
62
|
-
overflow: "hidden"
|
|
63
|
-
},
|
|
64
|
-
children: spaceGateway.name
|
|
65
|
-
}
|
|
66
|
-
),
|
|
67
|
-
/* @__PURE__ */ jsx(
|
|
68
|
-
Chip,
|
|
69
|
-
{
|
|
70
|
-
label: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
71
|
-
/* @__PURE__ */ jsx(SpacesConnectedSvg, { style: { marginRight: "4px" } }),
|
|
72
|
-
t("storage.spaces.connected.tag")
|
|
73
|
-
] }),
|
|
74
|
-
variant: "outlined",
|
|
75
|
-
size: "small",
|
|
76
|
-
style: { marginLeft: isMobile ? void 0 : "20px", fontWeight: "bold" }
|
|
77
|
-
}
|
|
78
|
-
)
|
|
79
|
-
] }),
|
|
80
|
-
/* @__PURE__ */ jsx(Box, { display: "flex", color: "#9397A1", marginTop: "8px", children: /* @__PURE__ */ jsx(
|
|
81
|
-
Typography,
|
|
82
|
-
{
|
|
83
|
-
sx: {
|
|
84
|
-
display: "inline-flex",
|
|
85
|
-
alignItems: "center",
|
|
86
|
-
fontSize: "14px"
|
|
87
|
-
},
|
|
88
|
-
color: "#9397A1",
|
|
89
|
-
children: spaceGateway.did && /* @__PURE__ */ jsx(DidAddress, { copyable: false, size: 14, compact: true, responsive: false, did: spaceGateway.did })
|
|
90
|
-
}
|
|
91
|
-
) })
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
/* @__PURE__ */ jsx(Box, { display: "flex", alignItems: "center", children: /* @__PURE__ */ jsx(Box, { display: "flex", alignItems: "center", width: "100%", children: /* @__PURE__ */ jsx(IconButton, { size: "small", LinkComponent: Link, href: getSpaceHomeUrl(spaceGateway.endpoint), target: "_blank", children: /* @__PURE__ */ jsx(OpenInNewIcon, {}) }) }) })
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
),
|
|
99
|
-
/* @__PURE__ */ jsx(Box, { className: "selected-container selected", children: /* @__PURE__ */ jsx(CheckIcon, { className: "selected-icon" }) })
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
const BoxContainer = styled(Box)`
|
|
105
|
-
.selected-container {
|
|
106
|
-
position: absolute;
|
|
107
|
-
right: 0px;
|
|
108
|
-
bottom: 0px;
|
|
109
|
-
display: flex;
|
|
110
|
-
-webkit-box-pack: end;
|
|
111
|
-
justify-content: flex-end;
|
|
112
|
-
align-items: flex-end;
|
|
113
|
-
width: 32px;
|
|
114
|
-
height: 32px;
|
|
115
|
-
border-radius: 0px 0px 8px;
|
|
116
|
-
color: rgb(255, 255, 255);
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
transition: all 0.4s ease 0s;
|
|
119
|
-
|
|
120
|
-
&::after {
|
|
121
|
-
position: absolute;
|
|
122
|
-
z-index: 0;
|
|
123
|
-
left: 60px;
|
|
124
|
-
top: 60px;
|
|
125
|
-
display: block;
|
|
126
|
-
width: 0px;
|
|
127
|
-
height: 0px;
|
|
128
|
-
border-width: 16px;
|
|
129
|
-
border-style: solid;
|
|
130
|
-
border-color: transparent #1dc1c7 #1dc1c7 transparent;
|
|
131
|
-
transition: all 0.1s ease 0s;
|
|
132
|
-
content: '';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.selected-icon {
|
|
136
|
-
visibility: hidden;
|
|
137
|
-
width: 60%;
|
|
138
|
-
height: 60%;
|
|
139
|
-
position: relative;
|
|
140
|
-
z-index: 2;
|
|
141
|
-
margin: 0px 1px 1px 0px;
|
|
142
|
-
font-size: 16px;
|
|
143
|
-
transition: all 0.2s ease 0s;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.selected-container.selected {
|
|
148
|
-
&::after {
|
|
149
|
-
left: 0px;
|
|
150
|
-
top: 0px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.selected-icon {
|
|
154
|
-
visibility: visible;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
`;
|
|
158
|
-
export default SpaceItem;
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { Box, BoxProps, Chip, IconButton, Link, Typography } from '@mui/material';
|
|
2
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import CheckIcon from '@mui/icons-material/Check';
|
|
4
|
-
import styled from '@emotion/styled';
|
|
5
|
-
import DidAddress from '@arcblock/ux/lib/DID';
|
|
6
|
-
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
7
|
-
// @ts-expect-error
|
|
8
|
-
import SpacesConnectedSvg from './icons/space-connected.svg?react';
|
|
9
|
-
import PreviewSpaceNft from './preview-nft';
|
|
10
|
-
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
11
|
-
import useMobile from '../../../hooks/use-mobile';
|
|
12
|
-
import { getSpaceHomeUrl, getSpaceNftDisplayUrlFromEndpoint } from '../../../libs/spaces';
|
|
13
|
-
|
|
14
|
-
function SpaceItem({
|
|
15
|
-
spaceGateway,
|
|
16
|
-
connected,
|
|
17
|
-
onDisconnect,
|
|
18
|
-
...rest
|
|
19
|
-
}: { spaceGateway: SpaceGateway; connected: boolean; onDisconnect: Function } & BoxProps) {
|
|
20
|
-
const isMobile = useMobile({});
|
|
21
|
-
const { t } = useLocaleContext();
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<BoxContainer
|
|
25
|
-
style={{
|
|
26
|
-
position: 'relative',
|
|
27
|
-
}}>
|
|
28
|
-
<Box
|
|
29
|
-
sx={{
|
|
30
|
-
backgroundColor: connected ? '#F0FDFF' : 'inherit',
|
|
31
|
-
'&:hover': {
|
|
32
|
-
backgroundColor: connected ? '#F0FDFF' : '#FBFBFB',
|
|
33
|
-
},
|
|
34
|
-
borderRadius: '8px',
|
|
35
|
-
}}
|
|
36
|
-
display="flex"
|
|
37
|
-
padding="12px 20px"
|
|
38
|
-
{...rest}>
|
|
39
|
-
<Box display="flex">
|
|
40
|
-
<PreviewSpaceNft alt={spaceGateway.did} src={getSpaceNftDisplayUrlFromEndpoint(spaceGateway.endpoint)} />
|
|
41
|
-
</Box>
|
|
42
|
-
<Box
|
|
43
|
-
className="spaces-info"
|
|
44
|
-
display="flex"
|
|
45
|
-
flexGrow={1}
|
|
46
|
-
flexDirection="column"
|
|
47
|
-
sx={{ marginLeft: '20px', padding: '0px 0px', minWidth: '0px' }}>
|
|
48
|
-
<Box className="spaces-info" display="flex" alignItems="center">
|
|
49
|
-
<Typography
|
|
50
|
-
color={connected ? 'primary' : 'inherit'}
|
|
51
|
-
fontWeight="bold"
|
|
52
|
-
sx={{
|
|
53
|
-
display: '-webkit-box',
|
|
54
|
-
wordBreak: 'break-word',
|
|
55
|
-
WebkitLineClamp: 2,
|
|
56
|
-
WebkitBoxOrient: 'vertical',
|
|
57
|
-
overflow: 'hidden',
|
|
58
|
-
}}>
|
|
59
|
-
{spaceGateway.name}
|
|
60
|
-
</Typography>
|
|
61
|
-
<Chip
|
|
62
|
-
label={
|
|
63
|
-
<>
|
|
64
|
-
<SpacesConnectedSvg style={{ marginRight: '4px' }} />
|
|
65
|
-
{t('storage.spaces.connected.tag')}
|
|
66
|
-
</>
|
|
67
|
-
}
|
|
68
|
-
variant="outlined"
|
|
69
|
-
size="small"
|
|
70
|
-
style={{ marginLeft: isMobile ? undefined : '20px', fontWeight: 'bold' }}
|
|
71
|
-
/>
|
|
72
|
-
</Box>
|
|
73
|
-
<Box display="flex" color="#9397A1" marginTop="8px">
|
|
74
|
-
<Typography
|
|
75
|
-
sx={{
|
|
76
|
-
display: 'inline-flex',
|
|
77
|
-
alignItems: 'center',
|
|
78
|
-
fontSize: '14px',
|
|
79
|
-
}}
|
|
80
|
-
color="#9397A1">
|
|
81
|
-
{spaceGateway.did && (
|
|
82
|
-
<DidAddress copyable={false} size={14} compact responsive={false} did={spaceGateway.did} />
|
|
83
|
-
)}
|
|
84
|
-
</Typography>
|
|
85
|
-
</Box>
|
|
86
|
-
</Box>
|
|
87
|
-
<Box display="flex" alignItems="center">
|
|
88
|
-
<Box display="flex" alignItems="center" width="100%">
|
|
89
|
-
<IconButton size="small" LinkComponent={Link} href={getSpaceHomeUrl(spaceGateway.endpoint)} target="_blank">
|
|
90
|
-
<OpenInNewIcon />
|
|
91
|
-
</IconButton>
|
|
92
|
-
</Box>
|
|
93
|
-
</Box>
|
|
94
|
-
</Box>
|
|
95
|
-
|
|
96
|
-
<Box className="selected-container selected">
|
|
97
|
-
{/* check icon */}
|
|
98
|
-
<CheckIcon className="selected-icon" />
|
|
99
|
-
</Box>
|
|
100
|
-
</BoxContainer>
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const BoxContainer = styled(Box)`
|
|
105
|
-
.selected-container {
|
|
106
|
-
position: absolute;
|
|
107
|
-
right: 0px;
|
|
108
|
-
bottom: 0px;
|
|
109
|
-
display: flex;
|
|
110
|
-
-webkit-box-pack: end;
|
|
111
|
-
justify-content: flex-end;
|
|
112
|
-
align-items: flex-end;
|
|
113
|
-
width: 32px;
|
|
114
|
-
height: 32px;
|
|
115
|
-
border-radius: 0px 0px 8px;
|
|
116
|
-
color: rgb(255, 255, 255);
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
transition: all 0.4s ease 0s;
|
|
119
|
-
|
|
120
|
-
&::after {
|
|
121
|
-
position: absolute;
|
|
122
|
-
z-index: 0;
|
|
123
|
-
left: 60px;
|
|
124
|
-
top: 60px;
|
|
125
|
-
display: block;
|
|
126
|
-
width: 0px;
|
|
127
|
-
height: 0px;
|
|
128
|
-
border-width: 16px;
|
|
129
|
-
border-style: solid;
|
|
130
|
-
border-color: transparent #1dc1c7 #1dc1c7 transparent;
|
|
131
|
-
transition: all 0.1s ease 0s;
|
|
132
|
-
content: '';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
.selected-icon {
|
|
136
|
-
visibility: hidden;
|
|
137
|
-
width: 60%;
|
|
138
|
-
height: 60%;
|
|
139
|
-
position: relative;
|
|
140
|
-
z-index: 2;
|
|
141
|
-
margin: 0px 1px 1px 0px;
|
|
142
|
-
font-size: 16px;
|
|
143
|
-
transition: all 0.2s ease 0s;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.selected-container.selected {
|
|
148
|
-
&::after {
|
|
149
|
-
left: 0px;
|
|
150
|
-
top: 0px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.selected-icon {
|
|
154
|
-
visibility: visible;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
`;
|
|
158
|
-
|
|
159
|
-
export default SpaceItem;
|