@blocklet/ui-react 3.0.9 → 3.0.11
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/BlockletStudio/index.js +70 -71
- package/lib/ComponentInstaller/index.js +85 -88
- package/lib/ComponentInstaller/installer-item.js +47 -53
- package/lib/ComponentInstaller/use-component-installed.js +32 -38
- package/lib/ComponentManager/components/add-component.js +47 -50
- package/lib/ComponentManager/components/publish-component.js +30 -31
- package/lib/ComponentManager/components/resource-dialog.js +28 -30
- package/lib/Dashboard/index.d.ts +1 -1
- package/lib/Dashboard/index.js +59 -61
- package/lib/Footer/index.js +51 -52
- package/lib/Footer/internal-footer.js +43 -47
- package/lib/Footer/layout/standard.js +11 -12
- package/lib/Footer/links.js +25 -28
- package/lib/Footer/social-media.js +17 -17
- package/lib/Header/index.js +81 -83
- package/lib/Notifications/Snackbar.js +76 -77
- package/lib/Notifications/hooks/use-title.js +34 -34
- package/lib/Notifications/utils.js +56 -60
- package/lib/UserCenter/components/config-inviter.js +17 -18
- package/lib/UserCenter/components/danger-zone.js +49 -52
- package/lib/UserCenter/components/nft.js +44 -45
- package/lib/UserCenter/components/notification.js +92 -99
- package/lib/UserCenter/components/passport.js +22 -22
- package/lib/UserCenter/components/privacy.js +6 -6
- package/lib/UserCenter/components/settings.js +40 -43
- package/lib/UserCenter/components/status-dialog/date-picker.js +7 -8
- package/lib/UserCenter/components/status-dialog/index.js +112 -114
- package/lib/UserCenter/components/status-selector/duration-menu.js +35 -36
- package/lib/UserCenter/components/status-selector/index.js +13 -13
- package/lib/UserCenter/components/storage/action.js +21 -22
- package/lib/UserCenter/components/storage/delete.js +24 -24
- package/lib/UserCenter/components/third-party-login/index.js +53 -53
- package/lib/UserCenter/components/third-party-login/third-party-item.js +87 -89
- package/lib/UserCenter/components/user-center.js +198 -207
- package/lib/UserCenter/components/user-info/metadata.js +343 -353
- package/lib/UserCenter/components/user-info/switch-role.js +17 -20
- package/lib/UserCenter/components/user-info/user-basic-info.js +79 -82
- package/lib/UserCenter/components/user-info/user-info.js +40 -40
- package/lib/UserCenter/components/user-info/user-status.js +97 -99
- package/lib/UserCenter/components/user-info/utils.js +34 -35
- package/lib/UserSessions/components/user-session-info.js +25 -28
- package/lib/UserSessions/components/user-sessions.js +169 -181
- package/lib/blocklets.js +62 -72
- package/lib/common/domain-warning.js +31 -31
- package/lib/common/header-addons.d.ts +1 -1
- package/lib/common/header-addons.js +49 -53
- package/lib/common/notification-addon.js +29 -32
- package/lib/common/ws.js +17 -18
- package/lib/contexts/config-user-space.js +16 -19
- package/lib/utils.js +44 -48
- package/package.json +11 -11
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Dialog as
|
|
4
|
-
import
|
|
5
|
-
import { Close as
|
|
6
|
-
import { translate as
|
|
7
|
-
import { useMemoizedFn as
|
|
8
|
-
import
|
|
9
|
-
import { useLocaleContext as
|
|
10
|
-
import { DurationEnum as
|
|
11
|
-
import { translations as
|
|
12
|
-
import
|
|
13
|
-
import { defaultButtonStyle as
|
|
14
|
-
const
|
|
1
|
+
import { jsxs as i, jsx as e, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c, useEffect as q, useMemo as Q, Suspense as D, createElement as I } from "react";
|
|
3
|
+
import { Dialog as V, DialogTitle as G, Typography as f, IconButton as H, DialogContent as J, FormControl as k, InputLabel as z, Select as W, MenuItem as w, ListItemIcon as M, Box as g, DialogActions as K, Button as v } from "@mui/material";
|
|
4
|
+
import b from "dayjs";
|
|
5
|
+
import { Close as U } from "@mui/icons-material";
|
|
6
|
+
import { translate as X } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { useMemoizedFn as Y } from "ahooks";
|
|
8
|
+
import R from "@arcblock/icons/lib/ArrowDown";
|
|
9
|
+
import { useLocaleContext as Z } from "@arcblock/ux/lib/Locale/context";
|
|
10
|
+
import { DurationEnum as u } from "../../../@types/index.js";
|
|
11
|
+
import { translations as _ } from "../../libs/locales.js";
|
|
12
|
+
import $ from "./date-picker.js";
|
|
13
|
+
import { defaultButtonStyle as T, primaryButtonStyle as tt } from "../user-info/utils.js";
|
|
14
|
+
const B = {
|
|
15
15
|
padding: "8px 16px",
|
|
16
16
|
borderRadius: "8px",
|
|
17
17
|
"&:hover": {
|
|
@@ -29,43 +29,41 @@ const O = {
|
|
|
29
29
|
alignItems: "center"
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
function
|
|
33
|
-
open:
|
|
34
|
-
onClose:
|
|
35
|
-
data:
|
|
36
|
-
selected:
|
|
37
|
-
onSelect:
|
|
38
|
-
timezone:
|
|
32
|
+
function ht({
|
|
33
|
+
open: A,
|
|
34
|
+
onClose: d,
|
|
35
|
+
data: p,
|
|
36
|
+
selected: n,
|
|
37
|
+
onSelect: m,
|
|
38
|
+
timezone: E = void 0
|
|
39
39
|
}) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if (o)
|
|
53
|
-
h(void 0);
|
|
40
|
+
const { locale: O } = Z(), o = Y((t, a = {}) => X(_, t, O, "en", a)), [l, C] = c(n?.value || ""), [r, S] = c(n?.duration || ""), [s, h] = c(n?.dateRange?.[1] || ""), [j, x] = c(!1);
|
|
41
|
+
q(() => {
|
|
42
|
+
C(n?.value || ""), S(n?.duration || ""), h(n?.dateRange?.[1] || "");
|
|
43
|
+
}, [n]);
|
|
44
|
+
const F = Q(() => l && r, [l, r]), L = p.find((t) => t.id === l), N = (t) => {
|
|
45
|
+
m({
|
|
46
|
+
value: t.id,
|
|
47
|
+
...t.duration ? { duration: t.duration } : {}
|
|
48
|
+
}), d();
|
|
49
|
+
}, y = (t = !1) => {
|
|
50
|
+
if (t)
|
|
51
|
+
m(void 0);
|
|
54
52
|
else {
|
|
55
|
-
const
|
|
56
|
-
|
|
53
|
+
const a = b();
|
|
54
|
+
m({
|
|
57
55
|
value: l,
|
|
58
|
-
...
|
|
59
|
-
...
|
|
56
|
+
...r ? { duration: r } : {},
|
|
57
|
+
...r === u.Custom && s ? { dateRange: [a.toDate(), b(s).toDate()] } : {}
|
|
60
58
|
});
|
|
61
59
|
}
|
|
62
|
-
|
|
60
|
+
d();
|
|
63
61
|
};
|
|
64
|
-
return /* @__PURE__ */
|
|
65
|
-
|
|
62
|
+
return /* @__PURE__ */ i(
|
|
63
|
+
V,
|
|
66
64
|
{
|
|
67
|
-
open:
|
|
68
|
-
onClose:
|
|
65
|
+
open: A,
|
|
66
|
+
onClose: d,
|
|
69
67
|
maxWidth: "xs",
|
|
70
68
|
fullWidth: !0,
|
|
71
69
|
PaperProps: {
|
|
@@ -74,78 +72,78 @@ function go({
|
|
|
74
72
|
}
|
|
75
73
|
},
|
|
76
74
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
|
|
75
|
+
/* @__PURE__ */ i(G, { sx: { borderBottom: "1px solid", borderColor: "divider" }, children: [
|
|
76
|
+
/* @__PURE__ */ e(f, { variant: "body1", sx: { fontSize: "16px !important", mb: 0 }, children: o("profile.setStatus") }),
|
|
77
|
+
/* @__PURE__ */ e(
|
|
78
|
+
H,
|
|
81
79
|
{
|
|
82
80
|
"aria-label": "close",
|
|
83
|
-
onClick:
|
|
81
|
+
onClick: d,
|
|
84
82
|
sx: {
|
|
85
83
|
position: "absolute",
|
|
86
84
|
right: 8,
|
|
87
85
|
top: 8,
|
|
88
|
-
color: (
|
|
86
|
+
color: (t) => t.palette.grey[500]
|
|
89
87
|
},
|
|
90
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ e(U, {})
|
|
91
89
|
}
|
|
92
90
|
)
|
|
93
91
|
] }),
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
/* @__PURE__ */
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
92
|
+
/* @__PURE__ */ i(J, { children: [
|
|
93
|
+
/* @__PURE__ */ i(k, { fullWidth: !0, sx: { mt: 2 }, children: [
|
|
94
|
+
/* @__PURE__ */ e(z, { size: "small", sx: { fontSize: "14px" }, children: o("profile.setStatus") }),
|
|
95
|
+
/* @__PURE__ */ e(
|
|
96
|
+
W,
|
|
99
97
|
{
|
|
100
98
|
value: l,
|
|
101
|
-
label:
|
|
102
|
-
onChange: (
|
|
103
|
-
|
|
99
|
+
label: o("profile.setStatus"),
|
|
100
|
+
onChange: (t) => {
|
|
101
|
+
C(t.target.value), x(!0);
|
|
104
102
|
},
|
|
105
103
|
variant: "outlined",
|
|
106
|
-
IconComponent: (
|
|
107
|
-
sx:
|
|
108
|
-
children:
|
|
109
|
-
|
|
104
|
+
IconComponent: (t) => /* @__PURE__ */ e(R, { ...t, width: 20, height: 20 }),
|
|
105
|
+
sx: B,
|
|
106
|
+
children: p.map((t) => /* @__PURE__ */ e(w, { value: t.id, children: /* @__PURE__ */ i(D, { fallback: null, children: [
|
|
107
|
+
t.icon && /* @__PURE__ */ e(M, { style: { minWidth: "24px" }, children: I(t.icon, {
|
|
110
108
|
style: { fontSize: "16px", width: "16px", height: "16px" }
|
|
111
109
|
}) }),
|
|
112
|
-
|
|
113
|
-
] }) },
|
|
110
|
+
t.name
|
|
111
|
+
] }) }, t.id))
|
|
114
112
|
}
|
|
115
113
|
)
|
|
116
114
|
] }),
|
|
117
|
-
l ? /* @__PURE__ */
|
|
118
|
-
/* @__PURE__ */
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
|
|
115
|
+
l ? /* @__PURE__ */ i(k, { fullWidth: !0, sx: { mt: "24px" }, children: [
|
|
116
|
+
/* @__PURE__ */ e(z, { size: "small", sx: { fontSize: "14px" }, children: o("profile.removeStatusAfter") }),
|
|
117
|
+
/* @__PURE__ */ e(
|
|
118
|
+
W,
|
|
121
119
|
{
|
|
122
|
-
value:
|
|
123
|
-
label:
|
|
124
|
-
onChange: (
|
|
125
|
-
const { value:
|
|
126
|
-
|
|
120
|
+
value: r,
|
|
121
|
+
label: o("profile.removeStatusAfter"),
|
|
122
|
+
onChange: (t) => {
|
|
123
|
+
const { value: a } = t.target;
|
|
124
|
+
S(a), a === u.Custom && h(b().toDate()), x(!0);
|
|
127
125
|
},
|
|
128
126
|
variant: "outlined",
|
|
129
|
-
IconComponent: (
|
|
130
|
-
sx:
|
|
131
|
-
children:
|
|
127
|
+
IconComponent: (t) => /* @__PURE__ */ e(R, { ...t, width: 20, height: 20 }),
|
|
128
|
+
sx: B,
|
|
129
|
+
children: L?.children?.map((t) => /* @__PURE__ */ e(w, { value: t.id, children: t.name }, t.id))
|
|
132
130
|
}
|
|
133
131
|
)
|
|
134
|
-
] }) : /* @__PURE__ */
|
|
135
|
-
/* @__PURE__ */
|
|
136
|
-
|
|
132
|
+
] }) : /* @__PURE__ */ i(g, { sx: { mt: "24px" }, children: [
|
|
133
|
+
/* @__PURE__ */ e(
|
|
134
|
+
f,
|
|
137
135
|
{
|
|
138
136
|
variant: "body2",
|
|
139
137
|
sx: {
|
|
140
138
|
color: "text.secondary"
|
|
141
139
|
},
|
|
142
|
-
children:
|
|
140
|
+
children: o("profile.quickSettings")
|
|
143
141
|
}
|
|
144
142
|
),
|
|
145
|
-
|
|
146
|
-
|
|
143
|
+
p.map((t) => /* @__PURE__ */ e(
|
|
144
|
+
g,
|
|
147
145
|
{
|
|
148
|
-
onClick: () =>
|
|
146
|
+
onClick: () => N(t),
|
|
149
147
|
sx: {
|
|
150
148
|
display: "flex",
|
|
151
149
|
alignItems: "center",
|
|
@@ -157,13 +155,13 @@ function go({
|
|
|
157
155
|
bgcolor: "action.hover"
|
|
158
156
|
}
|
|
159
157
|
},
|
|
160
|
-
children: /* @__PURE__ */
|
|
161
|
-
|
|
158
|
+
children: /* @__PURE__ */ i(D, { fallback: null, children: [
|
|
159
|
+
t.icon && /* @__PURE__ */ e(M, { style: { minWidth: "24px" }, children: I(t.icon, {
|
|
162
160
|
style: { fontSize: "16px", width: "16px", height: "16px" }
|
|
163
161
|
}) }),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
162
|
+
t.name,
|
|
163
|
+
t.durationName && /* @__PURE__ */ i(
|
|
164
|
+
f,
|
|
167
165
|
{
|
|
168
166
|
variant: "body2",
|
|
169
167
|
sx: {
|
|
@@ -171,55 +169,55 @@ function go({
|
|
|
171
169
|
},
|
|
172
170
|
children: [
|
|
173
171
|
"- ",
|
|
174
|
-
|
|
172
|
+
t.durationName
|
|
175
173
|
]
|
|
176
174
|
}
|
|
177
175
|
)
|
|
178
176
|
] })
|
|
179
177
|
},
|
|
180
|
-
|
|
178
|
+
t.id
|
|
181
179
|
))
|
|
182
180
|
] }),
|
|
183
|
-
|
|
184
|
-
|
|
181
|
+
r === u.Custom && /* @__PURE__ */ e(g, { sx: { mt: "24px" }, children: /* @__PURE__ */ e(
|
|
182
|
+
$,
|
|
185
183
|
{
|
|
186
|
-
value:
|
|
187
|
-
onChange: (
|
|
188
|
-
|
|
184
|
+
value: s,
|
|
185
|
+
onChange: (t) => {
|
|
186
|
+
h(t), x(!0);
|
|
189
187
|
},
|
|
190
|
-
label:
|
|
191
|
-
timezone:
|
|
192
|
-
error:
|
|
193
|
-
helperText:
|
|
188
|
+
label: o("profile.selectEndTime"),
|
|
189
|
+
timezone: E,
|
|
190
|
+
error: r === u.Custom && !s,
|
|
191
|
+
helperText: r === u.Custom && !s ? o("profile.pleaseSelectTime") : void 0
|
|
194
192
|
}
|
|
195
193
|
) })
|
|
196
194
|
] }),
|
|
197
|
-
/* @__PURE__ */
|
|
198
|
-
|
|
195
|
+
/* @__PURE__ */ e(K, { sx: { p: "16px 24px", borderTop: "1px solid", borderColor: "divider" }, children: n?.value && !j ? /* @__PURE__ */ e(
|
|
196
|
+
v,
|
|
199
197
|
{
|
|
200
|
-
sx: { ...
|
|
198
|
+
sx: { ...T, minWidth: "54px" },
|
|
201
199
|
size: "small",
|
|
202
200
|
variant: "outlined",
|
|
203
|
-
onClick: () =>
|
|
204
|
-
children:
|
|
201
|
+
onClick: () => y(!0),
|
|
202
|
+
children: o("profile.cleanStatus")
|
|
205
203
|
}
|
|
206
|
-
) : /* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
|
|
204
|
+
) : /* @__PURE__ */ i(P, { children: [
|
|
205
|
+
/* @__PURE__ */ e(v, { size: "small", variant: "outlined", sx: { ...T, minWidth: "54px" }, onClick: d, children: o("common.cancel") }),
|
|
206
|
+
/* @__PURE__ */ e(
|
|
207
|
+
v,
|
|
210
208
|
{
|
|
211
209
|
sx: {
|
|
212
|
-
...
|
|
210
|
+
...tt,
|
|
213
211
|
minWidth: "54px",
|
|
214
212
|
"&.Mui-disabled": {
|
|
215
213
|
backgroundColor: "rgba(0, 0, 0, 0.12)"
|
|
216
214
|
}
|
|
217
215
|
},
|
|
218
|
-
disabled: !
|
|
219
|
-
onClick: () =>
|
|
216
|
+
disabled: !F,
|
|
217
|
+
onClick: () => y(!1),
|
|
220
218
|
size: "small",
|
|
221
219
|
variant: "outlined",
|
|
222
|
-
children:
|
|
220
|
+
children: o("common.confirm")
|
|
223
221
|
}
|
|
224
222
|
)
|
|
225
223
|
] }) })
|
|
@@ -228,5 +226,5 @@ function go({
|
|
|
228
226
|
);
|
|
229
227
|
}
|
|
230
228
|
export {
|
|
231
|
-
|
|
229
|
+
ht as default
|
|
232
230
|
};
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { styled as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useLocaleContext as
|
|
5
|
-
import { useMemoizedFn as
|
|
6
|
-
import { translate as
|
|
7
|
-
import { translations as
|
|
8
|
-
import
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
const { locale: p } = C(), f = b((o, t = {}) => k(D, o, p, "en", t)), [e, l] = z(null), h = !!e, S = (o) => {
|
|
1
|
+
import { jsxs as s, Fragment as M, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { styled as g, Menu as x, Typography as v } from "@mui/material";
|
|
3
|
+
import { useState as y } from "react";
|
|
4
|
+
import { useLocaleContext as z } from "@arcblock/ux/lib/Locale/context";
|
|
5
|
+
import { useMemoizedFn as C } from "ahooks";
|
|
6
|
+
import { translate as b } from "@arcblock/ux/lib/Locale/util";
|
|
7
|
+
import { translations as k } from "../../libs/locales.js";
|
|
8
|
+
import u, { StyledMenu as D } from "./menu-item.js";
|
|
9
|
+
function B({ data: n, selected: t, onSelect: a }) {
|
|
10
|
+
const { locale: m } = z(), p = C((o, e = {}) => b(k, o, m, "en", e)), [i, l] = y(null), d = !!i, f = (o) => {
|
|
12
11
|
l(o.currentTarget);
|
|
13
|
-
},
|
|
12
|
+
}, c = () => {
|
|
14
13
|
l(null);
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
...
|
|
14
|
+
}, h = (o) => {
|
|
15
|
+
f(o);
|
|
16
|
+
}, S = (o, e) => {
|
|
17
|
+
a({
|
|
18
|
+
...t ?? {},
|
|
20
19
|
value: n.id,
|
|
21
|
-
duration:
|
|
22
|
-
}),
|
|
20
|
+
duration: e.id
|
|
21
|
+
}), c();
|
|
23
22
|
};
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */
|
|
27
|
-
|
|
23
|
+
return /* @__PURE__ */ s(M, { children: [
|
|
24
|
+
/* @__PURE__ */ r(u, { icon: n.icon, selected: t?.value === n.id, onClick: h, children: n.name }),
|
|
25
|
+
/* @__PURE__ */ s(
|
|
26
|
+
D,
|
|
28
27
|
{
|
|
29
28
|
anchorOrigin: {
|
|
30
29
|
vertical: "top",
|
|
@@ -34,12 +33,12 @@ function I({ data: n, selected: r, onSelect: m }) {
|
|
|
34
33
|
vertical: "top",
|
|
35
34
|
horizontal: "left"
|
|
36
35
|
},
|
|
37
|
-
open:
|
|
38
|
-
onClose:
|
|
39
|
-
anchorEl:
|
|
36
|
+
open: d,
|
|
37
|
+
onClose: c,
|
|
38
|
+
anchorEl: i,
|
|
40
39
|
children: [
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
40
|
+
/* @__PURE__ */ r(
|
|
41
|
+
v,
|
|
43
42
|
{
|
|
44
43
|
component: "span",
|
|
45
44
|
sx: {
|
|
@@ -47,14 +46,14 @@ function I({ data: n, selected: r, onSelect: m }) {
|
|
|
47
46
|
pl: 2,
|
|
48
47
|
fontSize: "14px"
|
|
49
48
|
},
|
|
50
|
-
children:
|
|
49
|
+
children: p("profile.removeStatusAfter")
|
|
51
50
|
}
|
|
52
51
|
),
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
n.children?.map((o) => /* @__PURE__ */ r(
|
|
53
|
+
u,
|
|
55
54
|
{
|
|
56
|
-
selected:
|
|
57
|
-
onClick: (
|
|
55
|
+
selected: t?.duration === o.id,
|
|
56
|
+
onClick: (e) => S(e, o),
|
|
58
57
|
children: o.name
|
|
59
58
|
},
|
|
60
59
|
o.id
|
|
@@ -64,7 +63,7 @@ function I({ data: n, selected: r, onSelect: m }) {
|
|
|
64
63
|
)
|
|
65
64
|
] });
|
|
66
65
|
}
|
|
67
|
-
const
|
|
66
|
+
const I = g(x)`
|
|
68
67
|
.MuiList-root {
|
|
69
68
|
min-width: 160px;
|
|
70
69
|
}
|
|
@@ -73,6 +72,6 @@ const $ = x(v)`
|
|
|
73
72
|
}
|
|
74
73
|
`;
|
|
75
74
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
I as MenuDiv,
|
|
76
|
+
B as default
|
|
78
77
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Typography as
|
|
3
|
-
import { translate as
|
|
1
|
+
import { jsxs as d, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { Typography as m } from "@mui/material";
|
|
3
|
+
import { translate as f } from "@arcblock/ux/lib/Locale/util";
|
|
4
4
|
import { useMemoizedFn as S } from "ahooks";
|
|
5
5
|
import { useLocaleContext as x } from "@arcblock/ux/lib/Locale/context";
|
|
6
6
|
import h from "./duration-menu.js";
|
|
7
7
|
import M, { StyledMenu as y } from "./menu-item.js";
|
|
8
8
|
import { translations as v } from "../../libs/locales.js";
|
|
9
|
-
function L({ data: e, open:
|
|
10
|
-
const { locale:
|
|
11
|
-
|
|
12
|
-
},
|
|
9
|
+
function L({ data: e, open: s, onSelect: a, anchorEl: l = void 0, selected: n }) {
|
|
10
|
+
const { locale: c } = x(), i = S((o, p = {}) => f(v, o, c, "en", p)), r = (o) => {
|
|
11
|
+
a(o);
|
|
12
|
+
}, u = () => e.map((o) => o.children ? /* @__PURE__ */ t(h, { data: o, selected: n, onSelect: r }, o.id) : /* @__PURE__ */ t(
|
|
13
13
|
M,
|
|
14
14
|
{
|
|
15
15
|
icon: o.icon,
|
|
16
|
-
selected:
|
|
17
|
-
onClick: () =>
|
|
16
|
+
selected: n?.value === o.id,
|
|
17
|
+
onClick: () => r({ value: o.id }),
|
|
18
18
|
children: o.name
|
|
19
19
|
},
|
|
20
20
|
o.id
|
|
21
21
|
));
|
|
22
|
-
return /* @__PURE__ */
|
|
22
|
+
return /* @__PURE__ */ d(y, { open: s, onClose: () => r(), anchorEl: l, children: [
|
|
23
23
|
/* @__PURE__ */ t(
|
|
24
|
-
|
|
24
|
+
m,
|
|
25
25
|
{
|
|
26
26
|
component: "span",
|
|
27
27
|
sx: {
|
|
@@ -29,10 +29,10 @@ function L({ data: e, open: a, onSelect: i, anchorEl: u = void 0, selected: r })
|
|
|
29
29
|
pl: 2,
|
|
30
30
|
fontSize: "14px"
|
|
31
31
|
},
|
|
32
|
-
children:
|
|
32
|
+
children: i("profile.setStatus")
|
|
33
33
|
}
|
|
34
34
|
),
|
|
35
|
-
|
|
35
|
+
u()
|
|
36
36
|
] });
|
|
37
37
|
}
|
|
38
38
|
export {
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { DIDSpaceStatus as
|
|
3
|
-
import { Stack as
|
|
4
|
-
import
|
|
5
|
-
import { OpenInNew as
|
|
6
|
-
import { getSpaceHomeUrl as
|
|
7
|
-
import { formatAxiosError as
|
|
8
|
-
function
|
|
1
|
+
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { DIDSpaceStatus as i, DIDSpaceConnect as p } from "@blocklet/did-space-react";
|
|
3
|
+
import { Stack as m, IconButton as d, Link as s } from "@mui/material";
|
|
4
|
+
import u from "@arcblock/ux/lib/Toast";
|
|
5
|
+
import { OpenInNew as f } from "@mui/icons-material";
|
|
6
|
+
import { getSpaceHomeUrl as l } from "../../../libs/spaces.js";
|
|
7
|
+
import { formatAxiosError as S } from "../../libs/utils.js";
|
|
8
|
+
function g({
|
|
9
9
|
session: r,
|
|
10
|
-
spaceGateway:
|
|
11
|
-
spaceStatus:
|
|
12
|
-
refresh:
|
|
10
|
+
spaceGateway: t,
|
|
11
|
+
spaceStatus: n,
|
|
12
|
+
refresh: c
|
|
13
13
|
}) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
u,
|
|
14
|
+
return /* @__PURE__ */ a(m, { direction: "row", spacing: 1, children: [
|
|
15
|
+
n === i.DISCONNECTED && /* @__PURE__ */ o(
|
|
16
|
+
p,
|
|
18
17
|
{
|
|
19
18
|
reconnect: !0,
|
|
20
19
|
variant: "outlined",
|
|
21
20
|
session: r,
|
|
22
|
-
spaceDid:
|
|
23
|
-
spaceGatewayUrl:
|
|
21
|
+
spaceDid: r.user?.didSpace?.did,
|
|
22
|
+
spaceGatewayUrl: r.user?.didSpace?.url,
|
|
24
23
|
connectScope: "user",
|
|
25
24
|
onSuccess: async () => {
|
|
26
|
-
await
|
|
25
|
+
await c();
|
|
27
26
|
},
|
|
28
|
-
onError: (
|
|
29
|
-
console.error(
|
|
27
|
+
onError: (e) => {
|
|
28
|
+
console.error(e), u.error(S(e));
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
),
|
|
33
|
-
/* @__PURE__ */ o(
|
|
32
|
+
/* @__PURE__ */ o(d, { size: "small", LinkComponent: s, href: l(t.endpoint), target: "_blank", children: /* @__PURE__ */ o(f, {}) })
|
|
34
33
|
] });
|
|
35
34
|
}
|
|
36
35
|
export {
|
|
37
|
-
|
|
36
|
+
g as default
|
|
38
37
|
};
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { jsxs as d, Fragment as u, jsx as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsxs as d, Fragment as u, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useState as c } from "react";
|
|
3
3
|
import { IconButton as g } from "@mui/material";
|
|
4
4
|
import { DeleteOutline as x } from "@mui/icons-material";
|
|
5
5
|
import C from "@arcblock/ux/lib/Dialog/confirm";
|
|
6
6
|
import { useLocaleContext as h } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
-
import
|
|
8
|
-
function
|
|
9
|
-
spaceGateway:
|
|
10
|
-
onDeleteSpace:
|
|
7
|
+
import y from "@arcblock/ux/lib/Toast";
|
|
8
|
+
function P({
|
|
9
|
+
spaceGateway: r,
|
|
10
|
+
onDeleteSpace: l
|
|
11
11
|
}) {
|
|
12
|
-
const { t:
|
|
13
|
-
o
|
|
14
|
-
},
|
|
12
|
+
const { t: e } = h(), [m, a] = c(!1), [p, i] = c(!1), s = (o, t) => {
|
|
13
|
+
o?.stopPropagation(), a(t);
|
|
14
|
+
}, f = async (o) => {
|
|
15
15
|
try {
|
|
16
|
-
o
|
|
17
|
-
} catch (
|
|
18
|
-
console.error(
|
|
16
|
+
o?.stopPropagation(), i(!0), await l(r), a(!1);
|
|
17
|
+
} catch (t) {
|
|
18
|
+
console.error(t), y.error(`${e("storage.spaces.gateway.delete.failed")}: ${t.message}`);
|
|
19
19
|
} finally {
|
|
20
|
-
|
|
20
|
+
i(!1);
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
return /* @__PURE__ */ d(u, { children: [
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */
|
|
24
|
+
/* @__PURE__ */ n(g, { size: "small", onClick: (o) => s(o, !0), children: /* @__PURE__ */ n(x, {}) }),
|
|
25
|
+
/* @__PURE__ */ n(
|
|
26
26
|
C,
|
|
27
27
|
{
|
|
28
|
-
title:
|
|
29
|
-
data: `${
|
|
28
|
+
title: e("common.delConfirmDescription", {
|
|
29
|
+
data: `${r?.name}`
|
|
30
30
|
}),
|
|
31
|
-
open:
|
|
31
|
+
open: m,
|
|
32
32
|
confirmButton: {
|
|
33
|
-
text:
|
|
33
|
+
text: e("common.confirm"),
|
|
34
34
|
props: {
|
|
35
35
|
variant: "contained",
|
|
36
36
|
color: "error",
|
|
37
|
-
loading:
|
|
37
|
+
loading: p
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
cancelButton: {
|
|
41
|
-
text:
|
|
41
|
+
text: e("common.cancel"),
|
|
42
42
|
props: {
|
|
43
43
|
variant: "contained",
|
|
44
44
|
color: "primary"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
onConfirm:
|
|
48
|
-
onCancel: (o) =>
|
|
47
|
+
onConfirm: f,
|
|
48
|
+
onCancel: (o) => s(o, !1)
|
|
49
49
|
}
|
|
50
50
|
)
|
|
51
51
|
] });
|
|
52
52
|
}
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
P as default
|
|
55
55
|
};
|