@arcblock/ux 3.1.39 → 3.1.40
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.
@@ -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.40",
|
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": "5e3ea739c926b972f08cf72e113964ef5a82ddf3",
|
72
72
|
"dependencies": {
|
73
|
-
"@arcblock/bridge": "3.1.
|
73
|
+
"@arcblock/bridge": "3.1.40",
|
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.40",
|
77
|
+
"@arcblock/nft-display": "3.1.40",
|
78
|
+
"@arcblock/react-hooks": "3.1.40",
|
79
79
|
"@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473",
|
80
|
-
"@blocklet/theme": "3.1.
|
80
|
+
"@blocklet/theme": "3.1.40",
|
81
81
|
"@fontsource/roboto": "~5.1.1",
|
82
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
83
83
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -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
|
);
|