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