@ichaingo/header 1.5.28 → 1.5.29
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/Explorer.js +81 -39
- package/dist/lib/Nav.js +46 -36
- package/package.json +14 -14
package/dist/lib/Explorer.js
CHANGED
|
@@ -1,46 +1,88 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { Dropdown as
|
|
5
|
-
import { useState as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsxs as l, Fragment as g, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import n from "@ichaingo/translation";
|
|
4
|
+
import { Dropdown as w } from "antd";
|
|
5
|
+
import { useState as d, useEffect as v } from "react";
|
|
6
|
+
import b from "@ichaingo/request";
|
|
7
|
+
import x from "@ichaingo/link";
|
|
8
|
+
import y from "@ichaingo/better-link";
|
|
9
|
+
import N from "@ichaingo/image";
|
|
10
|
+
import { usePathname as C } from "next/navigation";
|
|
11
|
+
import { Accordion as A, AccordionItem as L, AccordionTrigger as k, AccordionContent as E } from "@ichaingo/ui/accordion";
|
|
12
|
+
function D() {
|
|
13
|
+
const o = C(), p = o == null ? void 0 : o.includes("/explorer"), { gotoExplorer: u } = y(), [a, m] = d([]), [h, c] = d(""), f = async () => {
|
|
14
|
+
const e = await b.get("/api/v2/chains/all-chain-list/basic");
|
|
15
|
+
m(e.data);
|
|
14
16
|
};
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
v(() => {
|
|
18
|
+
f();
|
|
17
19
|
}, []);
|
|
18
|
-
const
|
|
19
|
-
var
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const s = (e) => {
|
|
21
|
+
var t, i;
|
|
22
|
+
return /* @__PURE__ */ l(
|
|
23
|
+
x,
|
|
24
|
+
{
|
|
25
|
+
href: u({ chain: e.chainSymbol }),
|
|
26
|
+
className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium",
|
|
27
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
28
|
+
onClick: () => c(""),
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ r(
|
|
31
|
+
N,
|
|
32
|
+
{
|
|
33
|
+
src: e != null && e.chainIconUrl ? e == null ? void 0 : e.chainIconUrl : `//cdn.ichaingo.com/module/cryptos/${(i = (t = e == null ? void 0 : e.chain) == null ? void 0 : t.toLowerCase()) == null ? void 0 : i.replace(" ", "-")}.png?format=auto&width=20&height=20`,
|
|
34
|
+
className: "w-5 h-5",
|
|
35
|
+
objectFit: "contain"
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ r("div", { className: "flex-1", children: e == null ? void 0 : e.chainSymbol })
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
24
42
|
};
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
return /* @__PURE__ */ l(g, { children: [
|
|
44
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
|
|
45
|
+
w,
|
|
46
|
+
{
|
|
47
|
+
getPopupContainer: () => document.body,
|
|
48
|
+
classNames: {
|
|
49
|
+
root: "w-50"
|
|
50
|
+
},
|
|
51
|
+
arrow: { pointAtCenter: !0 },
|
|
52
|
+
placement: "bottom",
|
|
53
|
+
menu: {
|
|
54
|
+
items: a.map((e) => ({
|
|
55
|
+
label: s(e),
|
|
56
|
+
key: e.chainSymbol
|
|
57
|
+
}))
|
|
58
|
+
},
|
|
59
|
+
children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(n, { value: "title", parentKey: "browser" }) })
|
|
60
|
+
}
|
|
61
|
+
) }),
|
|
62
|
+
/* @__PURE__ */ r("div", { className: "md:hidden w-full", children: p ? (
|
|
63
|
+
// Explorer 页面:点击展开列表,阻止外层 Link 跳转
|
|
64
|
+
/* @__PURE__ */ r("div", { onClick: (e) => {
|
|
65
|
+
e.preventDefault(), e.stopPropagation();
|
|
66
|
+
}, children: /* @__PURE__ */ r(
|
|
67
|
+
A,
|
|
68
|
+
{
|
|
69
|
+
type: "single",
|
|
70
|
+
collapsible: !0,
|
|
71
|
+
className: "w-full",
|
|
72
|
+
value: h,
|
|
73
|
+
onValueChange: c,
|
|
74
|
+
children: /* @__PURE__ */ l(L, { value: "explorer", className: "border-0", children: [
|
|
75
|
+
/* @__PURE__ */ r(k, { 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(n, { value: "title", parentKey: "browser" }) }) }) }),
|
|
76
|
+
/* @__PURE__ */ r(E, { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: a.map((e) => /* @__PURE__ */ r("div", { className: "w-full", children: s(e) }, e.chainSymbol)) })
|
|
77
|
+
] })
|
|
78
|
+
}
|
|
79
|
+
) })
|
|
80
|
+
) : (
|
|
81
|
+
// 非 explorer 页面:让外层 Link 正常跳转
|
|
82
|
+
/* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(n, { value: "title", parentKey: "browser" }) })
|
|
83
|
+
) })
|
|
84
|
+
] });
|
|
43
85
|
}
|
|
44
86
|
export {
|
|
45
|
-
|
|
87
|
+
D as default
|
|
46
88
|
};
|
package/dist/lib/Nav.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import
|
|
11
|
-
import { useState as
|
|
12
|
-
import
|
|
2
|
+
import { jsx as r, jsxs as a, Fragment as u } from "react/jsx-runtime";
|
|
3
|
+
import f from "@ichaingo/link";
|
|
4
|
+
import v from "./User/index.js";
|
|
5
|
+
import N from "./Setting/index.js";
|
|
6
|
+
import c from "@ichaingo/translation";
|
|
7
|
+
import { twMerge as i } from "tailwind-merge";
|
|
8
|
+
import k from "@ichaingo/better-link";
|
|
9
|
+
import { useLocale as S } from "next-intl";
|
|
10
|
+
import P from "./User/Logout.js";
|
|
11
|
+
import { useState as p, useCallback as B, useEffect as T } from "react";
|
|
12
|
+
import j from "./User/SignIn.js";
|
|
13
13
|
import { fetchUserProfile as I } from "@ichaingo/auth";
|
|
14
|
-
import { onUserEvent as
|
|
15
|
-
import { usePathname as
|
|
16
|
-
import
|
|
17
|
-
function
|
|
18
|
-
}, hideNews:
|
|
19
|
-
const { gotoAISQL:
|
|
14
|
+
import { onUserEvent as A, cleanUserEvent as R, USER_EVENTS as h } from "./events.js";
|
|
15
|
+
import { usePathname as C } from "next/navigation";
|
|
16
|
+
import D from "./Explorer.js";
|
|
17
|
+
function Z({ onClick: s = () => {
|
|
18
|
+
}, hideNews: x = !1, hideLogin: U = !1, user: b }) {
|
|
19
|
+
const { gotoAISQL: w, gotoChat: g } = k(), t = S(), l = C(), [y, E] = p(""), [n, L] = p(b), _ = [
|
|
20
20
|
{
|
|
21
21
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
22
|
-
href:
|
|
22
|
+
href: g({ locale: t }),
|
|
23
23
|
key: `/${t}`,
|
|
24
24
|
label: /* @__PURE__ */ r("span", { children: "iSearch" }),
|
|
25
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: w({ locale: t }),
|
|
30
30
|
key: "/sql",
|
|
31
31
|
label: "iSQL",
|
|
32
32
|
show: (e) => e.includes(`/${t}/sql`)
|
|
@@ -35,7 +35,7 @@ function Y({ onClick: s = () => {
|
|
|
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, {}),
|
|
39
39
|
show: (e) => e.includes("/explorer")
|
|
40
40
|
},
|
|
41
41
|
// {
|
|
@@ -51,27 +51,27 @@ function Y({ onClick: s = () => {
|
|
|
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(c, { 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(c, { value: "ranking", parentKey: "menu" }),
|
|
62
62
|
show: (e) => e.includes("/ranking")
|
|
63
63
|
}
|
|
64
|
-
].filter((e) =>
|
|
65
|
-
I().then((
|
|
66
|
-
|
|
64
|
+
].filter((e) => x ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), m = B(() => new Promise((e) => {
|
|
65
|
+
I().then((o) => {
|
|
66
|
+
L(o), E((/* @__PURE__ */ new Date()).getTime().toString()), e(o);
|
|
67
67
|
});
|
|
68
68
|
}), []);
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
}), []), /* @__PURE__ */
|
|
69
|
+
return T(() => (A(h.PROFILE_UPDATED, m), () => {
|
|
70
|
+
R(h.PROFILE_UPDATED, m);
|
|
71
|
+
}), []), /* @__PURE__ */ a(
|
|
72
72
|
"nav",
|
|
73
73
|
{
|
|
74
|
-
className:
|
|
74
|
+
className: i(
|
|
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,23 +80,33 @@ function Y({ onClick: s = () => {
|
|
|
80
80
|
/* @__PURE__ */ r(
|
|
81
81
|
"ul",
|
|
82
82
|
{
|
|
83
|
-
className:
|
|
83
|
+
className: i(
|
|
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:
|
|
88
|
+
children: _.map((e, o) => {
|
|
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: s, 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: s, className: "h-full flex items-center justify-start", baseUrl: e.baseUrl, suppressHydrationWarning: !0, children: e.label })
|
|
97
|
+
}, o);
|
|
98
|
+
})
|
|
89
99
|
}
|
|
90
100
|
),
|
|
91
|
-
/* @__PURE__ */ r(
|
|
92
|
-
!l.includes("/login") && !
|
|
93
|
-
/* @__PURE__ */ r(
|
|
94
|
-
|
|
101
|
+
/* @__PURE__ */ r(N, { onClick: s }),
|
|
102
|
+
!l.includes("/login") && !U ? /* @__PURE__ */ a(u, { children: [
|
|
103
|
+
/* @__PURE__ */ r(v, { onClick: s, userInfo: n }, y),
|
|
104
|
+
n != null && n.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(j, { 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" })
|
|
95
105
|
] }) : null
|
|
96
106
|
]
|
|
97
107
|
}
|
|
98
108
|
);
|
|
99
109
|
}
|
|
100
110
|
export {
|
|
101
|
-
|
|
111
|
+
Z as default
|
|
102
112
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.29",
|
|
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/image": "1.5.
|
|
38
|
-
"@ichaingo/better-link": "1.5.
|
|
39
|
-
"@ichaingo/link": "1.5.
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/with-login": "1.5.
|
|
45
|
-
"@ichaingo/
|
|
46
|
-
"@ichaingo/tooltip": "1.5.
|
|
47
|
-
"@ichaingo/
|
|
35
|
+
"@ichaingo/auth": "1.5.29",
|
|
36
|
+
"@ichaingo/avatar": "1.5.29",
|
|
37
|
+
"@ichaingo/image": "1.5.29",
|
|
38
|
+
"@ichaingo/better-link": "1.5.29",
|
|
39
|
+
"@ichaingo/link": "1.5.29",
|
|
40
|
+
"@ichaingo/translation": "1.5.29",
|
|
41
|
+
"@ichaingo/theme-toggle": "1.5.29",
|
|
42
|
+
"@ichaingo/request": "1.5.29",
|
|
43
|
+
"@ichaingo/ui": "1.5.29",
|
|
44
|
+
"@ichaingo/with-login": "1.5.29",
|
|
45
|
+
"@ichaingo/token": "1.5.29",
|
|
46
|
+
"@ichaingo/tooltip": "1.5.29",
|
|
47
|
+
"@ichaingo/iconfont": "1.5.29"
|
|
48
48
|
}
|
|
49
49
|
}
|