@arcblock/ux 3.1.27 → 3.1.30
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/UserCard/Cards/avatar-only.js +11 -22
- package/lib/UserCard/Cards/index.js +4 -12
- package/lib/UserCard/Cards/social-actions.d.ts +7 -0
- package/lib/UserCard/Cards/social-actions.js +112 -0
- package/lib/UserCard/Content/minimal.js +62 -47
- package/lib/UserCard/index.d.ts +2 -0
- package/lib/UserCard/index.js +31 -28
- package/lib/UserCard/types.d.ts +8 -1
- package/lib/UserCard/types.js +4 -4
- package/lib/UserCard/use-follow.d.ts +16 -0
- package/lib/UserCard/use-follow.js +67 -0
- package/lib/Util/index.d.ts +15 -0
- package/lib/Util/index.js +191 -171
- package/lib/package.json.js +9 -0
- package/package.json +10 -8
- package/src/UserCard/Cards/avatar-only.tsx +1 -15
- package/src/UserCard/Cards/index.tsx +2 -11
- package/src/UserCard/Cards/social-actions.tsx +196 -0
- package/src/UserCard/Content/minimal.tsx +43 -31
- package/src/UserCard/UserCard.stories.jsx +1 -0
- package/src/UserCard/index.tsx +6 -0
- package/src/UserCard/types.ts +10 -1
- package/src/UserCard/use-follow.tsx +119 -0
- package/src/Util/index.ts +67 -0
- package/lib/UserCard/Cards/name-only.d.ts +0 -5
- package/lib/UserCard/Cards/name-only.js +0 -13
- package/src/UserCard/Cards/name-only.tsx +0 -17
package/lib/Util/index.js
CHANGED
@@ -1,70 +1,72 @@
|
|
1
|
-
import { lazy as
|
2
|
-
import
|
3
|
-
import { colors as
|
4
|
-
import { mergeAllThemeOptions as
|
5
|
-
import
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import
|
1
|
+
import { lazy as j } from "react";
|
2
|
+
import u from "lodash/padStart";
|
3
|
+
import { colors as w, getDIDMotifInfo as x } from "@arcblock/did-motif";
|
4
|
+
import { mergeAllThemeOptions as Ke } from "@blocklet/theme";
|
5
|
+
import I from "lodash/isNil";
|
6
|
+
import E from "lodash/omitBy";
|
7
|
+
import U from "p-retry";
|
8
|
+
import m from "js-cookie";
|
9
|
+
import v from "color-convert";
|
10
10
|
import a from "dayjs";
|
11
11
|
import "dayjs/locale/zh-cn";
|
12
|
-
import
|
13
|
-
import
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import
|
18
|
-
import {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
import F from "dayjs/plugin/utc";
|
13
|
+
import O from "dayjs/plugin/timezone";
|
14
|
+
import A from "dayjs/plugin/relativeTime";
|
15
|
+
import P from "dayjs/plugin/updateLocale";
|
16
|
+
import R from "dayjs/plugin/localizedFormat";
|
17
|
+
import W from "semver";
|
18
|
+
import { DID_PREFIX as L, BLOCKLET_SERVICE_PATH_PREFIX as C } from "./constant.js";
|
19
|
+
import b from "../package.json.js";
|
20
|
+
import { getFederatedEnabled as M } from "./federated.js";
|
21
|
+
let l = null;
|
22
|
+
const _ = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, z = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), B = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
|
23
|
+
function N(e) {
|
24
|
+
if (!e)
|
23
25
|
return !1;
|
24
|
-
const
|
25
|
-
if (
|
26
|
-
const o =
|
27
|
-
return
|
26
|
+
const t = e.split(".");
|
27
|
+
if (t.length < 2) return !1;
|
28
|
+
const o = t[t.length - 2], n = t[t.length - 1];
|
29
|
+
return z.has(o) && B.has(n);
|
28
30
|
}
|
29
|
-
function
|
30
|
-
const { host:
|
31
|
-
if (!
|
31
|
+
function ye() {
|
32
|
+
const { host: e } = window.location;
|
33
|
+
if (!e || _.test(e))
|
32
34
|
return "";
|
33
|
-
const o =
|
35
|
+
const o = e.split(":")[0].split(".");
|
34
36
|
if (o.length === 1)
|
35
37
|
return "";
|
36
38
|
if (o.length > 2) {
|
37
39
|
const n = o.slice(-2).join(".");
|
38
|
-
if (
|
40
|
+
if (N(n))
|
39
41
|
return `.${o.slice(-3).join(".")}`;
|
40
42
|
}
|
41
43
|
return `.${o.slice(-2).join(".")}`;
|
42
44
|
}
|
43
|
-
function
|
44
|
-
return
|
45
|
+
function Ie(e) {
|
46
|
+
return e.replace(/^\?/, "").split("&").map((t) => t.split("=")).filter(([t]) => !!t).reduce((t, o) => {
|
45
47
|
const n = o[0], i = decodeURIComponent(o[1]) || !0;
|
46
|
-
return
|
48
|
+
return t[n] = i, t;
|
47
49
|
}, {});
|
48
50
|
}
|
49
|
-
function
|
50
|
-
return new URLSearchParams(
|
51
|
+
function be(e = {}) {
|
52
|
+
return new URLSearchParams(e).toString();
|
51
53
|
}
|
52
|
-
function
|
53
|
-
let
|
54
|
-
typeof
|
54
|
+
function Se(e = 1) {
|
55
|
+
let t = e;
|
56
|
+
typeof t == "number" && (t = { expireInDays: t }), t.path === void 0 && (t.path = "/"), t.expireInDays || (t.expireInDays = 1);
|
55
57
|
const o = {
|
56
|
-
expires:
|
57
|
-
path:
|
58
|
-
domain:
|
59
|
-
sameSite:
|
58
|
+
expires: t.expireInDays,
|
59
|
+
path: t.path,
|
60
|
+
domain: t.domain || "",
|
61
|
+
sameSite: t.sameSite || "Lax",
|
60
62
|
// 允许自定义设置为 false,默认是 true
|
61
|
-
secure:
|
63
|
+
secure: t.secure !== !1
|
62
64
|
};
|
63
|
-
return (typeof window > "u" ||
|
65
|
+
return (typeof window > "u" || t.domain || t.returnDomain === !1) && t.returnDomain === !1 && delete o.domain, o;
|
64
66
|
}
|
65
|
-
const
|
66
|
-
function
|
67
|
-
const n = Object.assign({},
|
67
|
+
const De = (e) => e.color ? e.color : e.dark ? e.theme.palette.common.white : e.theme.palette.text.primary, ke = (e) => e.background ? e.background : e.dark ? e.theme.palette.common.black : e.theme.palette.common.white;
|
68
|
+
function Ve(e, t, o = []) {
|
69
|
+
const n = Object.assign({}, e), i = t.defaultProps || {};
|
68
70
|
return Object.keys(i).forEach((r) => {
|
69
71
|
typeof n[r] == "string" && n[r].indexOf("::prop::") === 0 && (n[r] = i[r]);
|
70
72
|
}), Array.isArray(o) && o.forEach((r) => {
|
@@ -77,32 +79,32 @@ function gt(t, e, o = []) {
|
|
77
79
|
typeof n[r] == "string" && n[r].indexOf("::prop::") === 0 && (n[r] = "");
|
78
80
|
}), n;
|
79
81
|
}
|
80
|
-
function
|
81
|
-
const
|
82
|
-
return `${
|
82
|
+
function $e(e = 2017) {
|
83
|
+
const t = (/* @__PURE__ */ new Date()).getFullYear();
|
84
|
+
return `${t}` == `${e}` ? `© ArcBlock ${t}` : `© ArcBlock ${e} - ${t}`;
|
83
85
|
}
|
84
|
-
const
|
85
|
-
let
|
86
|
-
for (let n = 0; n <
|
87
|
-
|
86
|
+
const Te = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", je = (e) => {
|
87
|
+
let t = 0;
|
88
|
+
for (let n = 0; n < e.length; n++)
|
89
|
+
t = e.charCodeAt(n) + ((t << 5) - t);
|
88
90
|
let o = "#";
|
89
91
|
for (let n = 0; n < 3; n++) {
|
90
|
-
const i =
|
92
|
+
const i = t >> n * 8 & 255;
|
91
93
|
o += `00${i.toString(16)}`.substr(-2);
|
92
94
|
}
|
93
95
|
return o;
|
94
|
-
},
|
95
|
-
const
|
96
|
-
return `${
|
96
|
+
}, xe = (e) => {
|
97
|
+
const t = Math.round(e / 1e3), o = Math.floor(t / 3600), n = Math.floor((t - o * 3600) / 60), i = t % 60;
|
98
|
+
return `${u(o, 2, "0")}:${u(n, 2, "0")}:${u(i, 2, "0")}`;
|
97
99
|
};
|
98
|
-
function
|
99
|
-
|
100
|
+
function X(e) {
|
101
|
+
l = e;
|
100
102
|
}
|
101
|
-
function
|
102
|
-
return
|
103
|
+
function Ee() {
|
104
|
+
return l;
|
103
105
|
}
|
104
|
-
const
|
105
|
-
if (
|
106
|
+
const S = (e) => (t, { locale: o, tz: n, isUtc: i } = {}) => {
|
107
|
+
if (l === null && (a.extend(R), a.extend(F), a.extend(O), a.extend(P), a.extend(A), a.updateLocale("zh-cn", {
|
106
108
|
// copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
|
107
109
|
relativeTime: {
|
108
110
|
future: "%s后",
|
@@ -119,49 +121,49 @@ const I = (t) => (e, { locale: o, tz: n, isUtc: i } = {}) => {
|
|
119
121
|
y: "1 年",
|
120
122
|
yy: "%d 年"
|
121
123
|
}
|
122
|
-
}),
|
124
|
+
}), X(a)), I(t) || t === "")
|
123
125
|
return "-";
|
124
|
-
let r =
|
125
|
-
return n && (r = r.tz(n)), i && (r = r.utc()), typeof o < "u" && (r = r.locale(o)), r.format(
|
126
|
+
let r = l(t);
|
127
|
+
return n && (r = r.tz(n)), i && (r = r.utc()), typeof o < "u" && (r = r.locale(o)), r.format(e);
|
126
128
|
};
|
127
|
-
function
|
128
|
-
return
|
129
|
+
function Ue(e, { locale: t = "en", tz: o } = {}) {
|
130
|
+
return S("ll")(e, { locale: t, tz: o });
|
129
131
|
}
|
130
|
-
function
|
131
|
-
locale:
|
132
|
+
function ve(e, {
|
133
|
+
locale: t = "en",
|
132
134
|
tz: o,
|
133
135
|
isUtc: n = !1,
|
134
136
|
format: i = "lll"
|
135
137
|
} = {}) {
|
136
|
-
return
|
138
|
+
return S(i)(e, { locale: t, tz: o, isUtc: n });
|
137
139
|
}
|
138
|
-
function
|
139
|
-
const
|
140
|
-
return
|
140
|
+
function K() {
|
141
|
+
const e = window?.ABT_DEV || window.ABT;
|
142
|
+
return e && typeof e.open == "function" ? e : null;
|
141
143
|
}
|
142
|
-
function
|
143
|
-
webWalletUrl:
|
144
|
-
action:
|
144
|
+
function Fe({
|
145
|
+
webWalletUrl: e,
|
146
|
+
action: t = "login",
|
145
147
|
locale: o = "en",
|
146
148
|
url: n,
|
147
149
|
windowFeatures: i,
|
148
150
|
appInfo: r,
|
149
|
-
memberAppInfo:
|
151
|
+
memberAppInfo: f
|
150
152
|
}) {
|
151
|
-
const h =
|
153
|
+
const h = K();
|
152
154
|
if (h)
|
153
155
|
return h.open({
|
154
|
-
action:
|
156
|
+
action: t,
|
155
157
|
locale: o,
|
156
158
|
url: encodeURIComponent(n),
|
157
159
|
appInfo: {
|
158
160
|
...r
|
159
161
|
},
|
160
162
|
memberAppInfo: {
|
161
|
-
...
|
163
|
+
...f
|
162
164
|
}
|
163
165
|
}), { type: "extension" };
|
164
|
-
const
|
166
|
+
const D = {
|
165
167
|
toolbar: "no",
|
166
168
|
location: "no",
|
167
169
|
status: "no",
|
@@ -171,65 +173,65 @@ function St({
|
|
171
173
|
// iphone 8plus size
|
172
174
|
width: 414,
|
173
175
|
height: 736
|
174
|
-
},
|
176
|
+
}, k = `${e}?action=${t}&locale=${o}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), V = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
|
175
177
|
if (!("left" in c)) {
|
176
|
-
const s =
|
177
|
-
c.left = s +
|
178
|
+
const s = V(window.top || window), T = window.screenLeft || window.screenX;
|
179
|
+
c.left = s + T - c.width;
|
178
180
|
}
|
179
181
|
if (!("top" in c)) {
|
180
182
|
const s = window.screenTop || window.screenY;
|
181
183
|
c.top = s;
|
182
184
|
}
|
183
|
-
const
|
184
|
-
return window.open(
|
185
|
+
const $ = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
|
186
|
+
return window.open(k, "targetWindow", $), { type: "web" };
|
185
187
|
}
|
186
|
-
const
|
187
|
-
const
|
188
|
-
return !!/^(0x)?[0-9a-f]{40}$/i.test(
|
189
|
-
},
|
190
|
-
if (!
|
191
|
-
return
|
188
|
+
const Oe = (e) => e && Number(e) >= 12 ? `${Number(e)}px` : "inherit", J = (e) => {
|
189
|
+
const t = e.replace(L, "");
|
190
|
+
return !!/^(0x)?[0-9a-f]{40}$/i.test(t);
|
191
|
+
}, Q = (e, t) => {
|
192
|
+
if (!t)
|
193
|
+
return e;
|
192
194
|
try {
|
193
|
-
const o = new URL(
|
194
|
-
return Object.keys(
|
195
|
-
o.searchParams.set(n, String(
|
195
|
+
const o = new URL(e, window.location.origin);
|
196
|
+
return Object.keys(t).forEach((n) => {
|
197
|
+
o.searchParams.set(n, String(t[n]));
|
196
198
|
}), o.origin === window.location.origin ? o.pathname + o.search : o.href;
|
197
199
|
} catch {
|
198
|
-
return
|
200
|
+
return e;
|
199
201
|
}
|
200
|
-
},
|
202
|
+
}, Ae = (e, t = 48) => e && (e.indexOf(C) >= 0 ? Q(e, {
|
201
203
|
imageFilter: "resize",
|
202
|
-
w:
|
203
|
-
h:
|
204
|
-
}) :
|
204
|
+
w: t,
|
205
|
+
h: t
|
206
|
+
}) : e), Pe = (e = 0) => new Promise((t) => {
|
205
207
|
setTimeout(() => {
|
206
|
-
|
207
|
-
},
|
208
|
-
}),
|
209
|
-
|
208
|
+
t();
|
209
|
+
}, e);
|
210
|
+
}), Re = (e) => /^https?:\/\//.test(e), p = "vid", g = "__visitor_id", Y = () => m.get(p) || localStorage.getItem(g), y = (e) => {
|
211
|
+
e === null ? m.remove(p, {
|
210
212
|
sameSite: "None",
|
211
213
|
secure: !0
|
212
|
-
}) :
|
214
|
+
}) : m.set(p, e, {
|
213
215
|
sameSite: "None",
|
214
216
|
secure: !0,
|
215
217
|
expires: 365
|
216
218
|
});
|
217
|
-
},
|
218
|
-
let
|
219
|
-
if (
|
220
|
-
if (!
|
219
|
+
}, We = () => {
|
220
|
+
let e = localStorage.getItem(g);
|
221
|
+
if (e && (localStorage.removeItem(g), y(e)), !Y()) {
|
222
|
+
if (!M())
|
221
223
|
try {
|
222
224
|
if (window.crypto && typeof window.crypto.randomUUID == "function")
|
223
|
-
|
225
|
+
e = window.crypto.randomUUID();
|
224
226
|
else {
|
225
|
-
const
|
227
|
+
const t = new Uint8Array(16);
|
226
228
|
if (window.crypto && typeof window.crypto.getRandomValues == "function")
|
227
|
-
window.crypto.getRandomValues(
|
229
|
+
window.crypto.getRandomValues(t);
|
228
230
|
else
|
229
231
|
for (let n = 0; n < 16; n++)
|
230
|
-
|
231
|
-
const o = Array.from(
|
232
|
-
|
232
|
+
t[n] = Math.floor(Math.random() * 256);
|
233
|
+
const o = Array.from(t).map((n) => n.toString(16).padStart(2, "0"));
|
234
|
+
e = [
|
233
235
|
o.slice(0, 4).join(""),
|
234
236
|
o.slice(4, 6).join(""),
|
235
237
|
o.slice(6, 8).join(""),
|
@@ -238,77 +240,95 @@ const xt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", N = (t) =
|
|
238
240
|
].join("-");
|
239
241
|
}
|
240
242
|
} catch {
|
241
|
-
|
243
|
+
e = `${Date.now()}-${Math.random().toString(36).substring(2, 15)}`;
|
242
244
|
}
|
243
|
-
|
245
|
+
e && y(e);
|
244
246
|
}
|
245
|
-
},
|
246
|
-
if (
|
247
|
-
const
|
248
|
-
|
249
|
-
).slice(0, 8).reduce((o, n) => o + n, 0) %
|
250
|
-
return
|
247
|
+
}, Le = (e) => {
|
248
|
+
if (J(e)) {
|
249
|
+
const t = Uint8Array.from(
|
250
|
+
e.slice(2).match(/.{1,2}/g).map((o) => parseInt(o, 16))
|
251
|
+
).slice(0, 8).reduce((o, n) => o + n, 0) % w.length;
|
252
|
+
return w[t];
|
251
253
|
}
|
252
254
|
try {
|
253
|
-
return
|
255
|
+
return x(e)?.color;
|
254
256
|
} catch {
|
255
257
|
return null;
|
256
258
|
}
|
257
|
-
},
|
259
|
+
}, Ce = (e, t, o = {}) => {
|
258
260
|
const { fallbackLocale: n = "en", defaultValue: i = "unknown" } = o;
|
259
|
-
if (typeof
|
260
|
-
return
|
261
|
+
if (typeof e == "string")
|
262
|
+
return e;
|
261
263
|
let r;
|
262
|
-
return
|
263
|
-
},
|
264
|
-
() =>
|
264
|
+
return t && (r = e[t]), (!r || typeof r != "string") && (r = e[n]), (!r || typeof r != "string") && (r = i), r;
|
265
|
+
}, Me = (e) => j(
|
266
|
+
() => U(
|
265
267
|
async () => {
|
266
268
|
try {
|
267
|
-
return await
|
268
|
-
} catch (
|
269
|
-
throw
|
269
|
+
return await e();
|
270
|
+
} catch (t) {
|
271
|
+
throw t instanceof TypeError && !t.message.includes("Failed to fetch") ? t : t instanceof Error ? new Error(t.message) : new Error("Unknown error");
|
270
272
|
}
|
271
273
|
},
|
272
274
|
// 只需要重试两次,加上原本的一次,总共三次
|
273
275
|
{ retries: 2 }
|
274
276
|
)
|
275
|
-
),
|
276
|
-
function
|
277
|
-
const [o, n, i] =
|
278
|
-
return `rgba(${o}, ${n}, ${i}, ${
|
277
|
+
), _e = (e) => E(e, I);
|
278
|
+
function ze(e, t = 1) {
|
279
|
+
const [o, n, i] = v.hex.rgb(e);
|
280
|
+
return `rgba(${o}, ${n}, ${i}, ${t})`;
|
279
281
|
}
|
282
|
+
const G = () => window.blocklet?.serverVersion || "", H = () => b.version, Z = () => (b.dependencies?.["@blocklet/js-sdk"]).replace(/^[\^~>=<]+/, ""), d = (e, t) => {
|
283
|
+
const o = (r) => {
|
284
|
+
const f = r.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
285
|
+
return f ? f[1] : r;
|
286
|
+
}, n = o(e), i = o(t);
|
287
|
+
return n === i && e !== t ? !1 : W.gte(n, i);
|
288
|
+
}, Be = () => {
|
289
|
+
const e = G(), t = H(), o = Z();
|
290
|
+
if (!e || !t || !o)
|
291
|
+
return !1;
|
292
|
+
const n = d(t, "3.1.29"), i = d(e, "1.16.49-beta-20250822-070545-6d3344cc"), r = d(o, "1.16.49-beta-20250822-070545-6d3344cc");
|
293
|
+
return n && i && r;
|
294
|
+
};
|
280
295
|
export {
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
296
|
+
Q as appendParams,
|
297
|
+
_e as cleanedObj,
|
298
|
+
d as compareVersions,
|
299
|
+
Ke as deepmergeAll,
|
300
|
+
K as detectWalletExtension,
|
301
|
+
We as ensureVisitorId,
|
302
|
+
Ue as formatToDate,
|
303
|
+
ve as formatToDatetime,
|
304
|
+
xe as formatUptime,
|
305
|
+
ke as getBackground,
|
306
|
+
De as getColor,
|
307
|
+
Se as getCookieOptions,
|
308
|
+
$e as getCopyright,
|
309
|
+
Le as getDIDColor,
|
310
|
+
Ee as getDateTool,
|
311
|
+
Oe as getFontSize,
|
312
|
+
Z as getJsSdkVersion,
|
313
|
+
G as getServerVersion,
|
314
|
+
Te as getTimezone,
|
315
|
+
Ce as getTranslation,
|
316
|
+
Ae as getUserAvatar,
|
317
|
+
H as getUxPackageVersion,
|
318
|
+
Y as getVisitorId,
|
319
|
+
ze as hexToRgba,
|
320
|
+
J as isEthereumDid,
|
321
|
+
Be as isSupportFollow,
|
322
|
+
N as isTwoSegmentTLD,
|
323
|
+
Re as isUrl,
|
324
|
+
Me as lazyRetry,
|
325
|
+
Ve as mergeProps,
|
326
|
+
Fe as openWebWallet,
|
327
|
+
Ie as parseQuery,
|
328
|
+
ye as resolveRootDomain,
|
329
|
+
X as setDateTool,
|
330
|
+
y as setVisitorId,
|
331
|
+
Pe as sleep,
|
332
|
+
je as str2color,
|
333
|
+
be as stringifyQuery
|
314
334
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "3.1.
|
3
|
+
"version": "3.1.30",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -45,6 +45,7 @@
|
|
45
45
|
"@types/pako": "^2.0.3",
|
46
46
|
"@types/react": "^19.1.8",
|
47
47
|
"@types/react-helmet": "^6.1.11",
|
48
|
+
"@types/semver": "^7.7.0",
|
48
49
|
"@types/webfontloader": "^1.6.38",
|
49
50
|
"babel-jest": "29",
|
50
51
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
@@ -67,16 +68,16 @@
|
|
67
68
|
"react": "^19.0.0",
|
68
69
|
"react-router-dom": "^6.22.3"
|
69
70
|
},
|
70
|
-
"gitHead": "
|
71
|
+
"gitHead": "a51fede74e5eca679ff40a8c62d96bae09210f04",
|
71
72
|
"dependencies": {
|
72
|
-
"@arcblock/bridge": "3.1.
|
73
|
+
"@arcblock/bridge": "3.1.30",
|
73
74
|
"@arcblock/did": "^1.21.3",
|
74
75
|
"@arcblock/did-motif": "^1.1.14",
|
75
|
-
"@arcblock/icons": "3.1.
|
76
|
-
"@arcblock/nft-display": "3.1.
|
77
|
-
"@arcblock/react-hooks": "3.1.
|
78
|
-
"@blocklet/js-sdk": "^1.16.
|
79
|
-
"@blocklet/theme": "3.1.
|
76
|
+
"@arcblock/icons": "3.1.30",
|
77
|
+
"@arcblock/nft-display": "3.1.30",
|
78
|
+
"@arcblock/react-hooks": "3.1.30",
|
79
|
+
"@blocklet/js-sdk": "^1.16.49-beta-20250823-082650-626c1473",
|
80
|
+
"@blocklet/theme": "3.1.30",
|
80
81
|
"@fontsource/roboto": "~5.1.1",
|
81
82
|
"@fontsource/ubuntu-mono": "^5.2.6",
|
82
83
|
"@iconify-icons/logos": "^1.2.36",
|
@@ -123,6 +124,7 @@
|
|
123
124
|
"react-svg": "^16.3.0",
|
124
125
|
"react-use": "^17.6.0",
|
125
126
|
"rebound": "^0.1.0",
|
127
|
+
"semver": "^7.7.2",
|
126
128
|
"topojson-client": "^3.1.0",
|
127
129
|
"type-fest": "^4.41.0",
|
128
130
|
"validator": "^13.15.15",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { UserCardProps,
|
2
|
+
import { UserCardProps, User } from '../types';
|
3
3
|
import TooltipAvatar from '../Content/tooltip-avatar';
|
4
4
|
|
5
5
|
interface AvatarOnlyCardProps extends Omit<UserCardProps, 'user'> {
|
@@ -12,20 +12,6 @@ interface AvatarOnlyCardProps extends Omit<UserCardProps, 'user'> {
|
|
12
12
|
function AvatarOnlyCard(props: AvatarOnlyCardProps) {
|
13
13
|
const { user, infoType, avatarSize = 48, shouldShowHoverCard = false, renderCardContent, ...rest } = props;
|
14
14
|
|
15
|
-
// 对于NameOnly类型使用普通Tooltip
|
16
|
-
if (infoType === InfoType.NameOnly) {
|
17
|
-
return (
|
18
|
-
<TooltipAvatar
|
19
|
-
user={user}
|
20
|
-
avatarSize={avatarSize}
|
21
|
-
shouldShowHoverCard={false}
|
22
|
-
renderCardContent={renderCardContent}
|
23
|
-
tooltipTitle={user.fullName || user.email || user.did}
|
24
|
-
{...rest}
|
25
|
-
/>
|
26
|
-
);
|
27
|
-
}
|
28
|
-
|
29
15
|
// 其他类型使用自定义Tooltip或无Tooltip
|
30
16
|
return (
|
31
17
|
<TooltipAvatar
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import { UserCardProps,
|
3
|
-
import NameOnlyCard from './name-only';
|
2
|
+
import { UserCardProps, User } from '../types';
|
4
3
|
import BasicCard from './basic-info';
|
5
4
|
|
6
5
|
interface DetailedCardProps extends Omit<UserCardProps, 'user'> {
|
@@ -11,15 +10,7 @@ interface DetailedCardProps extends Omit<UserCardProps, 'user'> {
|
|
11
10
|
|
12
11
|
// DetailedCard组件,根据infoType选择不同的卡片组件进行渲染
|
13
12
|
function DetailedCard({ ...props }: DetailedCardProps) {
|
14
|
-
|
15
|
-
|
16
|
-
// 根据信息类型选择合适的卡片组件
|
17
|
-
switch (infoType) {
|
18
|
-
case InfoType.NameOnly:
|
19
|
-
return <NameOnlyCard {...props} />;
|
20
|
-
default:
|
21
|
-
return <BasicCard {...props} />;
|
22
|
-
}
|
13
|
+
return <BasicCard {...props} />;
|
23
14
|
}
|
24
15
|
|
25
16
|
export default DetailedCard;
|