@blocklet/ui-react 2.9.20 → 2.9.22
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/ComponentInstaller/index.d.ts +6 -2
- package/es/ComponentInstaller/index.js +6 -0
- package/es/ComponentInstaller/use-component-installed.d.ts +2 -2
- package/es/ComponentInstaller/use-component-installed.js +6 -4
- package/es/UserCenter/components/passport.js +8 -3
- package/es/UserCenter/components/user-info.js +2 -2
- package/lib/ComponentInstaller/index.d.ts +6 -2
- package/lib/ComponentInstaller/index.js +6 -0
- package/lib/ComponentInstaller/use-component-installed.d.ts +2 -2
- package/lib/ComponentInstaller/use-component-installed.js +9 -7
- package/lib/UserCenter/components/passport.js +7 -2
- package/lib/UserCenter/components/user-info.js +2 -2
- package/package.json +6 -5
- package/src/ComponentInstaller/index.jsx +7 -0
- package/src/ComponentInstaller/use-component-installed.js +6 -4
- package/src/UserCenter/components/passport.tsx +8 -3
- package/src/UserCenter/components/user-info.tsx +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ComponentInstaller;
|
|
2
|
-
declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstalled, onError, children, closeByOutSize, onClose, fallback, roles, }: {
|
|
2
|
+
declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstalled, onError, children, closeByOutSize, onClose, fallback, disabled, roles, }: {
|
|
3
3
|
warnIcon: any;
|
|
4
4
|
did: any;
|
|
5
5
|
noPermissionMute: any;
|
|
@@ -9,10 +9,12 @@ declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstall
|
|
|
9
9
|
closeByOutSize: any;
|
|
10
10
|
onClose: any;
|
|
11
11
|
fallback: any;
|
|
12
|
+
disabled: any;
|
|
12
13
|
roles?: string[] | undefined;
|
|
13
|
-
}):
|
|
14
|
+
}): any;
|
|
14
15
|
declare namespace ComponentInstaller {
|
|
15
16
|
namespace propTypes {
|
|
17
|
+
let disabled: any;
|
|
16
18
|
let warnIcon: any;
|
|
17
19
|
let did: any;
|
|
18
20
|
let noPermissionMute: any;
|
|
@@ -25,6 +27,8 @@ declare namespace ComponentInstaller {
|
|
|
25
27
|
let roles: any;
|
|
26
28
|
}
|
|
27
29
|
namespace defaultProps {
|
|
30
|
+
let disabled_1: boolean;
|
|
31
|
+
export { disabled_1 as disabled };
|
|
28
32
|
let warnIcon_1: null;
|
|
29
33
|
export { warnIcon_1 as warnIcon };
|
|
30
34
|
let noPermissionMute_1: boolean;
|
|
@@ -21,6 +21,7 @@ function ComponentInstaller({
|
|
|
21
21
|
closeByOutSize,
|
|
22
22
|
onClose,
|
|
23
23
|
fallback,
|
|
24
|
+
disabled,
|
|
24
25
|
roles = ["owner", "admin"]
|
|
25
26
|
}) {
|
|
26
27
|
const { locale } = useLocaleContext();
|
|
@@ -46,6 +47,9 @@ function ComponentInstaller({
|
|
|
46
47
|
window.location.reload();
|
|
47
48
|
};
|
|
48
49
|
const size = 60;
|
|
50
|
+
if (disabled) {
|
|
51
|
+
return children;
|
|
52
|
+
}
|
|
49
53
|
return /* @__PURE__ */ jsx(SessionPermission, { session: sessionCtx?.session, roles, children: ({ hasPermission }) => {
|
|
50
54
|
if (installed) {
|
|
51
55
|
return children;
|
|
@@ -274,6 +278,7 @@ function ComponentInstaller({
|
|
|
274
278
|
} });
|
|
275
279
|
}
|
|
276
280
|
ComponentInstaller.propTypes = {
|
|
281
|
+
disabled: PropTypes.bool,
|
|
277
282
|
warnIcon: PropTypes.node,
|
|
278
283
|
did: PropTypes.string.isRequired,
|
|
279
284
|
noPermissionMute: PropTypes.bool,
|
|
@@ -286,6 +291,7 @@ ComponentInstaller.propTypes = {
|
|
|
286
291
|
roles: PropTypes.array
|
|
287
292
|
};
|
|
288
293
|
ComponentInstaller.defaultProps = {
|
|
294
|
+
disabled: false,
|
|
289
295
|
warnIcon: null,
|
|
290
296
|
noPermissionMute: false,
|
|
291
297
|
onInstalled: null,
|
|
@@ -6,8 +6,8 @@ declare function useComponentInstalled({ did, onInstalled, onError }: {
|
|
|
6
6
|
}): {
|
|
7
7
|
optionalComponent: any;
|
|
8
8
|
installed: any;
|
|
9
|
-
installUrl:
|
|
10
|
-
storeUrl:
|
|
9
|
+
installUrl: any;
|
|
10
|
+
storeUrl: any;
|
|
11
11
|
installStatus: string;
|
|
12
12
|
setInstallStatus: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
13
13
|
installStatusDone: boolean;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AUTH_SERVICE_PREFIX } from '@arcblock/did-connect/lib/constant';
|
|
2
2
|
import { useMemo, useRef, useState, useEffect } from 'react';
|
|
3
|
+
import urlJoin from 'url-join';
|
|
3
4
|
|
|
4
5
|
function useComponentInstalled({ did, onInstalled, onError }) {
|
|
5
|
-
const
|
|
6
|
+
const [installStatus, setInstallStatus] = useState('');
|
|
6
7
|
const onInstalledRef = useRef({ onInstalled, onError });
|
|
7
8
|
onInstalledRef.current = { onInstalled, onError };
|
|
8
9
|
|
|
10
|
+
const { optionalComponents, componentMountPoints } = window.blocklet;
|
|
11
|
+
|
|
9
12
|
const optionalComponent = useMemo(() => {
|
|
10
13
|
if (!optionalComponents || !optionalComponents.length) {
|
|
11
14
|
return null;
|
|
@@ -22,9 +25,8 @@ function useComponentInstalled({ did, onInstalled, onError }) {
|
|
|
22
25
|
return (componentMountPoints || []).find((item) => item.did === did);
|
|
23
26
|
}, [optionalComponent, componentMountPoints, did]);
|
|
24
27
|
|
|
25
|
-
const installUrl =
|
|
26
|
-
const storeUrl = optionalComponent ?
|
|
27
|
-
const [installStatus, setInstallStatus] = useState('');
|
|
28
|
+
const installUrl = urlJoin(window.blocklet.appUrl, AUTH_SERVICE_PREFIX, `/admin/components?install-component=${did}`);
|
|
29
|
+
const storeUrl = optionalComponent ? urlJoin(optionalComponent.meta.homepage, 'blocklets', did) : '';
|
|
28
30
|
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
const handle = (event) => {
|
|
@@ -3,14 +3,19 @@ import { Stack } from "@mui/material";
|
|
|
3
3
|
import Empty from "@arcblock/ux/lib/Empty";
|
|
4
4
|
import { useTheme } from "@arcblock/ux/lib/Theme";
|
|
5
5
|
import { temp as colors } from "@arcblock/ux/lib/Colors";
|
|
6
|
-
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
6
|
import PassportItem from "@arcblock/ux/lib/Passport";
|
|
8
7
|
import { PASSPORT_STATUS } from "@abtnode/constant";
|
|
9
|
-
import { useCreation } from "ahooks";
|
|
8
|
+
import { useCreation, useMemoizedFn } from "ahooks";
|
|
10
9
|
import uniqBy from "lodash/uniqBy";
|
|
10
|
+
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
11
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
12
|
+
import { translations } from "../libs/locales.js";
|
|
11
13
|
import { createPassportSvg } from "../libs/utils.js";
|
|
12
14
|
export default function Passport({ user, ...rest }) {
|
|
13
|
-
const {
|
|
15
|
+
const { locale } = useLocaleContext();
|
|
16
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
17
|
+
return translate(translations, key, locale, "en", data);
|
|
18
|
+
});
|
|
14
19
|
const theme = useTheme();
|
|
15
20
|
const passports = useCreation(() => {
|
|
16
21
|
const passportList = (user?.passports || []).map((x) => ({
|
|
@@ -6,11 +6,11 @@ import MailOutlineRoundedIcon from "@iconify-icons/material-symbols/mail-outline
|
|
|
6
6
|
import ScheduleOutlineRoundedIcon from "@iconify-icons/material-symbols/schedule-outline-rounded";
|
|
7
7
|
import MoreTimeRoundedIcon from "@iconify-icons/material-symbols/more-time-rounded";
|
|
8
8
|
import CaptivePortalRoundedIcon from "@iconify-icons/material-symbols/captive-portal-rounded";
|
|
9
|
+
import RelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
9
10
|
import { translate } from "@arcblock/ux/lib/Locale/util";
|
|
10
11
|
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
11
|
-
import RelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
12
|
-
import UserInfoItem from "./user-info-item.js";
|
|
13
12
|
import { translations } from "../libs/locales.js";
|
|
13
|
+
import UserInfoItem from "./user-info-item.js";
|
|
14
14
|
export default function UserInfo({
|
|
15
15
|
user,
|
|
16
16
|
...rest
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export default ComponentInstaller;
|
|
2
|
-
declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstalled, onError, children, closeByOutSize, onClose, fallback, roles, }: {
|
|
2
|
+
declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstalled, onError, children, closeByOutSize, onClose, fallback, disabled, roles, }: {
|
|
3
3
|
warnIcon: any;
|
|
4
4
|
did: any;
|
|
5
5
|
noPermissionMute: any;
|
|
@@ -9,10 +9,12 @@ declare function ComponentInstaller({ warnIcon, did, noPermissionMute, onInstall
|
|
|
9
9
|
closeByOutSize: any;
|
|
10
10
|
onClose: any;
|
|
11
11
|
fallback: any;
|
|
12
|
+
disabled: any;
|
|
12
13
|
roles?: string[] | undefined;
|
|
13
|
-
}):
|
|
14
|
+
}): any;
|
|
14
15
|
declare namespace ComponentInstaller {
|
|
15
16
|
namespace propTypes {
|
|
17
|
+
let disabled: any;
|
|
16
18
|
let warnIcon: any;
|
|
17
19
|
let did: any;
|
|
18
20
|
let noPermissionMute: any;
|
|
@@ -25,6 +27,8 @@ declare namespace ComponentInstaller {
|
|
|
25
27
|
let roles: any;
|
|
26
28
|
}
|
|
27
29
|
namespace defaultProps {
|
|
30
|
+
let disabled_1: boolean;
|
|
31
|
+
export { disabled_1 as disabled };
|
|
28
32
|
let warnIcon_1: null;
|
|
29
33
|
export { warnIcon_1 as warnIcon };
|
|
30
34
|
let noPermissionMute_1: boolean;
|
|
@@ -28,6 +28,7 @@ function ComponentInstaller({
|
|
|
28
28
|
closeByOutSize,
|
|
29
29
|
onClose,
|
|
30
30
|
fallback,
|
|
31
|
+
disabled,
|
|
31
32
|
roles = ["owner", "admin"]
|
|
32
33
|
}) {
|
|
33
34
|
const {
|
|
@@ -63,6 +64,9 @@ function ComponentInstaller({
|
|
|
63
64
|
window.location.reload();
|
|
64
65
|
};
|
|
65
66
|
const size = 60;
|
|
67
|
+
if (disabled) {
|
|
68
|
+
return children;
|
|
69
|
+
}
|
|
66
70
|
return /* @__PURE__ */(0, _jsxRuntime.jsx)(_SessionPermission.default, {
|
|
67
71
|
session: sessionCtx?.session,
|
|
68
72
|
roles,
|
|
@@ -357,6 +361,7 @@ function ComponentInstaller({
|
|
|
357
361
|
});
|
|
358
362
|
}
|
|
359
363
|
ComponentInstaller.propTypes = {
|
|
364
|
+
disabled: _propTypes.default.bool,
|
|
360
365
|
warnIcon: _propTypes.default.node,
|
|
361
366
|
did: _propTypes.default.string.isRequired,
|
|
362
367
|
noPermissionMute: _propTypes.default.bool,
|
|
@@ -369,6 +374,7 @@ ComponentInstaller.propTypes = {
|
|
|
369
374
|
roles: _propTypes.default.array
|
|
370
375
|
};
|
|
371
376
|
ComponentInstaller.defaultProps = {
|
|
377
|
+
disabled: false,
|
|
372
378
|
warnIcon: null,
|
|
373
379
|
noPermissionMute: false,
|
|
374
380
|
onInstalled: null,
|
|
@@ -6,8 +6,8 @@ declare function useComponentInstalled({ did, onInstalled, onError }: {
|
|
|
6
6
|
}): {
|
|
7
7
|
optionalComponent: any;
|
|
8
8
|
installed: any;
|
|
9
|
-
installUrl:
|
|
10
|
-
storeUrl:
|
|
9
|
+
installUrl: any;
|
|
10
|
+
storeUrl: any;
|
|
11
11
|
installStatus: string;
|
|
12
12
|
setInstallStatus: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
13
13
|
installStatusDone: boolean;
|
|
@@ -6,15 +6,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _constant = require("@arcblock/did-connect/lib/constant");
|
|
8
8
|
var _react = require("react");
|
|
9
|
+
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
11
|
function useComponentInstalled({
|
|
10
12
|
did,
|
|
11
13
|
onInstalled,
|
|
12
14
|
onError
|
|
13
15
|
}) {
|
|
14
|
-
const
|
|
15
|
-
optionalComponents,
|
|
16
|
-
componentMountPoints
|
|
17
|
-
} = window.blocklet;
|
|
16
|
+
const [installStatus, setInstallStatus] = (0, _react.useState)('');
|
|
18
17
|
const onInstalledRef = (0, _react.useRef)({
|
|
19
18
|
onInstalled,
|
|
20
19
|
onError
|
|
@@ -23,6 +22,10 @@ function useComponentInstalled({
|
|
|
23
22
|
onInstalled,
|
|
24
23
|
onError
|
|
25
24
|
};
|
|
25
|
+
const {
|
|
26
|
+
optionalComponents,
|
|
27
|
+
componentMountPoints
|
|
28
|
+
} = window.blocklet;
|
|
26
29
|
const optionalComponent = (0, _react.useMemo)(() => {
|
|
27
30
|
if (!optionalComponents || !optionalComponents.length) {
|
|
28
31
|
return null;
|
|
@@ -37,9 +40,8 @@ function useComponentInstalled({
|
|
|
37
40
|
}
|
|
38
41
|
return (componentMountPoints || []).find(item => item.did === did);
|
|
39
42
|
}, [optionalComponent, componentMountPoints, did]);
|
|
40
|
-
const installUrl =
|
|
41
|
-
const storeUrl = optionalComponent ?
|
|
42
|
-
const [installStatus, setInstallStatus] = (0, _react.useState)('');
|
|
43
|
+
const installUrl = (0, _urlJoin.default)(window.blocklet.appUrl, _constant.AUTH_SERVICE_PREFIX, `/admin/components?install-component=${did}`);
|
|
44
|
+
const storeUrl = optionalComponent ? (0, _urlJoin.default)(optionalComponent.meta.homepage, 'blocklets', did) : '';
|
|
43
45
|
(0, _react.useEffect)(() => {
|
|
44
46
|
const handle = event => {
|
|
45
47
|
if (event.origin !== window.blocklet.appUrl) {
|
|
@@ -9,11 +9,13 @@ var _material = require("@mui/material");
|
|
|
9
9
|
var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
|
|
10
10
|
var _Theme = require("@arcblock/ux/lib/Theme");
|
|
11
11
|
var _Colors = require("@arcblock/ux/lib/Colors");
|
|
12
|
-
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
13
12
|
var _Passport = _interopRequireDefault(require("@arcblock/ux/lib/Passport"));
|
|
14
13
|
var _constant = require("@abtnode/constant");
|
|
15
14
|
var _ahooks = require("ahooks");
|
|
16
15
|
var _uniqBy = _interopRequireDefault(require("lodash/uniqBy"));
|
|
16
|
+
var _util = require("@arcblock/ux/lib/Locale/util");
|
|
17
|
+
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
18
|
+
var _locales = require("../libs/locales");
|
|
17
19
|
var _utils = require("../libs/utils");
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
function Passport({
|
|
@@ -21,8 +23,11 @@ function Passport({
|
|
|
21
23
|
...rest
|
|
22
24
|
}) {
|
|
23
25
|
const {
|
|
24
|
-
|
|
26
|
+
locale
|
|
25
27
|
} = (0, _context.useLocaleContext)();
|
|
28
|
+
const t = (0, _ahooks.useMemoizedFn)((key, data = {}) => {
|
|
29
|
+
return (0, _util.translate)(_locales.translations, key, locale, "en", data);
|
|
30
|
+
});
|
|
26
31
|
const theme = (0, _Theme.useTheme)();
|
|
27
32
|
const passports = (0, _ahooks.useCreation)(() => {
|
|
28
33
|
const passportList = (user?.passports || []).map(x => ({
|
|
@@ -12,11 +12,11 @@ var _mailOutlineRounded = _interopRequireDefault(require("@iconify-icons/materia
|
|
|
12
12
|
var _scheduleOutlineRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/schedule-outline-rounded"));
|
|
13
13
|
var _moreTimeRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/more-time-rounded"));
|
|
14
14
|
var _captivePortalRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/captive-portal-rounded"));
|
|
15
|
+
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
15
16
|
var _util = require("@arcblock/ux/lib/Locale/util");
|
|
16
17
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
17
|
-
var _RelativeTime = _interopRequireDefault(require("@arcblock/ux/lib/RelativeTime"));
|
|
18
|
-
var _userInfoItem = _interopRequireDefault(require("./user-info-item"));
|
|
19
18
|
var _locales = require("../libs/locales");
|
|
19
|
+
var _userInfoItem = _interopRequireDefault(require("./user-info-item"));
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
function UserInfo({
|
|
22
22
|
user,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.22",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@abtnode/constant": "1.16.23-beta-aeb9f5bd",
|
|
66
|
-
"@arcblock/did-connect": "^2.9.
|
|
67
|
-
"@arcblock/ux": "^2.9.
|
|
66
|
+
"@arcblock/did-connect": "^2.9.22",
|
|
67
|
+
"@arcblock/ux": "^2.9.22",
|
|
68
68
|
"@blocklet/js-sdk": "1.16.23-beta-aeb9f5bd",
|
|
69
69
|
"@emotion/react": "^11.10.4",
|
|
70
70
|
"@emotion/styled": "^11.10.4",
|
|
@@ -80,7 +80,8 @@
|
|
|
80
80
|
"lodash": "^4.17.21",
|
|
81
81
|
"react-error-boundary": "^3.1.4",
|
|
82
82
|
"react-placeholder": "^4.1.0",
|
|
83
|
-
"ufo": "^1.3.2"
|
|
83
|
+
"ufo": "^1.3.2",
|
|
84
|
+
"url-join": "^4.0.1"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
87
|
"react": ">=18.1.0"
|
|
@@ -98,5 +99,5 @@
|
|
|
98
99
|
"jest": "^28.1.3",
|
|
99
100
|
"unbuild": "^2.0.0"
|
|
100
101
|
},
|
|
101
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "c0d8c18928702f304f394df6f14a103136cb6efa"
|
|
102
103
|
}
|
|
@@ -21,6 +21,7 @@ function ComponentInstaller({
|
|
|
21
21
|
closeByOutSize,
|
|
22
22
|
onClose,
|
|
23
23
|
fallback,
|
|
24
|
+
disabled,
|
|
24
25
|
roles = ['owner', 'admin'],
|
|
25
26
|
}) {
|
|
26
27
|
const { locale } = useLocaleContext();
|
|
@@ -53,6 +54,10 @@ function ComponentInstaller({
|
|
|
53
54
|
|
|
54
55
|
const size = 60;
|
|
55
56
|
|
|
57
|
+
if (disabled) {
|
|
58
|
+
return children;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
return (
|
|
57
62
|
<SessionPermission session={sessionCtx?.session} roles={roles}>
|
|
58
63
|
{({ hasPermission }) => {
|
|
@@ -279,6 +284,7 @@ function ComponentInstaller({
|
|
|
279
284
|
}
|
|
280
285
|
|
|
281
286
|
ComponentInstaller.propTypes = {
|
|
287
|
+
disabled: PropTypes.bool,
|
|
282
288
|
warnIcon: PropTypes.node,
|
|
283
289
|
did: PropTypes.string.isRequired,
|
|
284
290
|
noPermissionMute: PropTypes.bool,
|
|
@@ -292,6 +298,7 @@ ComponentInstaller.propTypes = {
|
|
|
292
298
|
};
|
|
293
299
|
|
|
294
300
|
ComponentInstaller.defaultProps = {
|
|
301
|
+
disabled: false,
|
|
295
302
|
warnIcon: null,
|
|
296
303
|
noPermissionMute: false,
|
|
297
304
|
onInstalled: null,
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AUTH_SERVICE_PREFIX } from '@arcblock/did-connect/lib/constant';
|
|
2
2
|
import { useMemo, useRef, useState, useEffect } from 'react';
|
|
3
|
+
import urlJoin from 'url-join';
|
|
3
4
|
|
|
4
5
|
function useComponentInstalled({ did, onInstalled, onError }) {
|
|
5
|
-
const
|
|
6
|
+
const [installStatus, setInstallStatus] = useState('');
|
|
6
7
|
const onInstalledRef = useRef({ onInstalled, onError });
|
|
7
8
|
onInstalledRef.current = { onInstalled, onError };
|
|
8
9
|
|
|
10
|
+
const { optionalComponents, componentMountPoints } = window.blocklet;
|
|
11
|
+
|
|
9
12
|
const optionalComponent = useMemo(() => {
|
|
10
13
|
if (!optionalComponents || !optionalComponents.length) {
|
|
11
14
|
return null;
|
|
@@ -22,9 +25,8 @@ function useComponentInstalled({ did, onInstalled, onError }) {
|
|
|
22
25
|
return (componentMountPoints || []).find((item) => item.did === did);
|
|
23
26
|
}, [optionalComponent, componentMountPoints, did]);
|
|
24
27
|
|
|
25
|
-
const installUrl =
|
|
26
|
-
const storeUrl = optionalComponent ?
|
|
27
|
-
const [installStatus, setInstallStatus] = useState('');
|
|
28
|
+
const installUrl = urlJoin(window.blocklet.appUrl, AUTH_SERVICE_PREFIX, `/admin/components?install-component=${did}`);
|
|
29
|
+
const storeUrl = optionalComponent ? urlJoin(optionalComponent.meta.homepage, 'blocklets', did) : '';
|
|
28
30
|
|
|
29
31
|
useEffect(() => {
|
|
30
32
|
const handle = (event) => {
|
|
@@ -3,17 +3,22 @@ import type { StackProps } from '@mui/material';
|
|
|
3
3
|
import Empty from '@arcblock/ux/lib/Empty';
|
|
4
4
|
import { useTheme } from '@arcblock/ux/lib/Theme';
|
|
5
5
|
import { temp as colors } from '@arcblock/ux/lib/Colors';
|
|
6
|
-
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
7
6
|
import PassportItem from '@arcblock/ux/lib/Passport';
|
|
8
7
|
import { PASSPORT_STATUS } from '@abtnode/constant';
|
|
9
|
-
import { useCreation } from 'ahooks';
|
|
8
|
+
import { useCreation, useMemoizedFn } from 'ahooks';
|
|
10
9
|
import uniqBy from 'lodash/uniqBy';
|
|
10
|
+
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
11
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
11
12
|
|
|
13
|
+
import { translations } from '../libs/locales';
|
|
12
14
|
import { createPassportSvg } from '../libs/utils';
|
|
13
15
|
import type { User } from '../../@types';
|
|
14
16
|
|
|
15
17
|
export default function Passport({ user, ...rest }: { user: User } & StackProps) {
|
|
16
|
-
const {
|
|
18
|
+
const { locale } = useLocaleContext();
|
|
19
|
+
const t = useMemoizedFn((key, data = {}) => {
|
|
20
|
+
return translate(translations, key, locale, 'en', data);
|
|
21
|
+
});
|
|
17
22
|
const theme = useTheme();
|
|
18
23
|
const passports = useCreation(() => {
|
|
19
24
|
const passportList = (user?.passports || []).map((x) => ({
|
|
@@ -6,13 +6,13 @@ import MailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline
|
|
|
6
6
|
import ScheduleOutlineRoundedIcon from '@iconify-icons/material-symbols/schedule-outline-rounded';
|
|
7
7
|
import MoreTimeRoundedIcon from '@iconify-icons/material-symbols/more-time-rounded';
|
|
8
8
|
import CaptivePortalRoundedIcon from '@iconify-icons/material-symbols/captive-portal-rounded';
|
|
9
|
+
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
9
10
|
import { translate } from '@arcblock/ux/lib/Locale/util';
|
|
10
11
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
11
|
-
import RelativeTime from '@arcblock/ux/lib/RelativeTime';
|
|
12
12
|
|
|
13
|
+
import { translations } from '../libs/locales';
|
|
13
14
|
import UserInfoItem from './user-info-item';
|
|
14
15
|
import type { User } from '../../@types';
|
|
15
|
-
import { translations } from '../libs/locales';
|
|
16
16
|
|
|
17
17
|
export default function UserInfo({
|
|
18
18
|
user,
|