@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.
@@ -1,36 +1,38 @@
1
1
  'use client';
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";
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 { 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 () => {
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
- m(e.data);
15
+ f(e.data);
16
16
  };
17
- v(() => {
18
- f();
17
+ w(() => {
18
+ m();
19
19
  }, []);
20
- const s = (e) => {
21
- var t, i;
22
- return /* @__PURE__ */ l(
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: () => c(""),
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/${(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`,
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__ */ l(g, { children: [
45
+ return /* @__PURE__ */ a(g, { children: [
44
46
  /* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
45
- w,
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: a.map((e) => ({
55
- label: s(e),
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(n, { value: "title", parentKey: "browser" }) })
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: 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
- ) })
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
- D as default
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 k from "@ichaingo/better-link";
9
- import { useLocale as S } from "next-intl";
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 C } from "next/navigation";
16
- import D from "./Explorer.js";
17
- function Z({ onClick: s = () => {
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 } = k(), t = S(), l = C(), [y, E] = p(""), [n, L] = p(b), _ = [
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: t }),
23
- key: `/${t}`,
22
+ href: g({ locale: s }),
23
+ key: `/${s}`,
24
24
  label: /* @__PURE__ */ r("span", { children: "iSearch" }),
25
- show: (e) => e === `/${t}` || e.includes(`/${t}/conversation`)
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: t }),
29
+ href: w({ locale: s }),
30
30
  key: "/sql",
31
31
  label: "iSQL",
32
- show: (e) => e.includes(`/${t}/sql`)
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(D, {}),
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: 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 })
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: s }),
101
+ /* @__PURE__ */ r(N, { onClick: t }),
102
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" })
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.29",
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.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"
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
  }