@ichaingo/header 1.5.34 → 1.5.36
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/dist/lib/Drawer.js +13 -13
- package/dist/lib/Explorer.js +52 -43
- package/dist/lib/Nav.js +37 -47
- package/package.json +14 -14
package/dist/lib/Drawer.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as o, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { Menu as
|
|
5
|
-
import
|
|
6
|
-
import { useState as
|
|
7
|
-
function b({ hideLogin:
|
|
8
|
-
const [
|
|
9
|
-
if (!
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
2
|
+
import { jsx as o, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
import c from "rc-drawer";
|
|
4
|
+
import { Menu as d, X as m } from "lucide-react";
|
|
5
|
+
import p from "./Nav.js";
|
|
6
|
+
import { useState as f } from "react";
|
|
7
|
+
function b({ hideLogin: s, hideNews: a, user: i }) {
|
|
8
|
+
const [r, t] = f(!1);
|
|
9
|
+
if (!r)
|
|
10
|
+
return /* @__PURE__ */ o(d, { onClick: () => t(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden bg-module rounded-lg p-[4px] " });
|
|
11
11
|
const l = (e) => {
|
|
12
|
-
e == null || e.preventDefault(), e == null || e.stopPropagation(),
|
|
12
|
+
e == null || e.preventDefault(), e == null || e.stopPropagation(), t(!1);
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
15
|
-
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(
|
|
16
|
-
/* @__PURE__ */ o(
|
|
14
|
+
return /* @__PURE__ */ o(c, { open: r, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background/70 p-2 h-screen", children: /* @__PURE__ */ n("div", { className: "w-full max-h-[calc(100svh-16px)] overflow-y-auto p-3 bg-module rounded-lg", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(m, { size: 24, style: { color: "var(--title)" }, onClick: (e) => l(e) }) }),
|
|
16
|
+
/* @__PURE__ */ o(p, { onClick: (e) => l(e), hideLogin: s, hideNews: a, user: i })
|
|
17
17
|
] }) });
|
|
18
18
|
}
|
|
19
19
|
export {
|
package/dist/lib/Explorer.js
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as a, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import { Dropdown as
|
|
5
|
-
import { useState as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
2
|
+
import { jsxs as a, Fragment as w, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import f from "@ichaingo/translation";
|
|
4
|
+
import { Dropdown as g } from "antd";
|
|
5
|
+
import { useState as u, useEffect as b } from "react";
|
|
6
|
+
import N from "@ichaingo/request";
|
|
7
|
+
import y from "@ichaingo/link";
|
|
8
|
+
import x from "@ichaingo/better-link";
|
|
9
|
+
import L from "@ichaingo/image";
|
|
10
10
|
import { usePathname as A } from "next/navigation";
|
|
11
|
-
import { Accordion as
|
|
12
|
-
function
|
|
13
|
-
} }) {
|
|
11
|
+
import { Accordion as I, AccordionItem as S, AccordionTrigger as j } from "@ichaingo/ui/accordion";
|
|
12
|
+
function R({ onClick: o = () => {
|
|
13
|
+
}, onExpandChange: l }) {
|
|
14
14
|
A();
|
|
15
|
-
const { gotoExplorer:
|
|
16
|
-
const e = await
|
|
17
|
-
|
|
15
|
+
const { gotoExplorer: p } = x(), [s, h] = u([]), [t, n] = u(""), v = async () => {
|
|
16
|
+
const e = await N.get("/api/v2/chains/all-chain-list/basic");
|
|
17
|
+
h(e.data);
|
|
18
18
|
};
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
b(() => {
|
|
20
|
+
v();
|
|
21
21
|
}, []);
|
|
22
22
|
const c = (e) => {
|
|
23
|
-
var
|
|
23
|
+
var i, d;
|
|
24
24
|
return /* @__PURE__ */ a(
|
|
25
|
-
|
|
25
|
+
y,
|
|
26
26
|
{
|
|
27
|
-
href:
|
|
27
|
+
href: p({ chain: e.chainSymbol }),
|
|
28
28
|
className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium",
|
|
29
29
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
30
|
-
onClick: (
|
|
31
|
-
|
|
30
|
+
onClick: (m) => {
|
|
31
|
+
m.preventDefault(), m.stopPropagation(), o == null || o(), n("");
|
|
32
32
|
},
|
|
33
33
|
children: [
|
|
34
34
|
/* @__PURE__ */ r(
|
|
35
|
-
|
|
35
|
+
L,
|
|
36
36
|
{
|
|
37
|
-
src: e != null && e.chainIconUrl ? e == null ? void 0 : e.chainIconUrl : `//cdn.ichaingo.com/module/cryptos/${(
|
|
37
|
+
src: e != null && e.chainIconUrl ? e == null ? void 0 : e.chainIconUrl : `//cdn.ichaingo.com/module/cryptos/${(d = (i = e == null ? void 0 : e.chain) == null ? void 0 : i.toLowerCase()) == null ? void 0 : d.replace(" ", "-")}.png?format=auto&width=20&height=20`,
|
|
38
38
|
className: "w-5 h-5",
|
|
39
39
|
objectFit: "contain"
|
|
40
40
|
}
|
|
@@ -44,9 +44,9 @@ function F({ onClick: o = () => {
|
|
|
44
44
|
}
|
|
45
45
|
);
|
|
46
46
|
};
|
|
47
|
-
return /* @__PURE__ */ a(
|
|
47
|
+
return /* @__PURE__ */ a(w, { children: [
|
|
48
48
|
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
|
|
49
|
-
|
|
49
|
+
g,
|
|
50
50
|
{
|
|
51
51
|
getPopupContainer: () => document.body,
|
|
52
52
|
classNames: {
|
|
@@ -55,32 +55,41 @@ function F({ onClick: o = () => {
|
|
|
55
55
|
arrow: { pointAtCenter: !0 },
|
|
56
56
|
placement: "bottom",
|
|
57
57
|
menu: {
|
|
58
|
-
items:
|
|
58
|
+
items: s.map((e) => ({
|
|
59
59
|
label: c(e),
|
|
60
60
|
key: e.chainSymbol
|
|
61
61
|
}))
|
|
62
62
|
},
|
|
63
|
-
children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(
|
|
63
|
+
children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(f, { value: "title", parentKey: "browser" }) })
|
|
64
64
|
}
|
|
65
65
|
) }),
|
|
66
|
-
/* @__PURE__ */ r("div", { className: "md:hidden w-full", children: /* @__PURE__ */
|
|
66
|
+
/* @__PURE__ */ r("div", { className: "md:hidden w-full", children: /* @__PURE__ */ a("div", { onClick: (e) => {
|
|
67
67
|
e.preventDefault(), e.stopPropagation();
|
|
68
|
-
}, children:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
}, children: [
|
|
69
|
+
/* @__PURE__ */ r(
|
|
70
|
+
I,
|
|
71
|
+
{
|
|
72
|
+
type: "single",
|
|
73
|
+
collapsible: !0,
|
|
74
|
+
className: "w-full",
|
|
75
|
+
value: t,
|
|
76
|
+
onValueChange: (e) => {
|
|
77
|
+
n(e), l == null || l(!!e);
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ r(S, { value: "explorer", className: "border-0", children: /* @__PURE__ */ r(j, { className: "rounded-lg font-medium h-11 w-full flex py-2 justify-between items-center hover:no-underline focus-visible:ring-0 focus-visible:ring-offset-0", children: /* @__PURE__ */ r("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ r("span", { className: "text-title", children: /* @__PURE__ */ r(f, { value: "title", parentKey: "browser" }) }) }) }) })
|
|
80
|
+
}
|
|
81
|
+
),
|
|
82
|
+
/* @__PURE__ */ r(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
className: "grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
86
|
+
style: { gridTemplateRows: t ? "1fr" : "0fr" },
|
|
87
|
+
children: /* @__PURE__ */ r("div", { className: "overflow-hidden", children: /* @__PURE__ */ r("div", { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: s.map((e) => /* @__PURE__ */ r("div", { className: "w-full", children: c(e) }, e.chainSymbol)) }) })
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] }) })
|
|
82
91
|
] });
|
|
83
92
|
}
|
|
84
93
|
export {
|
|
85
|
-
|
|
94
|
+
R as default
|
|
86
95
|
};
|
package/dist/lib/Nav.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import
|
|
2
|
+
import { jsx as r, jsxs as d, Fragment as L } from "react/jsx-runtime";
|
|
3
|
+
import _ from "@ichaingo/link";
|
|
4
4
|
import v from "./User/index.js";
|
|
5
5
|
import N from "./Setting/index.js";
|
|
6
|
-
import
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
6
|
+
import u from "@ichaingo/translation";
|
|
7
|
+
import { twMerge as a } from "tailwind-merge";
|
|
8
|
+
import k from "@ichaingo/better-link";
|
|
9
|
+
import { useLocale as S } from "next-intl";
|
|
10
10
|
import P from "./User/Logout.js";
|
|
11
|
-
import { useState as
|
|
12
|
-
import
|
|
13
|
-
import { fetchUserProfile as
|
|
14
|
-
import { onUserEvent as A, cleanUserEvent as R, USER_EVENTS as
|
|
15
|
-
import { usePathname as
|
|
16
|
-
import
|
|
17
|
-
function
|
|
18
|
-
}, hideNews:
|
|
19
|
-
const { gotoAISQL:
|
|
11
|
+
import { useState as m, useCallback as B, useEffect as T } from "react";
|
|
12
|
+
import I from "./User/SignIn.js";
|
|
13
|
+
import { fetchUserProfile as j } from "@ichaingo/auth";
|
|
14
|
+
import { onUserEvent as A, cleanUserEvent as R, USER_EVENTS as f } from "./events.js";
|
|
15
|
+
import { usePathname as C } from "next/navigation";
|
|
16
|
+
import D from "./Explorer.js";
|
|
17
|
+
function ee({ onClick: s = () => {
|
|
18
|
+
}, hideNews: p = !1, hideLogin: c = !1, user: h }) {
|
|
19
|
+
const { gotoAISQL: x, gotoChat: U } = k(), t = S(), l = C(), [w, g] = m(""), [o, E] = m(h), [X, b] = m(!1), y = [
|
|
20
20
|
{
|
|
21
21
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
22
|
-
href:
|
|
23
|
-
key: `/${
|
|
22
|
+
href: U({ locale: t }),
|
|
23
|
+
key: `/${t}`,
|
|
24
24
|
label: /* @__PURE__ */ r("span", { children: "iSearch" }),
|
|
25
|
-
show: (e) => e === `/${
|
|
25
|
+
show: (e) => e === `/${t}` || e.includes(`/${t}/conversation`)
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
29
|
-
href:
|
|
29
|
+
href: x({ locale: t }),
|
|
30
30
|
key: "/sql",
|
|
31
31
|
label: "iSQL",
|
|
32
|
-
show: (e) => e.includes(`/${
|
|
32
|
+
show: (e) => e.includes(`/${t}/sql`)
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
35
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
36
36
|
href: "/explorer",
|
|
37
37
|
key: "/explorer",
|
|
38
|
-
label: /* @__PURE__ */ r(
|
|
38
|
+
label: /* @__PURE__ */ r(D, { onClick: s, onExpandChange: b }),
|
|
39
39
|
show: (e) => e.includes("/explorer")
|
|
40
40
|
},
|
|
41
41
|
// {
|
|
@@ -51,27 +51,27 @@ function Z({ onClick: t = () => {
|
|
|
51
51
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
52
52
|
href: "/news",
|
|
53
53
|
key: "/news",
|
|
54
|
-
label: /* @__PURE__ */ r(
|
|
54
|
+
label: /* @__PURE__ */ r(u, { value: "news", parentKey: "menu" }),
|
|
55
55
|
show: (e) => e.includes("/news")
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
59
59
|
href: "/ranking/token",
|
|
60
60
|
key: "/ranking",
|
|
61
|
-
label: /* @__PURE__ */ r(
|
|
61
|
+
label: /* @__PURE__ */ r(u, { value: "ranking", parentKey: "menu" }),
|
|
62
62
|
show: (e) => e.includes("/ranking")
|
|
63
63
|
}
|
|
64
|
-
].filter((e) =>
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
].filter((e) => p ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), i = B(() => new Promise((e) => {
|
|
65
|
+
j().then((n) => {
|
|
66
|
+
E(n), g((/* @__PURE__ */ new Date()).getTime().toString()), e(n);
|
|
67
67
|
});
|
|
68
68
|
}), []);
|
|
69
|
-
return T(() => (A(
|
|
70
|
-
R(
|
|
71
|
-
}), []), /* @__PURE__ */
|
|
69
|
+
return T(() => (A(f.PROFILE_UPDATED, i), () => {
|
|
70
|
+
R(f.PROFILE_UPDATED, i);
|
|
71
|
+
}), []), /* @__PURE__ */ d(
|
|
72
72
|
"nav",
|
|
73
73
|
{
|
|
74
|
-
className:
|
|
74
|
+
className: a(
|
|
75
75
|
"flex flex-col justify-start items-start md:px-3",
|
|
76
76
|
"md:flex-row md:justify-end md:items-center md:px-0",
|
|
77
77
|
"md:gap-4"
|
|
@@ -80,33 +80,23 @@ function Z({ onClick: t = () => {
|
|
|
80
80
|
/* @__PURE__ */ r(
|
|
81
81
|
"ul",
|
|
82
82
|
{
|
|
83
|
-
className:
|
|
83
|
+
className: a(
|
|
84
84
|
"flex flex-col justify-start items-start w-full h-full text-sm z-1001 text-title",
|
|
85
85
|
"md:flex-row md:items-center md:w-auto md:h-[34px] md:gap-6",
|
|
86
86
|
"order-2 md:order-0"
|
|
87
87
|
),
|
|
88
|
-
children:
|
|
89
|
-
const d = e.key === "/explorer" && l.includes("/explorer");
|
|
90
|
-
return /* @__PURE__ */ r("li", {
|
|
91
|
-
className: i("w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full", d ? "h-auto" : "h-11", e.show(l) ? "md:text-primary md:bg-primary/20" : "md:hover:bg-stroke"),
|
|
92
|
-
// 移动端 Explorer 页面:直接渲染 Explorer 组件(内部处理展开逻辑),不包裹 Link
|
|
93
|
-
children: d ? /* @__PURE__ */ a(u, { children: [
|
|
94
|
-
/* @__PURE__ */ r("div", { className: "h-full flex items-center justify-start md:hidden", children: e.label }),
|
|
95
|
-
/* @__PURE__ */ r(f, { href: e.href, onClick: t, className: "h-full hidden md:flex items-center justify-start", baseUrl: e.baseUrl, suppressHydrationWarning: !0, children: e.label })
|
|
96
|
-
] }) : e.href === l ? e.label : /* @__PURE__ */ r(f, { href: e.href, onClick: t, className: "h-full flex items-center justify-start", baseUrl: e.baseUrl, suppressHydrationWarning: !0, children: e.label })
|
|
97
|
-
}, o);
|
|
98
|
-
})
|
|
88
|
+
children: y.map((e, n) => /* @__PURE__ */ r("li", { className: a("w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full", e.key === "/explorer" ? "h-auto" : "h-11", e.show(l) ? "md:text-primary md:bg-primary/20" : "md:hover:bg-stroke"), children: e.href === l ? e.label : /* @__PURE__ */ r(_, { href: e.href, onClick: s, className: "h-full flex items-center justify-start", baseUrl: e.baseUrl, suppressHydrationWarning: !0, children: e.label }) }, n))
|
|
99
89
|
}
|
|
100
90
|
),
|
|
101
|
-
/* @__PURE__ */ r(N, { onClick:
|
|
102
|
-
!l.includes("/login") && !
|
|
103
|
-
/* @__PURE__ */ r(v, { onClick:
|
|
104
|
-
|
|
91
|
+
/* @__PURE__ */ r(N, { onClick: s }),
|
|
92
|
+
!l.includes("/login") && !c ? /* @__PURE__ */ d(L, { children: [
|
|
93
|
+
/* @__PURE__ */ r(v, { onClick: s, userInfo: o }, w),
|
|
94
|
+
o != null && o.id ? /* @__PURE__ */ r("div", { className: "flex md:hidden h-11 md:h-auto cursor-pointer whitespace-nowrap order-3 bg-background rounded-lg p-2 mt-3 w-full items-center justify-center text-subtitle", children: /* @__PURE__ */ r(P, {}) }) : /* @__PURE__ */ r(I, { onClick: s, className: "flex md:hidden h-11 cursor-pointer whitespace-nowrap order-3 bg-primary text-white rounded-lg p-2 mt-3 w-full items-center justify-center" })
|
|
105
95
|
] }) : null
|
|
106
96
|
]
|
|
107
97
|
}
|
|
108
98
|
);
|
|
109
99
|
}
|
|
110
100
|
export {
|
|
111
|
-
|
|
101
|
+
ee as default
|
|
112
102
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.36",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -32,18 +32,18 @@
|
|
|
32
32
|
"tailwind-merge": "3.3.1",
|
|
33
33
|
"next": "15.5.6",
|
|
34
34
|
"antd": "6.1.1",
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/link": "1.5.
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
46
|
-
"@ichaingo/
|
|
47
|
-
"@ichaingo/
|
|
35
|
+
"@ichaingo/auth": "1.5.36",
|
|
36
|
+
"@ichaingo/avatar": "1.5.36",
|
|
37
|
+
"@ichaingo/image": "1.5.36",
|
|
38
|
+
"@ichaingo/better-link": "1.5.36",
|
|
39
|
+
"@ichaingo/translation": "1.5.36",
|
|
40
|
+
"@ichaingo/link": "1.5.36",
|
|
41
|
+
"@ichaingo/iconfont": "1.5.36",
|
|
42
|
+
"@ichaingo/theme-toggle": "1.5.36",
|
|
43
|
+
"@ichaingo/with-login": "1.5.36",
|
|
44
|
+
"@ichaingo/request": "1.5.36",
|
|
45
|
+
"@ichaingo/ui": "1.5.36",
|
|
46
|
+
"@ichaingo/tooltip": "1.5.36",
|
|
47
|
+
"@ichaingo/token": "1.5.36"
|
|
48
48
|
}
|
|
49
49
|
}
|