@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
package/lib/Header/index.js
CHANGED
|
@@ -1,143 +1,141 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useMemoizedFn as
|
|
4
|
-
import { withErrorBoundary as
|
|
5
|
-
import { ErrorFallback as
|
|
6
|
-
import { styled as
|
|
7
|
-
import { ResponsiveHeader as
|
|
8
|
-
import
|
|
9
|
-
import { useLocaleContext as
|
|
10
|
-
import { translate as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { mapRecursive as
|
|
17
|
-
import { formatBlockletInfo as
|
|
18
|
-
import
|
|
19
|
-
import { useWalletHiddenTopbar as
|
|
20
|
-
import
|
|
21
|
-
const
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as k } from "react";
|
|
3
|
+
import { useMemoizedFn as $ } from "ahooks";
|
|
4
|
+
import { withErrorBoundary as N } from "react-error-boundary";
|
|
5
|
+
import { ErrorFallback as H } from "@arcblock/ux/lib/ErrorBoundary";
|
|
6
|
+
import { styled as y, useTheme as C, deepmerge as T, ThemeProvider as _ } from "@arcblock/ux/lib/Theme";
|
|
7
|
+
import { ResponsiveHeader as E } from "@arcblock/ux/lib/Header";
|
|
8
|
+
import B, { Products as F } from "@arcblock/ux/lib/NavMenu";
|
|
9
|
+
import { useLocaleContext as L } from "@arcblock/ux/lib/Locale/context";
|
|
10
|
+
import { translate as P } from "@arcblock/ux/lib/Locale/util";
|
|
11
|
+
import R from "@arcblock/ux/lib/hooks/use-blocklet-logo";
|
|
12
|
+
import z from "lodash/omit";
|
|
13
|
+
import A from "lodash/isFinite";
|
|
14
|
+
import M from "clsx";
|
|
15
|
+
import W from "../Icon/index.js";
|
|
16
|
+
import { mapRecursive as j, flatRecursive as S, matchPaths as U } from "../utils.js";
|
|
17
|
+
import { formatBlockletInfo as K, getLocalizedNavigation as O, publicPath as q } from "../blocklets.js";
|
|
18
|
+
import D from "../common/header-addons.js";
|
|
19
|
+
import { useWalletHiddenTopbar as G } from "../common/wallet-hidden-topbar.js";
|
|
20
|
+
import J from "../libs/with-hide-when-embed.js";
|
|
21
|
+
const Q = {
|
|
22
22
|
en: {
|
|
23
23
|
products: "Products"
|
|
24
24
|
},
|
|
25
25
|
zh: {
|
|
26
26
|
products: "产品"
|
|
27
27
|
}
|
|
28
|
-
},
|
|
29
|
-
if (!
|
|
28
|
+
}, V = (e) => {
|
|
29
|
+
if (!e?.length)
|
|
30
30
|
return { navItems: [], activeId: null };
|
|
31
|
-
let
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
const n = o.icon ? /* @__PURE__ */ l(S, { icon: o.icon }) : null;
|
|
31
|
+
let r = 1;
|
|
32
|
+
const s = j(e, (o) => {
|
|
33
|
+
const i = o.icon ? /* @__PURE__ */ n(W, { icon: o.icon }) : null;
|
|
35
34
|
if (o.items)
|
|
36
35
|
return {
|
|
37
|
-
id: `${
|
|
36
|
+
id: `${r++}`,
|
|
38
37
|
label: o.title,
|
|
39
|
-
icon:
|
|
38
|
+
icon: i,
|
|
40
39
|
children: o.items
|
|
41
40
|
};
|
|
42
|
-
let
|
|
43
|
-
return (
|
|
41
|
+
let l = {};
|
|
42
|
+
return (o.link?.startsWith("http") || o.link?.startsWith("//")) && (l = {
|
|
44
43
|
target: "_blank",
|
|
45
44
|
rel: "noreferrer"
|
|
46
45
|
}), {
|
|
47
|
-
id: `${
|
|
48
|
-
label: /* @__PURE__ */
|
|
49
|
-
icon:
|
|
46
|
+
id: `${r++}`,
|
|
47
|
+
label: /* @__PURE__ */ n("a", { href: o.link, ...l, children: o.title }),
|
|
48
|
+
icon: i,
|
|
50
49
|
description: o.description,
|
|
51
50
|
link: o.link
|
|
52
51
|
};
|
|
53
|
-
}, "items"),
|
|
54
|
-
return { navItems:
|
|
52
|
+
}, "items"), a = S(s), d = U(a.map((o) => o.link));
|
|
53
|
+
return { navItems: s, activeId: d >= 0 ? a[d].id : null };
|
|
55
54
|
};
|
|
56
|
-
function
|
|
55
|
+
function X({
|
|
57
56
|
meta: e = {},
|
|
58
|
-
addons:
|
|
59
|
-
sessionManagerProps:
|
|
57
|
+
addons: r = void 0,
|
|
58
|
+
sessionManagerProps: u = {
|
|
60
59
|
showRole: !0
|
|
61
60
|
},
|
|
62
|
-
homeLink:
|
|
63
|
-
theme:
|
|
64
|
-
hideNavMenu:
|
|
61
|
+
homeLink: s = q,
|
|
62
|
+
theme: a = void 0,
|
|
63
|
+
hideNavMenu: d = !1,
|
|
65
64
|
showDomainWarningDialog: o = !0,
|
|
66
|
-
...
|
|
65
|
+
...i
|
|
67
66
|
}) {
|
|
68
|
-
|
|
69
|
-
Q()
|
|
70
|
-
|
|
71
|
-
const r = Object.assign({}, window.blocklet, e);
|
|
67
|
+
G();
|
|
68
|
+
const l = C(), { locale: h } = L() || {}, v = $((t, f = {}) => P(Q, t, h, "en", f)), m = k(() => {
|
|
69
|
+
const t = Object.assign({}, window.blocklet, e);
|
|
72
70
|
try {
|
|
73
|
-
return
|
|
74
|
-
} catch (
|
|
75
|
-
return console.error("Failed to format blocklet info",
|
|
71
|
+
return K(t);
|
|
72
|
+
} catch (f) {
|
|
73
|
+
return console.error("Failed to format blocklet info", f, t), t;
|
|
76
74
|
}
|
|
77
|
-
}, [e]),
|
|
75
|
+
}, [e]), c = k(() => T(l, a), [l, a]), x = R({
|
|
78
76
|
meta: e,
|
|
79
|
-
theme:
|
|
77
|
+
theme: a
|
|
80
78
|
});
|
|
81
|
-
if (!
|
|
79
|
+
if (!m.appName)
|
|
82
80
|
return null;
|
|
83
|
-
const
|
|
84
|
-
return
|
|
85
|
-
label:
|
|
81
|
+
const I = O(m?.navigation?.header, h), b = V(I), { navItems: p, activeId: w } = b, g = parseInt(window.blocklet?.USE_ARCBLOCK_THEME, 10);
|
|
82
|
+
return A(g) && p.splice(g, 0, {
|
|
83
|
+
label: v("products"),
|
|
86
84
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
87
|
-
children: ({ isOpen:
|
|
88
|
-
}), /* @__PURE__ */
|
|
89
|
-
|
|
85
|
+
children: ({ isOpen: t }) => /* @__PURE__ */ n(F, { isOpen: t })
|
|
86
|
+
}), /* @__PURE__ */ n(_, { theme: c, children: /* @__PURE__ */ n(
|
|
87
|
+
Y,
|
|
90
88
|
{
|
|
91
|
-
homeLink:
|
|
92
|
-
logo: /* @__PURE__ */
|
|
89
|
+
homeLink: s,
|
|
90
|
+
logo: /* @__PURE__ */ n("img", { src: x, alt: "logo" }),
|
|
93
91
|
addons: (
|
|
94
92
|
// @ts-ignore
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
93
|
+
/* @__PURE__ */ n(
|
|
94
|
+
D,
|
|
97
95
|
{
|
|
98
|
-
formattedBlocklet:
|
|
99
|
-
addons: typeof
|
|
100
|
-
sessionManagerProps:
|
|
96
|
+
formattedBlocklet: m,
|
|
97
|
+
addons: typeof r == "function" ? (t) => r(t, { navigation: b }) : r,
|
|
98
|
+
sessionManagerProps: u,
|
|
101
99
|
showDomainWarningDialog: o
|
|
102
100
|
}
|
|
103
101
|
)
|
|
104
102
|
),
|
|
105
|
-
...
|
|
106
|
-
$bordered:
|
|
107
|
-
$bgcolor:
|
|
108
|
-
className:
|
|
109
|
-
children:
|
|
103
|
+
...z(i, ["bordered"]),
|
|
104
|
+
$bordered: i?.bordered,
|
|
105
|
+
$bgcolor: c.palette.background.default,
|
|
106
|
+
className: M("blocklet__header", i.className),
|
|
107
|
+
children: d || !p?.length ? null : ({ isMobile: t }) => (
|
|
110
108
|
// @ts-ignore
|
|
111
|
-
/* @__PURE__ */
|
|
112
|
-
|
|
109
|
+
/* @__PURE__ */ n(
|
|
110
|
+
B,
|
|
113
111
|
{
|
|
114
|
-
mode:
|
|
115
|
-
activeId:
|
|
116
|
-
items:
|
|
112
|
+
mode: t ? "inline" : "horizontal",
|
|
113
|
+
activeId: w,
|
|
114
|
+
items: p,
|
|
117
115
|
className: "header-nav",
|
|
118
116
|
bgColor: "transparent",
|
|
119
|
-
textColor:
|
|
120
|
-
activeTextColor:
|
|
117
|
+
textColor: c.palette.grey[500],
|
|
118
|
+
activeTextColor: c.palette.text.primary
|
|
121
119
|
}
|
|
122
120
|
)
|
|
123
121
|
)
|
|
124
122
|
}
|
|
125
123
|
) });
|
|
126
124
|
}
|
|
127
|
-
const
|
|
125
|
+
const Y = y(E)`
|
|
128
126
|
${({ $bgcolor: e }) => `background-color: ${e || "#fff"};`}
|
|
129
127
|
.header-logo {
|
|
130
128
|
min-width: 44px;
|
|
131
129
|
}
|
|
132
|
-
${({ $bordered: e, theme:
|
|
130
|
+
${({ $bordered: e, theme: r }) => e ? `border-bottom: 1px solid ${r.palette.divider};` : ""}
|
|
133
131
|
${(e) => e.theme.breakpoints.down("md")} {
|
|
134
132
|
.header-logo {
|
|
135
133
|
min-width: 32px;
|
|
136
134
|
}
|
|
137
135
|
}
|
|
138
|
-
`,
|
|
139
|
-
FallbackComponent:
|
|
136
|
+
`, wo = N(J(X), {
|
|
137
|
+
FallbackComponent: H
|
|
140
138
|
});
|
|
141
139
|
export {
|
|
142
|
-
|
|
140
|
+
wo as default
|
|
143
141
|
};
|
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import { jsxs as c, jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import
|
|
4
|
-
import { green as
|
|
5
|
-
import { Box as
|
|
6
|
-
import { useCreation as
|
|
7
|
-
import { Close as
|
|
8
|
-
import { Icon as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { SnackbarContent as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { toClickableSpan as
|
|
17
|
-
const
|
|
18
|
-
normal:
|
|
19
|
-
success:
|
|
20
|
-
info:
|
|
21
|
-
warning:
|
|
22
|
-
error:
|
|
23
|
-
},
|
|
1
|
+
import { jsxs as c, jsx as e, Fragment as x } from "react/jsx-runtime";
|
|
2
|
+
import { useState as S, useEffect as $ } from "react";
|
|
3
|
+
import i from "@emotion/styled";
|
|
4
|
+
import { green as z, amber as D, common as a } from "@mui/material/colors";
|
|
5
|
+
import { Box as N, Typography as f, IconButton as A } from "@mui/material";
|
|
6
|
+
import { useCreation as s } from "ahooks";
|
|
7
|
+
import { Close as M } from "@mui/icons-material";
|
|
8
|
+
import { Icon as T } from "@iconify/react";
|
|
9
|
+
import W from "@iconify-icons/tabler/circle-check";
|
|
10
|
+
import B from "@iconify-icons/tabler/exclamation-circle";
|
|
11
|
+
import u from "@iconify-icons/tabler/info-circle";
|
|
12
|
+
import _ from "@iconify-icons/tabler/xbox-x";
|
|
13
|
+
import { SnackbarContent as j, useSnackbar as E } from "notistack";
|
|
14
|
+
import H from "./hooks/use-width.js";
|
|
15
|
+
import L from "./hooks/use-title.js";
|
|
16
|
+
import { toClickableSpan as O, isIncludeActivity as P, sanitize as F } from "./utils.js";
|
|
17
|
+
const G = {
|
|
18
|
+
normal: u,
|
|
19
|
+
success: W,
|
|
20
|
+
info: u,
|
|
21
|
+
warning: B,
|
|
22
|
+
error: _
|
|
23
|
+
}, R = i(M)`
|
|
24
24
|
font-size: 20px;
|
|
25
|
-
`,
|
|
25
|
+
`, q = i.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: flex-start;
|
|
28
28
|
gap: 8px;
|
|
29
29
|
flex: 1;
|
|
30
30
|
width: 0;
|
|
31
|
-
`,
|
|
31
|
+
`, J = i.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
align-items: center;
|
|
34
34
|
margin-left: auto;
|
|
35
35
|
margin-right: -8px;
|
|
36
36
|
width: 44px;
|
|
37
|
-
`,
|
|
37
|
+
`, K = {
|
|
38
38
|
xl: "400px",
|
|
39
39
|
lg: "400px",
|
|
40
40
|
md: "400px",
|
|
41
41
|
sm: "300px"
|
|
42
|
-
},
|
|
42
|
+
}, Q = i(j)`
|
|
43
43
|
display: flex;
|
|
44
44
|
color: #fff;
|
|
45
45
|
align-items: center;
|
|
@@ -50,26 +50,26 @@ const R = {
|
|
|
50
50
|
0px 6px 10px 0px rgba(0, 0, 0, 0.14),
|
|
51
51
|
0px 1px 18px 0px rgba(0, 0, 0, 0.12);
|
|
52
52
|
|
|
53
|
-
${({ severity:
|
|
54
|
-
const
|
|
55
|
-
return
|
|
56
|
-
background-color: ${
|
|
57
|
-
width: ${
|
|
58
|
-
` :
|
|
53
|
+
${({ severity: o, breakpoint: n }) => {
|
|
54
|
+
const t = K[n] || "400px";
|
|
55
|
+
return o === "success" ? `
|
|
56
|
+
background-color: ${z[600]} !important;
|
|
57
|
+
width: ${t};
|
|
58
|
+
` : o === "error" ? `
|
|
59
59
|
background-color: #d32f2f !important;
|
|
60
|
-
width: ${
|
|
61
|
-
` :
|
|
60
|
+
width: ${t};
|
|
61
|
+
` : o === "info" ? `
|
|
62
62
|
background-color: #1976d2 !important;
|
|
63
|
-
width: ${
|
|
64
|
-
` :
|
|
65
|
-
background-color: ${
|
|
66
|
-
width: ${
|
|
63
|
+
width: ${t};
|
|
64
|
+
` : o === "warning" ? `
|
|
65
|
+
background-color: ${D[700]} !important;
|
|
66
|
+
width: ${t};
|
|
67
67
|
` : `
|
|
68
68
|
background-color: #333;
|
|
69
|
-
width: ${
|
|
69
|
+
width: ${t};
|
|
70
70
|
`;
|
|
71
71
|
}}
|
|
72
|
-
`,
|
|
72
|
+
`, U = i.div`
|
|
73
73
|
cursor: pointer;
|
|
74
74
|
display: flex;
|
|
75
75
|
flex-direction: column;
|
|
@@ -96,43 +96,42 @@ const R = {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
`;
|
|
99
|
-
function
|
|
100
|
-
ref:
|
|
101
|
-
keyId:
|
|
102
|
-
notification:
|
|
103
|
-
viewAllUrl:
|
|
104
|
-
content:
|
|
99
|
+
function mt({
|
|
100
|
+
ref: o = void 0,
|
|
101
|
+
keyId: n,
|
|
102
|
+
notification: t = {},
|
|
103
|
+
viewAllUrl: b,
|
|
104
|
+
content: h = null
|
|
105
105
|
}) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
v(l);
|
|
106
|
+
const w = H(), [k, g] = S(t.description || ""), p = G[t.severity || ""], { closeSnackbar: d } = E(), v = () => d(n);
|
|
107
|
+
$(() => {
|
|
108
|
+
O(t.description || "", "en").then((l) => {
|
|
109
|
+
g(l);
|
|
111
110
|
});
|
|
112
|
-
}, [
|
|
113
|
-
const
|
|
114
|
-
l.stopPropagation(),
|
|
115
|
-
},
|
|
116
|
-
activity:
|
|
117
|
-
users: [
|
|
118
|
-
actors: [
|
|
111
|
+
}, [t.description]);
|
|
112
|
+
const y = (l) => {
|
|
113
|
+
l.stopPropagation(), d(n), l?.customPreventRedirect || window.open(b, "_blank");
|
|
114
|
+
}, C = s(() => P(t), [t]), r = s(() => t?.activity, [t]), m = s(() => !r || r.type === "tips" ? null : r?.meta, [r]), I = L({
|
|
115
|
+
activity: r,
|
|
116
|
+
users: [t?.actorInfo],
|
|
117
|
+
actors: [t?.activity?.actor],
|
|
119
118
|
extra: {
|
|
120
119
|
linkColor: a.white
|
|
121
120
|
}
|
|
122
121
|
});
|
|
123
122
|
return /* @__PURE__ */ c(
|
|
124
|
-
|
|
123
|
+
Q,
|
|
125
124
|
{
|
|
126
|
-
ref:
|
|
127
|
-
severity:
|
|
128
|
-
breakpoint:
|
|
125
|
+
ref: o,
|
|
126
|
+
severity: t.severity,
|
|
127
|
+
breakpoint: w,
|
|
129
128
|
children: [
|
|
130
|
-
/* @__PURE__ */ c(
|
|
131
|
-
|
|
132
|
-
/* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
|
|
135
|
-
|
|
129
|
+
/* @__PURE__ */ c(q, { children: [
|
|
130
|
+
p ? /* @__PURE__ */ e(T, { icon: p, fontSize: 24 }) : null,
|
|
131
|
+
/* @__PURE__ */ e(U, { onClick: y, style: { width: "calc(100% - 30px)" }, children: /* @__PURE__ */ e(N, { children: C ? /* @__PURE__ */ c(x, { children: [
|
|
132
|
+
/* @__PURE__ */ e("span", { className: "title", children: I }),
|
|
133
|
+
m ? /* @__PURE__ */ e(
|
|
134
|
+
f,
|
|
136
135
|
{
|
|
137
136
|
variant: "subtitle2",
|
|
138
137
|
component: "p",
|
|
@@ -146,26 +145,26 @@ function xe({
|
|
|
146
145
|
color: a.white,
|
|
147
146
|
lineHeight: 1.2
|
|
148
147
|
},
|
|
149
|
-
children:
|
|
148
|
+
children: m?.content
|
|
150
149
|
}
|
|
151
150
|
) : null
|
|
152
|
-
] }) : /* @__PURE__ */ c(
|
|
153
|
-
/* @__PURE__ */
|
|
154
|
-
|
|
155
|
-
|
|
151
|
+
] }) : /* @__PURE__ */ c(x, { children: [
|
|
152
|
+
/* @__PURE__ */ e("span", { className: "title", children: t.title }),
|
|
153
|
+
h || /* @__PURE__ */ e(
|
|
154
|
+
f,
|
|
156
155
|
{
|
|
157
156
|
component: "span",
|
|
158
157
|
className: "desc",
|
|
159
|
-
dangerouslySetInnerHTML: { __html:
|
|
158
|
+
dangerouslySetInnerHTML: { __html: F(k) }
|
|
160
159
|
}
|
|
161
160
|
)
|
|
162
161
|
] }) }) })
|
|
163
162
|
] }),
|
|
164
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { "aria-label": "close", color: "inherit", onClick: v, size: "large", children: /* @__PURE__ */ e(R, {}) }, "close") })
|
|
165
164
|
]
|
|
166
165
|
}
|
|
167
166
|
);
|
|
168
167
|
}
|
|
169
168
|
export {
|
|
170
|
-
|
|
169
|
+
mt as default
|
|
171
170
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as s, jsxs as
|
|
1
|
+
import { jsx as s, jsxs as i, Fragment as t } from "react/jsx-runtime";
|
|
2
2
|
import F from "react";
|
|
3
3
|
import { useCreation as f, useMemoizedFn as U } from "ahooks";
|
|
4
4
|
import { useTheme as C, Link as E } from "@mui/material";
|
|
@@ -7,37 +7,37 @@ import { joinURL as R, withQuery as S } from "ufo";
|
|
|
7
7
|
import D from "lodash/isEmpty";
|
|
8
8
|
import { getActivityLink as I } from "../utils.js";
|
|
9
9
|
const P = {
|
|
10
|
-
comment: (r,
|
|
10
|
+
comment: (r, o) => o && o > 1 ? /* @__PURE__ */ i(t, { children: [
|
|
11
11
|
"left ",
|
|
12
|
-
|
|
12
|
+
o,
|
|
13
13
|
" comments on your ",
|
|
14
14
|
r
|
|
15
|
-
] }) : /* @__PURE__ */
|
|
15
|
+
] }) : /* @__PURE__ */ i(t, { children: [
|
|
16
16
|
"commented on your ",
|
|
17
17
|
r
|
|
18
18
|
] }),
|
|
19
|
-
like: (r) => /* @__PURE__ */
|
|
19
|
+
like: (r) => /* @__PURE__ */ i(t, { children: [
|
|
20
20
|
"liked your ",
|
|
21
21
|
r
|
|
22
22
|
] }),
|
|
23
|
-
follow: () => /* @__PURE__ */ s(
|
|
24
|
-
tips: (r) => /* @__PURE__ */
|
|
23
|
+
follow: () => /* @__PURE__ */ s(t, { children: "followed you" }),
|
|
24
|
+
tips: (r) => /* @__PURE__ */ i(t, { children: [
|
|
25
25
|
"gave tips to your ",
|
|
26
26
|
r
|
|
27
27
|
] }),
|
|
28
|
-
mention: (r) => /* @__PURE__ */
|
|
28
|
+
mention: (r) => /* @__PURE__ */ i(t, { children: [
|
|
29
29
|
"mentioned you in ",
|
|
30
30
|
r
|
|
31
31
|
] }),
|
|
32
|
-
assign: () => /* @__PURE__ */ s(
|
|
32
|
+
assign: () => /* @__PURE__ */ s(t, { children: "assigned you a task" })
|
|
33
33
|
};
|
|
34
|
-
function a({ user: r, color:
|
|
35
|
-
const { palette: d } = C(), h = S(R(M, "user"), { did: r.did }),
|
|
34
|
+
function a({ user: r, color: o = void 0 }) {
|
|
35
|
+
const { palette: d } = C(), h = S(R(M, "user"), { did: r.did }), u = o || d.text.primary;
|
|
36
36
|
return /* @__PURE__ */ s(
|
|
37
37
|
E,
|
|
38
38
|
{
|
|
39
39
|
href: h,
|
|
40
|
-
color:
|
|
40
|
+
color: u,
|
|
41
41
|
target: "_blank",
|
|
42
42
|
onClick: (p) => {
|
|
43
43
|
p.customPreventRedirect = !0;
|
|
@@ -52,52 +52,52 @@ function a({ user: r, color: l = void 0 }) {
|
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
54
|
a.displayName = "UserLink";
|
|
55
|
-
function H({ activity: r, users:
|
|
56
|
-
const { palette: p } = C(), { type:
|
|
57
|
-
if (!Array.isArray(
|
|
55
|
+
function H({ activity: r, users: o, actors: d, extra: h = {}, mountPoint: u = "" }) {
|
|
56
|
+
const { palette: p } = C(), { type: m, target: g } = r || {}, { type: y } = g || {}, { linkColor: c = p.text.primary } = h || {}, k = f(() => {
|
|
57
|
+
if (!Array.isArray(o)) return /* @__PURE__ */ new Map();
|
|
58
58
|
const e = /* @__PURE__ */ new Map();
|
|
59
|
-
return
|
|
60
|
-
|
|
59
|
+
return o.forEach((l) => {
|
|
60
|
+
l?.did && !e.has(l.did) && e.set(l.did, l);
|
|
61
61
|
}), e;
|
|
62
|
-
}, [
|
|
62
|
+
}, [o]), n = f(() => Array.isArray(d) ? d.map((e) => e ? k.get(e) || { did: e, fullName: "System" } : null).filter(Boolean) : [], [d, k]), L = U(() => {
|
|
63
63
|
if (!Array.isArray(n) || n.length === 0)
|
|
64
64
|
return null;
|
|
65
65
|
if (n.length === 1)
|
|
66
66
|
return /* @__PURE__ */ s(a, { user: n[0], color: c });
|
|
67
|
-
const e = n.slice(0, -1),
|
|
67
|
+
const e = n.slice(0, -1), l = n[n.length - 1];
|
|
68
68
|
if (n.length === 2)
|
|
69
|
-
return /* @__PURE__ */
|
|
69
|
+
return /* @__PURE__ */ i(t, { children: [
|
|
70
70
|
/* @__PURE__ */ s(a, { user: e[0], color: c }),
|
|
71
71
|
" and ",
|
|
72
|
-
/* @__PURE__ */ s(a, { user:
|
|
72
|
+
/* @__PURE__ */ s(a, { user: l, color: c })
|
|
73
73
|
] });
|
|
74
74
|
const _ = n.length > 3, N = _ ? n.slice(0, 2) : e;
|
|
75
|
-
return /* @__PURE__ */
|
|
76
|
-
N.map((T, w) => /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ i(t, { children: [
|
|
76
|
+
N.map((T, w) => /* @__PURE__ */ i(F.Fragment, { children: [
|
|
77
77
|
/* @__PURE__ */ s(a, { user: T, color: c }),
|
|
78
78
|
w < N.length - 1 ? ", " : ""
|
|
79
79
|
] }, T.did)),
|
|
80
|
-
_ ? `, and ${n.length - 2} others` : /* @__PURE__ */
|
|
80
|
+
_ ? `, and ${n.length - 2} others` : /* @__PURE__ */ i(t, { children: [
|
|
81
81
|
", and ",
|
|
82
|
-
/* @__PURE__ */ s(a, { user:
|
|
82
|
+
/* @__PURE__ */ s(a, { user: l, color: c })
|
|
83
83
|
] })
|
|
84
84
|
] });
|
|
85
85
|
}), A = U(() => {
|
|
86
|
-
const e =
|
|
87
|
-
return e ? e(y,
|
|
86
|
+
const e = m ? P[m] : null;
|
|
87
|
+
return e ? e(y, o.length) : null;
|
|
88
88
|
}), v = f(() => {
|
|
89
|
-
const e = L(),
|
|
90
|
-
return !e || !
|
|
89
|
+
const e = L(), l = A();
|
|
90
|
+
return !e || !l ? null : /* @__PURE__ */ i(t, { children: [
|
|
91
91
|
e,
|
|
92
92
|
" ",
|
|
93
|
-
|
|
93
|
+
l
|
|
94
94
|
] });
|
|
95
|
-
}, [
|
|
95
|
+
}, [m, y, n, L, A]), x = f(() => {
|
|
96
96
|
if (!r) return null;
|
|
97
97
|
const e = I(r);
|
|
98
|
-
return e
|
|
99
|
-
}, [r,
|
|
100
|
-
return !
|
|
98
|
+
return e?.targetLink ? R(u, e.targetLink) : null;
|
|
99
|
+
}, [r, u]);
|
|
100
|
+
return !m || D(g) ? null : /* @__PURE__ */ i(t, { children: [
|
|
101
101
|
v,
|
|
102
102
|
" ",
|
|
103
103
|
x && /* @__PURE__ */ s(
|