@blocklet/ui-react 2.9.90 → 2.10.0
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,135 +1,107 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _DID = _interopRequireDefault(require("@arcblock/ux/lib/DID"));
|
|
13
|
-
var _OpenInNew = _interopRequireDefault(require("@mui/icons-material/OpenInNew"));
|
|
14
|
-
var _spaceConnected = _interopRequireDefault(require("./icons/space-connected.svg?react"));
|
|
15
|
-
var _previewNft = _interopRequireDefault(require("./preview-nft"));
|
|
16
|
-
var _useMobile = _interopRequireDefault(require("../../../hooks/use-mobile"));
|
|
17
|
-
var _spaces = require("../../../libs/spaces");
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Chip, IconButton, 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";
|
|
19
12
|
function SpaceItem({
|
|
20
13
|
spaceGateway,
|
|
21
14
|
connected,
|
|
22
15
|
onDisconnect,
|
|
23
16
|
...rest
|
|
24
17
|
}) {
|
|
25
|
-
const isMobile = (
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
34
|
-
sx: {
|
|
35
|
-
backgroundColor: connected ? "#F0FDFF" : "inherit",
|
|
36
|
-
"&:hover": {
|
|
37
|
-
backgroundColor: connected ? "#F0FDFF" : "#FBFBFB"
|
|
38
|
-
},
|
|
39
|
-
borderRadius: "8px"
|
|
18
|
+
const isMobile = useMobile({});
|
|
19
|
+
const { t } = useLocaleContext();
|
|
20
|
+
return /* @__PURE__ */ jsxs(
|
|
21
|
+
BoxContainer,
|
|
22
|
+
{
|
|
23
|
+
style: {
|
|
24
|
+
position: "relative"
|
|
40
25
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
display: "flex",
|
|
46
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_previewNft.default, {
|
|
47
|
-
alt: spaceGateway.did,
|
|
48
|
-
src: (0, _spaces.getSpaceNftDisplayUrlFromEndpoint)(spaceGateway.endpoint)
|
|
49
|
-
})
|
|
50
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
51
|
-
className: "spaces-info",
|
|
52
|
-
display: "flex",
|
|
53
|
-
flexGrow: 1,
|
|
54
|
-
flexDirection: "column",
|
|
55
|
-
sx: {
|
|
56
|
-
marginLeft: "20px",
|
|
57
|
-
padding: "0px 0px"
|
|
58
|
-
},
|
|
59
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
60
|
-
className: "spaces-info",
|
|
61
|
-
display: "flex",
|
|
62
|
-
maxWidth: "360px",
|
|
63
|
-
alignItems: "center",
|
|
64
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
65
|
-
color: connected ? "primary" : "inherit",
|
|
66
|
-
fontWeight: "bold",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs(
|
|
28
|
+
Box,
|
|
29
|
+
{
|
|
67
30
|
sx: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
31
|
+
backgroundColor: connected ? "#F0FDFF" : "inherit",
|
|
32
|
+
"&:hover": {
|
|
33
|
+
backgroundColor: connected ? "#F0FDFF" : "#FBFBFB"
|
|
34
|
+
},
|
|
35
|
+
borderRadius: "8px"
|
|
73
36
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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" },
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxs(Box, { className: "spaces-info", display: "flex", maxWidth: "360px", 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
|
+
]
|
|
80
93
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
91
|
-
display: "flex",
|
|
92
|
-
color: "#9397A1",
|
|
93
|
-
marginTop: "8px",
|
|
94
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
95
|
-
sx: {
|
|
96
|
-
display: "inline-flex",
|
|
97
|
-
alignItems: "center",
|
|
98
|
-
fontSize: "14px"
|
|
99
|
-
},
|
|
100
|
-
color: "#9397A1",
|
|
101
|
-
children: spaceGateway.did && /* @__PURE__ */(0, _jsxRuntime.jsx)(_DID.default, {
|
|
102
|
-
copyable: false,
|
|
103
|
-
size: 14,
|
|
104
|
-
compact: true,
|
|
105
|
-
responsive: false,
|
|
106
|
-
did: spaceGateway.did
|
|
107
|
-
})
|
|
108
|
-
})
|
|
109
|
-
})]
|
|
110
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
111
|
-
display: "flex",
|
|
112
|
-
alignItems: "center",
|
|
113
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
114
|
-
display: "flex",
|
|
115
|
-
alignItems: "center",
|
|
116
|
-
width: "100%",
|
|
117
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
118
|
-
size: "small",
|
|
119
|
-
onClick: () => window.open((0, _spaces.getSpaceHomeUrl)(spaceGateway.endpoint)),
|
|
120
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_OpenInNew.default, {})
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
})]
|
|
124
|
-
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
125
|
-
className: "selected-container selected",
|
|
126
|
-
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Check.default, {
|
|
127
|
-
className: "selected-icon"
|
|
128
|
-
})
|
|
129
|
-
})]
|
|
130
|
-
});
|
|
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", onClick: () => window.open(getSpaceHomeUrl(spaceGateway.endpoint)), 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
|
+
);
|
|
131
103
|
}
|
|
132
|
-
const BoxContainer = (
|
|
104
|
+
const BoxContainer = styled(Box)`
|
|
133
105
|
.selected-container {
|
|
134
106
|
position: absolute;
|
|
135
107
|
right: 0px;
|
|
@@ -183,4 +155,4 @@ const BoxContainer = (0, _styled.default)(_material.Box)`
|
|
|
183
155
|
}
|
|
184
156
|
}
|
|
185
157
|
`;
|
|
186
|
-
|
|
158
|
+
export default SpaceItem;
|
|
@@ -1,88 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _material = require("@mui/material");
|
|
11
|
-
var _CloseOutlined = _interopRequireDefault(require("@mui/icons-material/CloseOutlined"));
|
|
12
|
-
var _emptySpacesNft = _interopRequireDefault(require("./icons/empty-spaces-nft.svg?react"));
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
function PreviewSpaceNft({
|
|
15
|
-
src,
|
|
16
|
-
alt
|
|
17
|
-
}) {
|
|
18
|
-
const [showEmptySpaceNFT, setShowEmptySpaceNFT] = (0, _react.useState)(false);
|
|
19
|
-
const [open, setOpen] = (0, _react.useState)(false);
|
|
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);
|
|
20
10
|
const handleOpen = () => setOpen(true);
|
|
21
11
|
const handleClose = () => setOpen(false);
|
|
22
|
-
return /* @__PURE__ */
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
+
] });
|
|
87
79
|
}
|
|
88
|
-
|
|
80
|
+
export default PreviewSpaceNft;
|
|
@@ -1,83 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var _thirdPartyItem = _interopRequireDefault(require("./third-party-item"));
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function ThirdPartyLogin({
|
|
17
|
-
user
|
|
18
|
-
}) {
|
|
19
|
-
const {
|
|
20
|
-
session
|
|
21
|
-
} = (0, _react.useContext)(_Session.SessionContext);
|
|
22
|
-
const [oauthConfigs, setOauthConfigs] = (0, _react.useState)({});
|
|
23
|
-
const {
|
|
24
|
-
getOAuthConfigs
|
|
25
|
-
} = session.useOAuth();
|
|
26
|
-
(0, _ahooks.useAsyncEffect)(async () => {
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useState } from "react";
|
|
3
|
+
import { Box } from "@mui/material";
|
|
4
|
+
import { useAsyncEffect, useCreation } from "ahooks";
|
|
5
|
+
import { getConnectedAccounts, getSourceProvider } from "@arcblock/ux/lib/SessionUser/libs/utils";
|
|
6
|
+
import { LOGIN_PROVIDER } from "@arcblock/ux/lib/Util/constant";
|
|
7
|
+
import { SessionContext } from "@arcblock/did-connect/lib/Session";
|
|
8
|
+
import ThirdPartyItem from "./third-party-item.js";
|
|
9
|
+
export default function ThirdPartyLogin({ user }) {
|
|
10
|
+
const { session } = useContext(SessionContext);
|
|
11
|
+
const [oauthConfigs, setOauthConfigs] = useState({});
|
|
12
|
+
const { getOAuthConfigs } = session.useOAuth();
|
|
13
|
+
useAsyncEffect(async () => {
|
|
27
14
|
const data = await getOAuthConfigs({
|
|
28
15
|
sourceAppPid: user?.sourceAppPid
|
|
29
16
|
});
|
|
30
17
|
setOauthConfigs(data);
|
|
31
18
|
}, [user?.sourceAppPid]);
|
|
32
|
-
const availableProviders =
|
|
33
|
-
const oauthList = Object.keys(oauthConfigs).map(x => {
|
|
19
|
+
const availableProviders = useCreation(() => {
|
|
20
|
+
const oauthList = Object.keys(oauthConfigs).map((x) => {
|
|
34
21
|
return {
|
|
35
22
|
...oauthConfigs[x],
|
|
36
23
|
provider: x
|
|
37
24
|
};
|
|
38
|
-
}).filter(x => x.enabled);
|
|
25
|
+
}).filter((x) => x.enabled);
|
|
39
26
|
return oauthList;
|
|
40
27
|
}, [oauthConfigs]);
|
|
41
|
-
const normalizedAccounts =
|
|
42
|
-
const connectedAccounts =
|
|
28
|
+
const normalizedAccounts = useCreation(() => {
|
|
29
|
+
const connectedAccounts = getConnectedAccounts(user);
|
|
43
30
|
let removeAuth0 = false;
|
|
44
31
|
let patchProvider = "";
|
|
45
|
-
let sourceProvider =
|
|
46
|
-
const auth0ConnectedAccount = connectedAccounts.find(x => x.provider ===
|
|
32
|
+
let sourceProvider = getSourceProvider(user);
|
|
33
|
+
const auth0ConnectedAccount = connectedAccounts.find((x) => x.provider === LOGIN_PROVIDER.AUTH0);
|
|
47
34
|
if (auth0ConnectedAccount) {
|
|
48
35
|
if (auth0ConnectedAccount.id.startsWith("google-oauth2|")) {
|
|
49
|
-
if (!connectedAccounts.some(x => x.provider === "google")) {
|
|
36
|
+
if (!connectedAccounts.some((x) => x.provider === "google")) {
|
|
50
37
|
removeAuth0 = true;
|
|
51
|
-
patchProvider =
|
|
52
|
-
if (sourceProvider ===
|
|
53
|
-
sourceProvider =
|
|
38
|
+
patchProvider = LOGIN_PROVIDER.GOOGLE;
|
|
39
|
+
if (sourceProvider === LOGIN_PROVIDER.AUTH0) {
|
|
40
|
+
sourceProvider = LOGIN_PROVIDER.GOOGLE;
|
|
54
41
|
}
|
|
55
42
|
}
|
|
56
43
|
}
|
|
57
44
|
if (auth0ConnectedAccount.id.startsWith("appleid|")) {
|
|
58
|
-
if (!connectedAccounts.some(x => x.provider ===
|
|
45
|
+
if (!connectedAccounts.some((x) => x.provider === LOGIN_PROVIDER.APPLE)) {
|
|
59
46
|
removeAuth0 = true;
|
|
60
|
-
patchProvider =
|
|
61
|
-
if (sourceProvider ===
|
|
62
|
-
sourceProvider =
|
|
47
|
+
patchProvider = LOGIN_PROVIDER.APPLE;
|
|
48
|
+
if (sourceProvider === LOGIN_PROVIDER.AUTH0) {
|
|
49
|
+
sourceProvider = LOGIN_PROVIDER.APPLE;
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
52
|
}
|
|
66
53
|
if (auth0ConnectedAccount.id.startsWith("github|")) {
|
|
67
|
-
if (!connectedAccounts.some(x => x.provider ===
|
|
54
|
+
if (!connectedAccounts.some((x) => x.provider === LOGIN_PROVIDER.GITHUB)) {
|
|
68
55
|
removeAuth0 = true;
|
|
69
|
-
patchProvider =
|
|
70
|
-
if (sourceProvider ===
|
|
71
|
-
sourceProvider =
|
|
56
|
+
patchProvider = LOGIN_PROVIDER.GITHUB;
|
|
57
|
+
if (sourceProvider === LOGIN_PROVIDER.AUTH0) {
|
|
58
|
+
sourceProvider = LOGIN_PROVIDER.GITHUB;
|
|
72
59
|
}
|
|
73
60
|
}
|
|
74
61
|
}
|
|
75
62
|
}
|
|
76
|
-
const transformedProviders = availableProviders.map(x => {
|
|
77
|
-
if (x.provider ===
|
|
63
|
+
const transformedProviders = availableProviders.map((x) => {
|
|
64
|
+
if (x.provider === LOGIN_PROVIDER.AUTH0 && removeAuth0) {
|
|
78
65
|
return null;
|
|
79
66
|
}
|
|
80
|
-
const findConnectedAccount = removeAuth0 && x.provider === patchProvider ? connectedAccounts.find(i => i.provider ===
|
|
67
|
+
const findConnectedAccount = removeAuth0 && x.provider === patchProvider ? connectedAccounts.find((i) => i.provider === LOGIN_PROVIDER.AUTH0) : connectedAccounts.find((i) => i.provider === x.provider);
|
|
81
68
|
if (findConnectedAccount) {
|
|
82
69
|
return {
|
|
83
70
|
...x,
|
|
@@ -107,16 +94,17 @@ function ThirdPartyLogin({
|
|
|
107
94
|
});
|
|
108
95
|
return transformedProviders;
|
|
109
96
|
}, [user?.connectedAccounts, availableProviders]);
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
97
|
+
return /* @__PURE__ */ jsx(
|
|
98
|
+
Box,
|
|
99
|
+
{
|
|
100
|
+
sx: {
|
|
101
|
+
gap: 1,
|
|
102
|
+
display: "grid",
|
|
103
|
+
gridTemplateColumns: "1fr min-content"
|
|
104
|
+
},
|
|
105
|
+
children: normalizedAccounts.map((account) => {
|
|
106
|
+
return /* @__PURE__ */ jsx(ThirdPartyItem, { item: account }, account?.provider);
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
}
|