@arcblock/ux 3.1.39 → 3.1.41
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/Config/theme-mode-toggle.js +15 -7
- package/lib/NavMenu/products.js +5 -5
- package/lib/UserCard/Cards/social-actions.js +28 -33
- package/lib/package.json.js +1 -1
- package/package.json +7 -7
- package/src/Config/theme-mode-toggle.tsx +10 -1
- package/src/NavMenu/products.tsx +2 -2
- package/src/UserCard/Cards/social-actions.tsx +3 -10
@@ -1,11 +1,19 @@
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
2
|
-
import { IconButton as
|
3
|
-
import { Brightness2Outlined as
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
import { IconButton as i } from "@mui/material";
|
3
|
+
import { Brightness2Outlined as l, LightModeOutlined as s } from "@mui/icons-material";
|
4
|
+
import { useThrottleFn as m } from "ahooks";
|
5
|
+
import { useColorScheme as u } from "../Theme/theme-provider.js";
|
6
|
+
function g() {
|
7
|
+
const { mode: t, toggleMode: o, prefer: r } = u(), { run: n } = m(
|
8
|
+
() => {
|
9
|
+
o();
|
10
|
+
},
|
11
|
+
{
|
12
|
+
wait: 300
|
13
|
+
}
|
14
|
+
);
|
15
|
+
return o ? r === "system" || window.blocklet?.theme?.prefer === "system" ? /* @__PURE__ */ e(i, { onClick: n, children: t === "light" ? /* @__PURE__ */ e(l, {}) : /* @__PURE__ */ e(s, {}) }) : null : (process.env.NODE_ENV !== "production" && console.warn("Please ensure the component is wrapped with ConfigProvider context"), null);
|
8
16
|
}
|
9
17
|
export {
|
10
|
-
|
18
|
+
g as default
|
11
19
|
};
|
package/lib/NavMenu/products.js
CHANGED
@@ -6,8 +6,8 @@ import { Box as w, useTheme as G } from "@mui/material";
|
|
6
6
|
import B from "./sub-item-group.js";
|
7
7
|
import { Item as K } from "./nav-menu.js";
|
8
8
|
import { styled as C } from "../Theme/index.js";
|
9
|
-
import { useNavMenuContext as
|
10
|
-
import { translate as
|
9
|
+
import { useNavMenuContext as E } from "./nav-menu-context.js";
|
10
|
+
import { translate as L } from "../Locale/util.js";
|
11
11
|
import { useLocaleContext as _ } from "../Locale/context.js";
|
12
12
|
import M from "./images/nft-studio.svg.js";
|
13
13
|
import O from "./images/creator-studio.svg.js";
|
@@ -479,7 +479,7 @@ function o({ to: t, children: c, className: a = "", ...u }) {
|
|
479
479
|
return W(t) ? /* @__PURE__ */ e(p, { to: ee(t, "header"), target: "_blank", rel: "noreferrer noopener", className: a, ...u, children: c }) : /* @__PURE__ */ e(p, { to: t, className: a, ...u, children: c });
|
480
480
|
}
|
481
481
|
function Fe({ className: t = "", type: c, ...a }) {
|
482
|
-
const { mode: u } =
|
482
|
+
const { mode: u } = E(), k = G(), { locale: r = "en" } = _() || {}, l = T(null), { palette: f } = k, i = A((n, d = {}) => L(ie, n, r, "en", d)), [N, D] = $(v), m = A(() => {
|
483
483
|
if (!l.current) return;
|
484
484
|
const n = l.current.querySelectorAll(".navmenu-item__content");
|
485
485
|
let d = v;
|
@@ -661,12 +661,12 @@ function Fe({ className: t = "", type: c, ...a }) {
|
|
661
661
|
{
|
662
662
|
label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/code-smith", ...n, children: "AIGNE CodeSmith" }),
|
663
663
|
description: i("products.aigneCodeSmith.description"),
|
664
|
-
icon: /* @__PURE__ */ e(s, { color: "#
|
664
|
+
icon: /* @__PURE__ */ e(s, { color: "#3E5DF7", backgroundColor: "#e9f0ff" })
|
665
665
|
},
|
666
666
|
{
|
667
667
|
label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/doc-smith", ...n, children: "AIGNE DocSmith" }),
|
668
668
|
description: i("products.aigneDocSmith.description"),
|
669
|
-
icon: /* @__PURE__ */ e(s, { color: "#
|
669
|
+
icon: /* @__PURE__ */ e(s, { color: "#02A996", backgroundColor: "#e6f7f5" })
|
670
670
|
},
|
671
671
|
{
|
672
672
|
label: /* @__PURE__ */ e(o, { to: "https://www.aigne.io/web-smith", ...n, children: "AIGNE WebSmith" }),
|
@@ -1,16 +1,14 @@
|
|
1
|
-
import { jsxs as w, jsx as
|
1
|
+
import { jsxs as w, jsx as d } from "react/jsx-runtime";
|
2
2
|
import { useMemo as l } from "react";
|
3
|
-
import { styled as
|
3
|
+
import { styled as C, Button as F, Box as U } from "@mui/material";
|
4
4
|
import { useMemoizedFn as u } from "ahooks";
|
5
|
-
import { joinURL as
|
5
|
+
import { joinURL as v } from "ufo";
|
6
6
|
import h from "lodash/noop";
|
7
|
-
import { Icon as
|
8
|
-
import
|
9
|
-
import L from "@mui/icons-material/NotificationsOff";
|
10
|
-
import P from "../use-follow.js";
|
7
|
+
import { Icon as z } from "@iconify/react";
|
8
|
+
import L from "../use-follow.js";
|
11
9
|
import { useLocaleContext as g } from "../../Locale/context.js";
|
12
10
|
import { translate as y } from "../../Locale/util.js";
|
13
|
-
import { isSupportFollow as
|
11
|
+
import { isSupportFollow as N } from "../../Util/index.js";
|
14
12
|
const _ = {
|
15
13
|
zh: {
|
16
14
|
chat: "聊天",
|
@@ -26,16 +24,16 @@ const _ = {
|
|
26
24
|
follow_success: "Follow success",
|
27
25
|
unfollow_success: "Unfollow success"
|
28
26
|
}
|
29
|
-
},
|
27
|
+
}, P = () => {
|
30
28
|
const { componentMountPoints: o = [] } = window.blocklet || {};
|
31
29
|
return o.find((n) => n.name === "did-comments")?.mountPoint;
|
32
30
|
};
|
33
|
-
function
|
31
|
+
function j({
|
34
32
|
user: o,
|
35
33
|
showSocialActions: t,
|
36
34
|
session: n
|
37
35
|
}) {
|
38
|
-
const { locale: e } = g() || { locale: "en" }, i = u((
|
36
|
+
const { locale: e } = g() || { locale: "en" }, i = u((s, m = {}) => y(_, s, e, "en", m)), r = l(() => !!n?.user?.did, [n?.user?.did]), c = l(() => P(), []), a = u(() => {
|
39
37
|
if (!r) {
|
40
38
|
n?.login(h, {
|
41
39
|
openMode: "redirect",
|
@@ -43,10 +41,10 @@ function I({
|
|
43
41
|
});
|
44
42
|
return;
|
45
43
|
}
|
46
|
-
window.open(
|
44
|
+
window.open(v(c, `/chat/dm/${o?.did}`), "_blank");
|
47
45
|
});
|
48
46
|
return l(() => (typeof t == "boolean" ? !!t : t?.chat) && !!c, [t, c]) ? /* @__PURE__ */ w(
|
49
|
-
|
47
|
+
b,
|
50
48
|
{
|
51
49
|
className: "user-card__social-actions-chat",
|
52
50
|
variant: "outlined",
|
@@ -54,24 +52,24 @@ function I({
|
|
54
52
|
size: "small",
|
55
53
|
onClick: a,
|
56
54
|
children: [
|
57
|
-
/* @__PURE__ */
|
55
|
+
/* @__PURE__ */ d(z, { icon: "tabler:message-dots", style: { marginRight: 4 } }),
|
58
56
|
i("chat")
|
59
57
|
]
|
60
58
|
}
|
61
59
|
) : null;
|
62
60
|
}
|
63
|
-
function
|
61
|
+
function B({
|
64
62
|
user: o,
|
65
63
|
showSocialActions: t,
|
66
64
|
session: n,
|
67
65
|
onFollowClick: e
|
68
66
|
}) {
|
69
|
-
const { locale: i } = g() || { locale: "en" }, r = u((p, M = {}) => y(_, p, i, "en", M)), c = l(() => !!n?.user?.did, [n?.user?.did]), a = l(() => typeof t == "boolean" ? !!t : t?.follow, [t]), { followed: f, followUser:
|
67
|
+
const { locale: i } = g() || { locale: "en" }, r = u((p, M = {}) => y(_, p, i, "en", M)), c = l(() => !!n?.user?.did, [n?.user?.did]), a = l(() => typeof t == "boolean" ? !!t : t?.follow, [t]), { followed: f, followUser: s, unfollowUser: m } = L({
|
70
68
|
user: o,
|
71
69
|
t: r,
|
72
70
|
isMySelf: !1,
|
73
71
|
visible: !!a
|
74
|
-
}),
|
72
|
+
}), x = u(async (p) => {
|
75
73
|
if (!c) {
|
76
74
|
n?.login(h, {
|
77
75
|
openMode: "redirect",
|
@@ -79,37 +77,34 @@ function $({
|
|
79
77
|
});
|
80
78
|
return;
|
81
79
|
}
|
82
|
-
f ? m(o.did) :
|
80
|
+
f ? await m(o.did) : await s(o.did), e && typeof e == "function" && e(o, p);
|
83
81
|
});
|
84
|
-
return a ? /* @__PURE__ */
|
85
|
-
|
82
|
+
return a ? /* @__PURE__ */ d(
|
83
|
+
b,
|
86
84
|
{
|
87
85
|
className: "user-card__social-actions-follow",
|
88
86
|
variant: "outlined",
|
89
87
|
color: "primary",
|
90
88
|
size: "small",
|
91
|
-
onClick:
|
92
|
-
children:
|
93
|
-
f ? /* @__PURE__ */ s(L, { sx: { fontSize: 14, mr: 0.5 } }) : /* @__PURE__ */ s(v, { sx: { fontSize: 14, mr: 0.5 } }),
|
94
|
-
r(f ? "unfollow" : "follow")
|
95
|
-
]
|
89
|
+
onClick: x,
|
90
|
+
children: r(f ? "unfollow" : "follow")
|
96
91
|
}
|
97
92
|
) : null;
|
98
93
|
}
|
99
|
-
function
|
100
|
-
const i = l(() => t?.user?.did === n?.did, [t?.user?.did, n?.did]), r = l(() =>
|
101
|
-
return i || !r || !o ? null : /* @__PURE__ */ w(
|
102
|
-
/* @__PURE__ */
|
103
|
-
/* @__PURE__ */
|
94
|
+
function H({ showSocialActions: o, session: t, user: n, onFollowClick: e = void 0 }) {
|
95
|
+
const i = l(() => t?.user?.did === n?.did, [t?.user?.did, n?.did]), r = l(() => N(), []);
|
96
|
+
return i || !r || !o ? null : /* @__PURE__ */ w(U, { className: "user-card__social-actions", sx: { display: "flex", gap: 1 }, children: [
|
97
|
+
/* @__PURE__ */ d(j, { session: t, user: n, showSocialActions: o }),
|
98
|
+
/* @__PURE__ */ d(B, { onFollowClick: e, session: t, user: n, showSocialActions: o })
|
104
99
|
] });
|
105
100
|
}
|
106
|
-
const
|
101
|
+
const b = C(F)`
|
107
102
|
color: ${({ theme: o }) => o.palette.text.primary};
|
108
103
|
font-weight: 500;
|
109
104
|
border-color: ${({ theme: o }) => o.palette.grey[300]};
|
110
105
|
line-height: 1.5;
|
111
106
|
`;
|
112
107
|
export {
|
113
|
-
|
114
|
-
|
108
|
+
b as ButtonWrapper,
|
109
|
+
H as default
|
115
110
|
};
|
package/lib/package.json.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.41",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -68,16 +68,16 @@
|
|
68
68
|
"react": "^19.0.0",
|
69
69
|
"react-router-dom": "^6.22.3"
|
70
70
|
},
|
71
|
-
"gitHead": "
|
71
|
+
"gitHead": "21979ee3abb716f0201960abe9c85d8f0a8f291c",
|
72
72
|
"dependencies": {
|
73
|
-
"@arcblock/bridge": "3.1.
|
73
|
+
"@arcblock/bridge": "3.1.41",
|
74
74
|
"@arcblock/did": "^1.21.3",
|
75
75
|
"@arcblock/did-motif": "^1.1.14",
|
76
|
-
"@arcblock/icons": "3.1.
|
77
|
-
"@arcblock/nft-display": "3.1.
|
78
|
-
"@arcblock/react-hooks": "3.1.
|
76
|
+
"@arcblock/icons": "3.1.41",
|
77
|
+
"@arcblock/nft-display": "3.1.41",
|
78
|
+
"@arcblock/react-hooks": "3.1.41",
|
79
79
|
"@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473",
|
80
|
-
"@blocklet/theme": "3.1.
|
80
|
+
"@blocklet/theme": "3.1.41",
|
81
81
|
"@fontsource/roboto": "~5.1.1",
|
82
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
83
83
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -3,10 +3,19 @@ import {
|
|
3
3
|
LightModeOutlined as LightModeOutlinedIcon,
|
4
4
|
Brightness2Outlined as Brightness2OutlinedIcon,
|
5
5
|
} from '@mui/icons-material';
|
6
|
+
import { useThrottleFn } from 'ahooks';
|
6
7
|
import { useColorScheme } from '../Theme/theme-provider';
|
7
8
|
|
8
9
|
export default function ThemeModeToggle() {
|
9
10
|
const { mode, toggleMode, prefer } = useColorScheme();
|
11
|
+
const { run: toggleModeThrottled } = useThrottleFn(
|
12
|
+
() => {
|
13
|
+
toggleMode();
|
14
|
+
},
|
15
|
+
{
|
16
|
+
wait: 300,
|
17
|
+
}
|
18
|
+
);
|
10
19
|
|
11
20
|
if (!toggleMode) {
|
12
21
|
if (process.env.NODE_ENV !== 'production') {
|
@@ -19,7 +28,7 @@ export default function ThemeModeToggle() {
|
|
19
28
|
// 跟随系统才显示切换
|
20
29
|
if (prefer === 'system' || window.blocklet?.theme?.prefer === 'system') {
|
21
30
|
return (
|
22
|
-
<IconButton onClick={
|
31
|
+
<IconButton onClick={toggleModeThrottled}>
|
23
32
|
{mode === 'light' ? <Brightness2OutlinedIcon /> : <LightModeOutlinedIcon />}
|
24
33
|
</IconButton>
|
25
34
|
);
|
package/src/NavMenu/products.tsx
CHANGED
@@ -768,7 +768,7 @@ export default function Products({ className = '', type, ...rest }: ProductsProp
|
|
768
768
|
</SmartLink>
|
769
769
|
),
|
770
770
|
description: t('products.aigneCodeSmith.description'),
|
771
|
-
icon: <AigneIcon color="#
|
771
|
+
icon: <AigneIcon color="#3E5DF7" backgroundColor="#e9f0ff" />,
|
772
772
|
},
|
773
773
|
{
|
774
774
|
label: (
|
@@ -777,7 +777,7 @@ export default function Products({ className = '', type, ...rest }: ProductsProp
|
|
777
777
|
</SmartLink>
|
778
778
|
),
|
779
779
|
description: t('products.aigneDocSmith.description'),
|
780
|
-
icon: <AigneIcon color="#
|
780
|
+
icon: <AigneIcon color="#02A996" backgroundColor="#e6f7f5" />,
|
781
781
|
},
|
782
782
|
{
|
783
783
|
label: (
|
@@ -4,8 +4,6 @@ import { useMemoizedFn } from 'ahooks';
|
|
4
4
|
import { joinURL } from 'ufo';
|
5
5
|
import noop from 'lodash/noop';
|
6
6
|
import { Icon } from '@iconify/react';
|
7
|
-
import NotificationsIcon from '@mui/icons-material/Notifications';
|
8
|
-
import NotificationsOffIcon from '@mui/icons-material/NotificationsOff';
|
9
7
|
|
10
8
|
import useFollow from '../use-follow';
|
11
9
|
import { User, UserCardProps } from '../types';
|
@@ -128,7 +126,7 @@ function Follow({
|
|
128
126
|
isMySelf: false,
|
129
127
|
visible: !!showFollow,
|
130
128
|
});
|
131
|
-
const handleFollowAction = useMemoizedFn((e) => {
|
129
|
+
const handleFollowAction = useMemoizedFn(async (e) => {
|
132
130
|
if (!isLogin) {
|
133
131
|
session?.login(noop, {
|
134
132
|
openMode: 'redirect',
|
@@ -137,9 +135,9 @@ function Follow({
|
|
137
135
|
return;
|
138
136
|
}
|
139
137
|
if (followed) {
|
140
|
-
unfollowUser(user.did);
|
138
|
+
await unfollowUser(user.did);
|
141
139
|
} else {
|
142
|
-
followUser(user.did);
|
140
|
+
await followUser(user.did);
|
143
141
|
}
|
144
142
|
if (onFollowClick && typeof onFollowClick === 'function') {
|
145
143
|
onFollowClick(user, e);
|
@@ -157,11 +155,6 @@ function Follow({
|
|
157
155
|
color="primary"
|
158
156
|
size="small"
|
159
157
|
onClick={handleFollowAction}>
|
160
|
-
{followed ? (
|
161
|
-
<NotificationsOffIcon sx={{ fontSize: 14, mr: 0.5 }} />
|
162
|
-
) : (
|
163
|
-
<NotificationsIcon sx={{ fontSize: 14, mr: 0.5 }} />
|
164
|
-
)}
|
165
158
|
{followed ? t('unfollow') : t('follow')}
|
166
159
|
</ButtonWrapper>
|
167
160
|
);
|