@ichaingo/header 1.5.31 → 1.5.33

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.
Files changed (2) hide show
  1. package/dist/lib/Explorer.js +50 -43
  2. package/package.json +14 -14
@@ -1,38 +1,39 @@
1
1
  'use client';
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
- 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 { Accordion as A, AccordionItem as L, AccordionTrigger as I, AccordionContent as S } from "@ichaingo/ui/accordion";
11
- function F({ onClick: o = () => {
2
+ import { jsxs as a, Fragment as w, jsx as r } from "react/jsx-runtime";
3
+ import n from "@ichaingo/translation";
4
+ import { Dropdown as b } from "antd";
5
+ import { useState as u, useEffect as x } from "react";
6
+ import y from "@ichaingo/request";
7
+ import N from "@ichaingo/link";
8
+ import A from "@ichaingo/better-link";
9
+ import L from "@ichaingo/image";
10
+ import { usePathname as E } from "next/navigation";
11
+ import { Accordion as I, AccordionItem as P, AccordionTrigger as S, AccordionContent as j } from "@ichaingo/ui/accordion";
12
+ function q({ onClick: o = () => {
12
13
  } }) {
13
- const { gotoExplorer: u } = y(), [l, f] = p([]), [h, n] = p(""), m = async () => {
14
- const e = await b.get("/api/v2/chains/all-chain-list/basic");
15
- f(e.data);
14
+ const l = E(), m = l == null ? void 0 : l.includes("/explorer"), { gotoExplorer: f } = A(), [c, h] = u([]), [g, s] = u(""), v = async () => {
15
+ const e = await y.get("/api/v2/chains/all-chain-list/basic");
16
+ h(e.data);
16
17
  };
17
- w(() => {
18
- m();
18
+ x(() => {
19
+ v();
19
20
  }, []);
20
21
  const t = (e) => {
21
- var s, c;
22
+ var i, d;
22
23
  return /* @__PURE__ */ a(
23
- x,
24
+ N,
24
25
  {
25
- href: u({ chain: e.chainSymbol }),
26
+ href: f({ chain: e.chainSymbol }),
26
27
  className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium",
27
28
  baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
28
- onClick: (i) => {
29
- i.preventDefault(), i.stopPropagation(), o == null || o(), n("");
29
+ onClick: (p) => {
30
+ p.preventDefault(), p.stopPropagation(), o == null || o(), s("");
30
31
  },
31
32
  children: [
32
33
  /* @__PURE__ */ r(
33
- N,
34
+ L,
34
35
  {
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`,
36
+ 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`,
36
37
  className: "w-5 h-5",
37
38
  objectFit: "contain"
38
39
  }
@@ -42,9 +43,9 @@ function F({ onClick: o = () => {
42
43
  }
43
44
  );
44
45
  };
45
- return /* @__PURE__ */ a(g, { children: [
46
+ return /* @__PURE__ */ a(w, { children: [
46
47
  /* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
47
- v,
48
+ b,
48
49
  {
49
50
  getPopupContainer: () => document.body,
50
51
  classNames: {
@@ -53,32 +54,38 @@ function F({ onClick: o = () => {
53
54
  arrow: { pointAtCenter: !0 },
54
55
  placement: "bottom",
55
56
  menu: {
56
- items: l.map((e) => ({
57
+ items: c.map((e) => ({
57
58
  label: t(e),
58
59
  key: e.chainSymbol
59
60
  }))
60
61
  },
61
- children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(d, { value: "title", parentKey: "browser" }) })
62
+ children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(n, { value: "title", parentKey: "browser" }) })
62
63
  }
63
64
  ) }),
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
- ) }) })
65
+ /* @__PURE__ */ r("div", { className: "md:hidden w-full", children: m ? (
66
+ // Explorer 页面:点击展开列表,阻止外层 Link 跳转
67
+ /* @__PURE__ */ r("div", { onClick: (e) => {
68
+ e.preventDefault(), e.stopPropagation();
69
+ }, children: /* @__PURE__ */ r(
70
+ I,
71
+ {
72
+ type: "single",
73
+ collapsible: !0,
74
+ className: "w-full",
75
+ value: g,
76
+ onValueChange: s,
77
+ children: /* @__PURE__ */ a(P, { value: "explorer", className: "border-0", children: [
78
+ /* @__PURE__ */ r(S, { 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" }) }) }) }),
79
+ /* @__PURE__ */ r(j, { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: c.map((e) => /* @__PURE__ */ r("div", { className: "w-full", children: t(e) }, e.chainSymbol)) })
80
+ ] })
81
+ }
82
+ ) })
83
+ ) : (
84
+ // 非 explorer 页面:让外层 Link 正常跳转
85
+ /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(n, { value: "title", parentKey: "browser" }) })
86
+ ) })
80
87
  ] });
81
88
  }
82
89
  export {
83
- F as default
90
+ q as default
84
91
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/header",
3
- "version": "1.5.31",
3
+ "version": "1.5.33",
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.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"
35
+ "@ichaingo/image": "1.5.33",
36
+ "@ichaingo/auth": "1.5.33",
37
+ "@ichaingo/link": "1.5.33",
38
+ "@ichaingo/avatar": "1.5.33",
39
+ "@ichaingo/better-link": "1.5.33",
40
+ "@ichaingo/translation": "1.5.33",
41
+ "@ichaingo/request": "1.5.33",
42
+ "@ichaingo/theme-toggle": "1.5.33",
43
+ "@ichaingo/ui": "1.5.33",
44
+ "@ichaingo/iconfont": "1.5.33",
45
+ "@ichaingo/with-login": "1.5.33",
46
+ "@ichaingo/tooltip": "1.5.33",
47
+ "@ichaingo/token": "1.5.33"
48
48
  }
49
49
  }