@blocklet/ui-react 3.1.26 → 3.1.28
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/@types/index.d.ts +1 -1
- package/lib/Footer/links.js +26 -33
- package/lib/UserCenter/components/fallback.d.ts +8 -0
- package/lib/UserCenter/components/fallback.js +21 -0
- package/lib/UserCenter/components/user-center.js +205 -200
- package/lib/UserCenter/components/user-info/social-actions/chat.d.ts +5 -0
- package/lib/UserCenter/components/user-info/social-actions/chat.js +24 -0
- package/lib/UserCenter/components/user-info/social-actions/follow.d.ts +2 -0
- package/lib/UserCenter/components/user-info/social-actions/follow.js +19 -0
- package/lib/UserCenter/components/user-info/social-actions/index.d.ts +5 -0
- package/lib/UserCenter/components/user-info/social-actions/index.js +13 -0
- package/lib/UserCenter/components/user-info/user-basic-info.js +37 -35
- package/lib/UserCenter/libs/locales.d.ts +14 -0
- package/lib/UserCenter/libs/locales.js +16 -2
- package/lib/blocklets.js +56 -54
- package/lib/contexts/user-followers.d.ts +13 -0
- package/lib/contexts/user-followers.js +40 -0
- package/lib/hooks/use-follow.d.ts +12 -0
- package/lib/hooks/use-follow.js +47 -0
- package/lib/utils.d.ts +1 -0
- package/lib/utils.js +37 -36
- package/package.json +6 -6
- package/src/@types/index.ts +1 -1
- package/src/Footer/links.jsx +10 -7
- package/src/UserCenter/components/fallback.tsx +51 -0
- package/src/UserCenter/components/user-center.tsx +22 -12
- package/src/UserCenter/components/user-info/social-actions/chat.tsx +42 -0
- package/src/UserCenter/components/user-info/social-actions/follow.tsx +30 -0
- package/src/UserCenter/components/user-info/social-actions/index.tsx +17 -0
- package/src/UserCenter/components/user-info/user-basic-info.tsx +6 -0
- package/src/UserCenter/libs/locales.ts +14 -0
- package/src/blocklets.js +5 -1
- package/src/contexts/user-followers.tsx +54 -0
- package/src/hooks/use-follow.tsx +74 -0
- package/src/utils.js +5 -0
package/lib/@types/index.d.ts
CHANGED
package/lib/Footer/links.js
CHANGED
|
@@ -1,39 +1,32 @@
|
|
|
1
|
-
import { jsx as r, jsxs as m, Fragment as
|
|
2
|
-
import { useState as
|
|
1
|
+
import { jsx as r, jsxs as m, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { useState as $ } from "react";
|
|
3
3
|
import l from "prop-types";
|
|
4
|
-
import { useCreation as
|
|
4
|
+
import { useCreation as M } from "ahooks";
|
|
5
5
|
import j from "lodash/isInteger";
|
|
6
6
|
import I from "lodash/isString";
|
|
7
7
|
import { styled as z } from "@arcblock/ux/lib/Theme";
|
|
8
8
|
import c from "clsx";
|
|
9
|
-
import { ExpandMore as
|
|
10
|
-
import
|
|
9
|
+
import { ExpandMore as C } from "@mui/icons-material";
|
|
10
|
+
import P from "../Icon/index.js";
|
|
11
11
|
import A from "../hooks/use-mobile.js";
|
|
12
|
-
import { splitNavColumns as E } from "../utils.js";
|
|
13
|
-
function
|
|
14
|
-
const [g, b] =
|
|
12
|
+
import { splitNavColumns as E, isMailProtocol as F } from "../utils.js";
|
|
13
|
+
function R({ links: e = [], flowLayout: d = !1, columns: u, ...k }) {
|
|
14
|
+
const [g, b] = $(-1), w = A({ key: "md" }), h = e.some((t) => t.items?.length), x = !w && h && j(u) && u > 1, p = ({ label: t, link: o, icon: i, render: a, props: n }) => {
|
|
15
15
|
let s = t;
|
|
16
16
|
if (a)
|
|
17
17
|
s = a({ label: t, link: o, props: n });
|
|
18
18
|
else if (o && I(o)) {
|
|
19
|
-
const f = o.startsWith("http") || o.startsWith("//")
|
|
20
|
-
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
...n,
|
|
28
|
-
children: t
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
return /* @__PURE__ */ m(v, { children: [
|
|
33
|
-
i && /* @__PURE__ */ r(C, { icon: i, size: 20, sx: { mr: 0.5 } }),
|
|
19
|
+
const f = o.startsWith("http") || o.startsWith("//"), v = F(o) ? {} : {
|
|
20
|
+
target: f ? "_blank" : "_self",
|
|
21
|
+
rel: f ? "noreferrer noopener" : void 0
|
|
22
|
+
};
|
|
23
|
+
s = /* @__PURE__ */ r("a", { href: o, "aria-label": `Footer link for ${t}`, ...v, ...n, children: t });
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ m(N, { children: [
|
|
26
|
+
i && /* @__PURE__ */ r(P, { icon: i, size: 20, sx: { mr: 0.5 } }),
|
|
34
27
|
s
|
|
35
28
|
] });
|
|
36
|
-
}, y =
|
|
29
|
+
}, y = M(() => e?.length ? d ? e.map((t, o) => /* @__PURE__ */ r("span", { className: "footer-links-item", children: p(t) }, o)) : x ? E(e, { columns: u }).map((t, o) => /* @__PURE__ */ r("div", { className: "footer-links-column", children: t.filter((i) => i.group).map((i, a) => {
|
|
37
30
|
const { items: n } = i;
|
|
38
31
|
return /* @__PURE__ */ m("div", { className: "footer-links-group", children: [
|
|
39
32
|
/* @__PURE__ */ r("span", { className: "footer-links-item", children: p(i) }),
|
|
@@ -59,7 +52,7 @@ function F({ links: e = [], flowLayout: d = !1, columns: u, ...x }) {
|
|
|
59
52
|
/* @__PURE__ */ m("span", { className: "footer-links-item", children: [
|
|
60
53
|
p(t),
|
|
61
54
|
!!i?.length && /* @__PURE__ */ r("span", { className: "footer-links-group-expand-icon", children: /* @__PURE__ */ r(
|
|
62
|
-
|
|
55
|
+
C,
|
|
63
56
|
{
|
|
64
57
|
style: {
|
|
65
58
|
transform: `rotate(${a ? 180 : 0}deg)`
|
|
@@ -72,21 +65,21 @@ function F({ links: e = [], flowLayout: d = !1, columns: u, ...x }) {
|
|
|
72
65
|
},
|
|
73
66
|
o
|
|
74
67
|
);
|
|
75
|
-
}) : null, [e, d,
|
|
68
|
+
}) : null, [e, d, x, g]);
|
|
76
69
|
return e?.length ? /* @__PURE__ */ r(
|
|
77
|
-
|
|
70
|
+
S,
|
|
78
71
|
{
|
|
79
|
-
...
|
|
80
|
-
className: c(
|
|
72
|
+
...k,
|
|
73
|
+
className: c(k.className, {
|
|
81
74
|
"footer-links--grouped": h,
|
|
82
75
|
"footer-links--flow": d,
|
|
83
|
-
"footer-links--columns":
|
|
76
|
+
"footer-links--columns": x
|
|
84
77
|
}),
|
|
85
78
|
children: /* @__PURE__ */ r("div", { className: "footer-links-inner", children: y })
|
|
86
79
|
}
|
|
87
80
|
) : null;
|
|
88
81
|
}
|
|
89
|
-
|
|
82
|
+
R.propTypes = {
|
|
90
83
|
links: l.arrayOf(
|
|
91
84
|
l.shape({
|
|
92
85
|
label: l.string,
|
|
@@ -100,7 +93,7 @@ F.propTypes = {
|
|
|
100
93
|
// 列布局
|
|
101
94
|
columns: l.number.isRequired
|
|
102
95
|
};
|
|
103
|
-
const
|
|
96
|
+
const S = z("div")`
|
|
104
97
|
overflow: hidden;
|
|
105
98
|
color: ${({ theme: e }) => e.palette.text.secondary};
|
|
106
99
|
.footer-links-inner {
|
|
@@ -251,5 +244,5 @@ const R = z("div")`
|
|
|
251
244
|
}
|
|
252
245
|
`;
|
|
253
246
|
export {
|
|
254
|
-
|
|
247
|
+
R as default
|
|
255
248
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { UserCenterTab } from '../../@types';
|
|
3
|
+
declare function Fallback({ currentActiveTab, isMyself, children, }: {
|
|
4
|
+
currentActiveTab: UserCenterTab;
|
|
5
|
+
isMyself: boolean;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
8
|
+
export default Fallback;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import n from "@arcblock/ux/lib/Empty";
|
|
3
|
+
import { translate as c } from "@arcblock/ux/lib/Locale/util";
|
|
4
|
+
import { useMemoizedFn as d } from "ahooks";
|
|
5
|
+
import { useLocaleContext as u } from "@arcblock/ux/lib/Locale/context";
|
|
6
|
+
import { translations as a } from "../libs/locales.js";
|
|
7
|
+
import { useUserFollowersContext as w } from "../../contexts/user-followers.js";
|
|
8
|
+
function k({
|
|
9
|
+
currentActiveTab: o,
|
|
10
|
+
isMyself: m,
|
|
11
|
+
children: l
|
|
12
|
+
}) {
|
|
13
|
+
const { locale: f } = u(), r = d((s, p = {}) => c(a, s, f, "en", p)), { followed: i } = w();
|
|
14
|
+
if (m || !o?.protected || o?.protected === "all")
|
|
15
|
+
return l;
|
|
16
|
+
const { protected: t } = o;
|
|
17
|
+
return t === !0 || t === "private" ? /* @__PURE__ */ e(n, { children: r("underProtected") }) : t === "follower-only" ? i ? l : /* @__PURE__ */ e(n, { children: r("followersOnly") }) : /* @__PURE__ */ e(n, { children: r("underProtected") });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
k as default
|
|
21
|
+
};
|