@blocklet/ui-react 2.9.56 → 2.9.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/UserCenter/components/storage/connect-to.js +4 -6
- package/es/UserCenter/components/storage/connected.js +1 -1
- package/es/UserCenter/components/storage/item.js +21 -5
- package/es/libs/spaces.d.ts +1 -0
- package/es/libs/spaces.js +6 -0
- package/lib/UserCenter/components/storage/connect-to.js +7 -7
- package/lib/UserCenter/components/storage/connected.js +1 -1
- package/lib/UserCenter/components/storage/item.js +21 -2
- package/lib/libs/spaces.d.ts +1 -0
- package/lib/libs/spaces.js +7 -0
- package/package.json +5 -5
- package/src/UserCenter/components/storage/connect-to.tsx +4 -6
- package/src/UserCenter/components/storage/connected.tsx +1 -1
- package/src/UserCenter/components/storage/item.tsx +21 -5
- package/src/libs/spaces.tsx +8 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Typography } from "@mui/material";
|
|
2
|
+
import { Box, Button, Typography } from "@mui/material";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
import Button from "@arcblock/ux/lib/Button";
|
|
5
4
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
6
5
|
import DidConnect from "@arcblock/did-connect/lib/Connect";
|
|
7
6
|
import { joinURL } from "ufo";
|
|
8
7
|
import toast from "@arcblock/ux/lib/Toast";
|
|
9
8
|
import isEmpty from "lodash/isEmpty";
|
|
9
|
+
import { RELAY_SOCKET_PREFIX } from "@arcblock/ux/lib/Util/constant";
|
|
10
10
|
import { axios } from "../../libs/api.js";
|
|
11
11
|
function ConnectTo({
|
|
12
12
|
onConnect,
|
|
@@ -19,9 +19,7 @@ function ConnectTo({
|
|
|
19
19
|
checkTimeout: 1e3 * 300,
|
|
20
20
|
prefix: "/api/did",
|
|
21
21
|
checkFn: axios.create({
|
|
22
|
-
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
baseURL: joinURL(window.location.origin, window.env && window.env.apiPrefix ? window.env.apiPrefix : "/")
|
|
22
|
+
baseURL: joinURL(window.location.origin, RELAY_SOCKET_PREFIX)
|
|
25
23
|
}).get,
|
|
26
24
|
extraParams: {},
|
|
27
25
|
messages: {
|
|
@@ -80,7 +78,7 @@ function ConnectTo({
|
|
|
80
78
|
Button,
|
|
81
79
|
{
|
|
82
80
|
color: "primary",
|
|
83
|
-
|
|
81
|
+
sx: { textTransform: "none !important", fontSize: "13px", paddingLeft: 0.75, paddingRight: 0.75 },
|
|
84
82
|
size: "small",
|
|
85
83
|
onClick: handleUseWalletConnect,
|
|
86
84
|
variant: "outlined",
|
|
@@ -8,7 +8,7 @@ function Connected({
|
|
|
8
8
|
}) {
|
|
9
9
|
const { t } = useLocaleContext();
|
|
10
10
|
return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", children: [
|
|
11
|
-
/* @__PURE__ */ jsx(Box, { display: "flex", flexDirection: "row", alignItems: "center", justifyContent: "space-between", marginBottom: "12px", children: /* @__PURE__ */ jsx(Typography, { fontSize: "
|
|
11
|
+
/* @__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
12
|
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
13
13
|
SpaceItem,
|
|
14
14
|
{
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Fragment, 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 { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
4
4
|
import CheckIcon from "@mui/icons-material/Check";
|
|
5
5
|
import styled from "@emotion/styled";
|
|
6
6
|
import DidAddress from "@arcblock/ux/lib/DID";
|
|
7
|
+
import OpenInNewIcon from "@mui/icons-material/OpenInNew";
|
|
7
8
|
import SpacesConnectedSvg from "./icons/space-connected.svg?react";
|
|
8
9
|
import PreviewSpaceNft from "./preview-nft.js";
|
|
9
10
|
import useMobile from "../../../hooks/use-mobile.js";
|
|
10
|
-
import { getSpaceNftDisplayUrlFromEndpoint } from "../../../libs/spaces.js";
|
|
11
|
+
import { getSpaceHomeUrl, getSpaceNftDisplayUrlFromEndpoint } from "../../../libs/spaces.js";
|
|
11
12
|
function SpaceItem({
|
|
12
13
|
spaceGateway,
|
|
13
14
|
connected,
|
|
@@ -48,7 +49,21 @@ function SpaceItem({
|
|
|
48
49
|
sx: { marginLeft: "20px", padding: "0px 0px" },
|
|
49
50
|
children: [
|
|
50
51
|
/* @__PURE__ */ jsxs(Box, { className: "spaces-info", display: "flex", maxWidth: "360px", alignItems: "center", children: [
|
|
51
|
-
/* @__PURE__ */ jsx(
|
|
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
|
+
),
|
|
52
67
|
/* @__PURE__ */ jsx(
|
|
53
68
|
Chip,
|
|
54
69
|
{
|
|
@@ -62,7 +77,7 @@ function SpaceItem({
|
|
|
62
77
|
}
|
|
63
78
|
)
|
|
64
79
|
] }),
|
|
65
|
-
/* @__PURE__ */ jsx(Box, {
|
|
80
|
+
/* @__PURE__ */ jsx(Box, { display: "flex", color: "#9397A1", marginTop: "8px", children: /* @__PURE__ */ jsx(
|
|
66
81
|
Typography,
|
|
67
82
|
{
|
|
68
83
|
sx: {
|
|
@@ -76,7 +91,8 @@ function SpaceItem({
|
|
|
76
91
|
) })
|
|
77
92
|
]
|
|
78
93
|
}
|
|
79
|
-
)
|
|
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, {}) }) }) })
|
|
80
96
|
]
|
|
81
97
|
}
|
|
82
98
|
),
|
package/es/libs/spaces.d.ts
CHANGED
package/es/libs/spaces.js
CHANGED
|
@@ -5,3 +5,9 @@ export function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
|
|
|
5
5
|
const spaceDid = strArray.at(-4);
|
|
6
6
|
return joinURL(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
|
|
7
7
|
}
|
|
8
|
+
export function getSpaceHomeUrl(endpoint) {
|
|
9
|
+
const baseUrl = endpoint.replace(/\/api\/space\/.+/, "");
|
|
10
|
+
const strArray = endpoint.replace(/\/$/, "").split("/");
|
|
11
|
+
const spaceDid = strArray.at(-4);
|
|
12
|
+
return joinURL(baseUrl, "space", spaceDid);
|
|
13
|
+
}
|
|
@@ -7,12 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
var _material = require("@mui/material");
|
|
9
9
|
var _react = require("react");
|
|
10
|
-
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
11
10
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
12
11
|
var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
|
|
13
12
|
var _ufo = require("ufo");
|
|
14
13
|
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
15
14
|
var _isEmpty = _interopRequireDefault(require("lodash/isEmpty"));
|
|
15
|
+
var _constant = require("@arcblock/ux/lib/Util/constant");
|
|
16
16
|
var _api = require("../../libs/api");
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
18
|
function ConnectTo({
|
|
@@ -29,9 +29,7 @@ function ConnectTo({
|
|
|
29
29
|
checkTimeout: 1e3 * 300,
|
|
30
30
|
prefix: "/api/did",
|
|
31
31
|
checkFn: _api.axios.create({
|
|
32
|
-
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
baseURL: (0, _ufo.joinURL)(window.location.origin, window.env && window.env.apiPrefix ? window.env.apiPrefix : "/")
|
|
32
|
+
baseURL: (0, _ufo.joinURL)(window.location.origin, _constant.RELAY_SOCKET_PREFIX)
|
|
35
33
|
}).get,
|
|
36
34
|
extraParams: {},
|
|
37
35
|
messages: {
|
|
@@ -97,11 +95,13 @@ function ConnectTo({
|
|
|
97
95
|
}));
|
|
98
96
|
};
|
|
99
97
|
return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
100
|
-
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(
|
|
98
|
+
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
|
|
101
99
|
color: "primary",
|
|
102
|
-
|
|
100
|
+
sx: {
|
|
103
101
|
textTransform: "none !important",
|
|
104
|
-
fontSize: "
|
|
102
|
+
fontSize: "13px",
|
|
103
|
+
paddingLeft: 0.75,
|
|
104
|
+
paddingRight: 0.75
|
|
105
105
|
},
|
|
106
106
|
size: "small",
|
|
107
107
|
onClick: handleUseWalletConnect,
|
|
@@ -26,7 +26,7 @@ function Connected({
|
|
|
26
26
|
justifyContent: "space-between",
|
|
27
27
|
marginBottom: "12px",
|
|
28
28
|
children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
29
|
-
fontSize: "
|
|
29
|
+
fontSize: "16px",
|
|
30
30
|
fontWeight: "bold",
|
|
31
31
|
children: t("storage.spaces.connected.title")
|
|
32
32
|
})
|
|
@@ -10,6 +10,7 @@ var _context = require("@arcblock/ux/lib/Locale/context");
|
|
|
10
10
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
11
11
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
12
12
|
var _DID = _interopRequireDefault(require("@arcblock/ux/lib/DID"));
|
|
13
|
+
var _OpenInNew = _interopRequireDefault(require("@mui/icons-material/OpenInNew"));
|
|
13
14
|
var _spaceConnected = _interopRequireDefault(require("./icons/space-connected.svg?react"));
|
|
14
15
|
var _previewNft = _interopRequireDefault(require("./preview-nft"));
|
|
15
16
|
var _useMobile = _interopRequireDefault(require("../../../hooks/use-mobile"));
|
|
@@ -62,8 +63,14 @@ function SpaceItem({
|
|
|
62
63
|
alignItems: "center",
|
|
63
64
|
children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
64
65
|
color: connected ? "primary" : "inherit",
|
|
65
|
-
fontSize: "1rem",
|
|
66
66
|
fontWeight: "bold",
|
|
67
|
+
sx: {
|
|
68
|
+
display: "-webkit-box",
|
|
69
|
+
wordBreak: "break-word",
|
|
70
|
+
WebkitLineClamp: 2,
|
|
71
|
+
WebkitBoxOrient: "vertical",
|
|
72
|
+
overflow: "hidden"
|
|
73
|
+
},
|
|
67
74
|
children: spaceGateway.name
|
|
68
75
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
69
76
|
label: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -81,7 +88,6 @@ function SpaceItem({
|
|
|
81
88
|
}
|
|
82
89
|
})]
|
|
83
90
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
84
|
-
className: "spaces-address",
|
|
85
91
|
display: "flex",
|
|
86
92
|
color: "#9397A1",
|
|
87
93
|
marginTop: "8px",
|
|
@@ -101,6 +107,19 @@ function SpaceItem({
|
|
|
101
107
|
})
|
|
102
108
|
})
|
|
103
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
|
+
})
|
|
104
123
|
})]
|
|
105
124
|
}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
|
|
106
125
|
className: "selected-container selected",
|
package/lib/libs/spaces.d.ts
CHANGED
package/lib/libs/spaces.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getSpaceHomeUrl = getSpaceHomeUrl;
|
|
6
7
|
exports.getSpaceNftDisplayUrlFromEndpoint = getSpaceNftDisplayUrlFromEndpoint;
|
|
7
8
|
var _ufo = require("ufo");
|
|
8
9
|
function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
|
|
@@ -10,4 +11,10 @@ function getSpaceNftDisplayUrlFromEndpoint(endpoint) {
|
|
|
10
11
|
const strArray = endpoint.replace(/\/$/, "").split("/");
|
|
11
12
|
const spaceDid = strArray.at(-4);
|
|
12
13
|
return (0, _ufo.joinURL)(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
|
|
14
|
+
}
|
|
15
|
+
function getSpaceHomeUrl(endpoint) {
|
|
16
|
+
const baseUrl = endpoint.replace(/\/api\/space\/.+/, "");
|
|
17
|
+
const strArray = endpoint.replace(/\/$/, "").split("/");
|
|
18
|
+
const spaceDid = strArray.at(-4);
|
|
19
|
+
return (0, _ufo.joinURL)(baseUrl, "space", spaceDid);
|
|
13
20
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.58",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@arcblock/did-connect": "^2.9.
|
|
66
|
-
"@arcblock/react-hooks": "^2.9.
|
|
67
|
-
"@arcblock/ux": "^2.9.
|
|
65
|
+
"@arcblock/did-connect": "^2.9.58",
|
|
66
|
+
"@arcblock/react-hooks": "^2.9.58",
|
|
67
|
+
"@arcblock/ux": "^2.9.58",
|
|
68
68
|
"@blocklet/js-sdk": "1.16.25-beta-be3a37f4",
|
|
69
69
|
"@emotion/react": "^11.10.4",
|
|
70
70
|
"@emotion/styled": "^11.10.4",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"jest": "^28.1.3",
|
|
109
109
|
"unbuild": "^2.0.0"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "908522ee6638e31a421ee0bb1942f0a20792ba8a"
|
|
112
112
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Box, Typography } from '@mui/material';
|
|
1
|
+
import { Box, Button, Typography } from '@mui/material';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import Button from '@arcblock/ux/lib/Button';
|
|
4
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
5
4
|
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
6
5
|
import { joinURL } from 'ufo';
|
|
7
6
|
import toast from '@arcblock/ux/lib/Toast';
|
|
8
7
|
import isEmpty from 'lodash/isEmpty';
|
|
8
|
+
import { RELAY_SOCKET_PREFIX } from '@arcblock/ux/lib/Util/constant';
|
|
9
9
|
import { axios } from '../../libs/api';
|
|
10
10
|
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
11
11
|
|
|
@@ -24,9 +24,7 @@ function ConnectTo({
|
|
|
24
24
|
checkTimeout: 1000 * 300,
|
|
25
25
|
prefix: '/api/did',
|
|
26
26
|
checkFn: axios.create({
|
|
27
|
-
|
|
28
|
-
// @ts-ignore
|
|
29
|
-
baseURL: joinURL(window.location.origin, window.env && window.env.apiPrefix ? window.env.apiPrefix : '/'),
|
|
27
|
+
baseURL: joinURL(window.location.origin, RELAY_SOCKET_PREFIX),
|
|
30
28
|
}).get,
|
|
31
29
|
extraParams: {},
|
|
32
30
|
messages: {
|
|
@@ -93,7 +91,7 @@ function ConnectTo({
|
|
|
93
91
|
<Box>
|
|
94
92
|
<Button
|
|
95
93
|
color="primary"
|
|
96
|
-
|
|
94
|
+
sx={{ textTransform: 'none !important', fontSize: '13px', paddingLeft: 0.75, paddingRight: 0.75 }}
|
|
97
95
|
size="small"
|
|
98
96
|
onClick={handleUseWalletConnect}
|
|
99
97
|
variant="outlined">
|
|
@@ -15,7 +15,7 @@ function Connected({
|
|
|
15
15
|
return (
|
|
16
16
|
<Box display="flex" flexDirection="column">
|
|
17
17
|
<Box display="flex" flexDirection="row" alignItems="center" justifyContent="space-between" marginBottom="12px">
|
|
18
|
-
<Typography fontSize="
|
|
18
|
+
<Typography fontSize="16px" fontWeight="bold">
|
|
19
19
|
{t('storage.spaces.connected.title')}
|
|
20
20
|
</Typography>
|
|
21
21
|
</Box>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Box, BoxProps, Chip, Typography } from '@mui/material';
|
|
1
|
+
import { Box, BoxProps, Chip, IconButton, Typography } from '@mui/material';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
3
|
import CheckIcon from '@mui/icons-material/Check';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import DidAddress from '@arcblock/ux/lib/DID';
|
|
6
|
-
|
|
6
|
+
import OpenInNewIcon from '@mui/icons-material/OpenInNew';
|
|
7
7
|
// @ts-expect-error
|
|
8
8
|
import SpacesConnectedSvg from './icons/space-connected.svg?react';
|
|
9
9
|
import PreviewSpaceNft from './preview-nft';
|
|
10
10
|
import { SpaceGateway } from '../../../contexts/config-user-space';
|
|
11
11
|
import useMobile from '../../../hooks/use-mobile';
|
|
12
|
-
import { getSpaceNftDisplayUrlFromEndpoint } from '../../../libs/spaces';
|
|
12
|
+
import { getSpaceHomeUrl, getSpaceNftDisplayUrlFromEndpoint } from '../../../libs/spaces';
|
|
13
13
|
|
|
14
14
|
function SpaceItem({
|
|
15
15
|
spaceGateway,
|
|
@@ -46,7 +46,16 @@ function SpaceItem({
|
|
|
46
46
|
flexDirection="column"
|
|
47
47
|
sx={{ marginLeft: '20px', padding: '0px 0px' }}>
|
|
48
48
|
<Box className="spaces-info" display="flex" maxWidth="360px" alignItems="center">
|
|
49
|
-
<Typography
|
|
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
|
+
}}>
|
|
50
59
|
{spaceGateway.name}
|
|
51
60
|
</Typography>
|
|
52
61
|
<Chip
|
|
@@ -61,7 +70,7 @@ function SpaceItem({
|
|
|
61
70
|
style={{ marginLeft: isMobile ? undefined : '20px', fontWeight: 'bold' }}
|
|
62
71
|
/>
|
|
63
72
|
</Box>
|
|
64
|
-
<Box
|
|
73
|
+
<Box display="flex" color="#9397A1" marginTop="8px">
|
|
65
74
|
<Typography
|
|
66
75
|
sx={{
|
|
67
76
|
display: 'inline-flex',
|
|
@@ -75,6 +84,13 @@ function SpaceItem({
|
|
|
75
84
|
</Typography>
|
|
76
85
|
</Box>
|
|
77
86
|
</Box>
|
|
87
|
+
<Box display="flex" alignItems="center">
|
|
88
|
+
<Box display="flex" alignItems="center" width="100%">
|
|
89
|
+
<IconButton size="small" onClick={() => window.open(getSpaceHomeUrl(spaceGateway.endpoint))}>
|
|
90
|
+
<OpenInNewIcon />
|
|
91
|
+
</IconButton>
|
|
92
|
+
</Box>
|
|
93
|
+
</Box>
|
|
78
94
|
</Box>
|
|
79
95
|
|
|
80
96
|
<Box className="selected-container selected">
|
package/src/libs/spaces.tsx
CHANGED
|
@@ -8,3 +8,11 @@ export function getSpaceNftDisplayUrlFromEndpoint(endpoint: string): string {
|
|
|
8
8
|
|
|
9
9
|
return joinURL(prefix, `/api/space/nft/display?spaceDid=${spaceDid}`);
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
export function getSpaceHomeUrl(endpoint: string): string {
|
|
13
|
+
const baseUrl = endpoint.replace(/\/api\/space\/.+/, '');
|
|
14
|
+
const strArray = endpoint.replace(/\/$/, '').split('/');
|
|
15
|
+
const spaceDid = strArray.at(-4) as string;
|
|
16
|
+
|
|
17
|
+
return joinURL(baseUrl, 'space', spaceDid);
|
|
18
|
+
}
|