@ichaingo/header 1.3.7 → 1.3.71

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/index.js +164 -176
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -1,138 +1,133 @@
1
1
  'use client';
2
- import { jsx as e, jsxs as s, Fragment as A } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as a, Fragment as k } from "react/jsx-runtime";
3
3
  import p from "@ichaingo/link";
4
- import { DropdownMenu as X, DropdownMenuTrigger as G, DropdownMenuContent as M, DropdownMenuGroup as K, DropdownMenuItem as F } from "@ichaingo/ui/dropdown-menu";
5
- import u from "@ichaingo/translation";
6
- import { useState as N, useMemo as W, useEffect as w, useCallback as U } from "react";
7
- import L from "@ichaingo/better-link";
8
- import { useLocale as y, useTranslations as E } from "next-intl";
9
- import { useTheme as f } from "next-themes";
10
- import _ from "@ichaingo/avatar";
11
- import { logout as q, fetchUserProfile as Q } from "@ichaingo/auth";
12
- import { twMerge as d } from "tailwind-merge";
13
- import { Accordion as P, AccordionItem as R, AccordionTrigger as j, AccordionContent as B } from "@ichaingo/ui/accordion";
14
- import S from "@ichaingo/image";
15
- import { Popover as V, PopoverTrigger as J, PopoverContent as Y } from "@ichaingo/ui/popover";
16
- import { PopoverArrow as Z } from "@radix-ui/react-popover";
17
- import { useSearchParams as I, usePathname as H } from "next/navigation";
18
- import ee from "@ichaingo/theme-toggle";
19
- import re from "rc-drawer";
20
- import { Menu as te, X as le } from "lucide-react";
21
- function ne({
4
+ import { DropdownMenu as z, DropdownMenuTrigger as O, DropdownMenuContent as X, DropdownMenuGroup as G, DropdownMenuItem as M } from "@ichaingo/ui/dropdown-menu";
5
+ import m from "@ichaingo/translation";
6
+ import { useState as v, useMemo as K, useEffect as x, useCallback as w } from "react";
7
+ import N from "@ichaingo/better-link";
8
+ import { useLocale as b, useTranslations as U } from "next-intl";
9
+ import y from "@ichaingo/avatar";
10
+ import { logout as $, fetchUserProfile as F } from "@ichaingo/auth";
11
+ import { twMerge as c } from "tailwind-merge";
12
+ import { Accordion as C, AccordionItem as A, AccordionTrigger as T, AccordionContent as P } from "@ichaingo/ui/accordion";
13
+ import R from "@ichaingo/image";
14
+ import { Popover as W, PopoverTrigger as q, PopoverContent as Q } from "@ichaingo/ui/popover";
15
+ import { PopoverArrow as V } from "@radix-ui/react-popover";
16
+ import { useSearchParams as J, usePathname as j } from "next/navigation";
17
+ import Y from "@ichaingo/theme-toggle";
18
+ import Z from "rc-drawer";
19
+ import { Menu as I, X as ee } from "lucide-react";
20
+ function re({
22
21
  userInfo: t
23
22
  }) {
24
- const { gotoLogin: r } = L(), [l, n] = N(""), a = y(), { resolvedTheme: o } = f(), i = W(() => t == null ? void 0 : t.id, [t]);
25
- return w(() => {
26
- n(r({
27
- locale: a,
28
- theme: o || "",
23
+ const { gotoLogin: r } = N(), [n, l] = v(""), i = b(), s = K(() => t == null ? void 0 : t.id, [t]);
24
+ return x(() => {
25
+ l(r({
26
+ locale: i,
29
27
  redirect: window.location.href
30
28
  }));
31
- }, [a, o, r]), i ? (
29
+ }, [i, r]), s ? (
32
30
  // userInfo?.profileUrl
33
31
  // https://images.ichaingo.com/user-profile/100000201.png
34
- /* @__PURE__ */ e(_, { userInfo: t, className: "w-8 h-8" })
32
+ /* @__PURE__ */ e(y, { userInfo: t, className: "w-8 h-8" })
35
33
  ) : /* @__PURE__ */ e(
36
34
  p,
37
35
  {
38
- href: l,
36
+ href: n,
39
37
  className: "cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
40
38
  replace: !0,
41
- children: /* @__PURE__ */ e(u, { value: "signIn", parentKey: "account" })
39
+ children: /* @__PURE__ */ e(m, { value: "signIn", parentKey: "account" })
42
40
  }
43
41
  );
44
42
  }
45
- function D({ className: t }) {
46
- const r = U(async () => {
47
- await q();
43
+ function B({ className: t }) {
44
+ const r = w(async () => {
45
+ await $();
48
46
  }, []);
49
47
  return /* @__PURE__ */ e(
50
48
  "button",
51
49
  {
52
50
  onClick: r,
53
- className: d("cursor-pointer relative", t),
54
- children: /* @__PURE__ */ e(u, { value: "logout", parentKey: "account" })
51
+ className: c("cursor-pointer relative", t),
52
+ children: /* @__PURE__ */ e(m, { value: "logout", parentKey: "account" })
55
53
  }
56
54
  );
57
55
  }
58
- function ae({
56
+ function te({
59
57
  list: t,
60
58
  userInfo: r,
61
- onClick: l
59
+ onClick: n
62
60
  }) {
63
- const { resolvedTheme: n } = f();
64
- return /* @__PURE__ */ s(X, { children: [
65
- /* @__PURE__ */ e(G, { className: "outline-none cursor-pointer", children: /* @__PURE__ */ e(ne, { userInfo: r }) }),
66
- /* @__PURE__ */ e(M, { align: "end", className: "z-2000 w-75 p-0 border-transparent outline-none border border-stroke", children: /* @__PURE__ */ s(K, { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
67
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-3 w-full bg-background rounded-lg p-2", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
68
- /* @__PURE__ */ e(_, { userInfo: r, className: "w-8 h-8" }),
69
- /* @__PURE__ */ s("div", { className: "flex flex-col overflow-hidden", children: [
61
+ return /* @__PURE__ */ a(z, { children: [
62
+ /* @__PURE__ */ e(O, { className: "outline-none cursor-pointer", children: /* @__PURE__ */ e(re, { userInfo: r }) }),
63
+ /* @__PURE__ */ e(X, { align: "end", className: "z-2000 w-75 p-0 border-transparent outline-none border border-stroke", children: /* @__PURE__ */ a(G, { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
64
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-3 w-full bg-background rounded-lg p-2", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
65
+ /* @__PURE__ */ e(y, { userInfo: r, className: "w-8 h-8" }),
66
+ /* @__PURE__ */ a("div", { className: "flex flex-col overflow-hidden", children: [
70
67
  /* @__PURE__ */ e("div", { className: "text-sm font-medium", children: (r == null ? void 0 : r.username) || "--" }),
71
68
  /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground w-full truncate", children: (r == null ? void 0 : r.email) || (r == null ? void 0 : r.walletAddress) })
72
69
  ] })
73
70
  ] }) }),
74
- t.map((a) => /* @__PURE__ */ e(F, { className: "px-0 py-0 focus-visible:border-none focus-visible:outline-none", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2 w-full", children: a.name === "logout" ? /* @__PURE__ */ e(D, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ e(p, { href: `/${a.href}?theme=${n}`, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, className: "flex-1 flex py-3 h-full w-full px-2 hover:bg-background rounded-lg ", onClick: l, children: /* @__PURE__ */ e(u, { value: a.name, parentKey: "account" }) }) }) }, a.name))
71
+ t.map((l) => /* @__PURE__ */ e(M, { className: "px-0 py-0 focus-visible:border-none focus-visible:outline-none", children: /* @__PURE__ */ e("div", { className: "flex items-center gap-2 w-full", children: l.name === "logout" ? /* @__PURE__ */ e(B, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ e(p, { href: `/${l.href}`, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, className: "flex-1 flex py-3 h-full w-full px-2 hover:bg-background rounded-lg ", onClick: n, children: /* @__PURE__ */ e(m, { value: l.name, parentKey: "account" }) }) }) }, l.name))
75
72
  ] }) })
76
73
  ] });
77
74
  }
78
- function se({
75
+ function le({
79
76
  list: t,
80
77
  userInfo: r,
81
- onClick: l
78
+ onClick: n
82
79
  }) {
83
- const { resolvedTheme: n } = f();
84
80
  return /* @__PURE__ */ e(
85
- P,
81
+ C,
86
82
  {
87
83
  type: "single",
88
84
  collapsible: !0,
89
85
  className: "w-full",
90
86
  defaultValue: "",
91
- children: /* @__PURE__ */ s(R, { value: "item-1", className: "p-0 w-full border border-none", children: [
92
- /* @__PURE__ */ e(j, { className: "w-full bg-background p-3 flex items-center justify-between", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-3 w-full overflow-hidden", children: /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
93
- /* @__PURE__ */ e(_, { userInfo: r, className: "w-8 h-8 shrink-0" }),
94
- /* @__PURE__ */ s("div", { className: "flex flex-col overflow-hidden", children: [
87
+ children: /* @__PURE__ */ a(A, { value: "item-1", className: "p-0 w-full border border-none", children: [
88
+ /* @__PURE__ */ e(T, { className: "w-full bg-background p-3 flex items-center justify-between", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-3 w-full overflow-hidden", children: /* @__PURE__ */ a("div", { className: "flex items-center gap-2", children: [
89
+ /* @__PURE__ */ e(y, { userInfo: r, className: "w-8 h-8 shrink-0" }),
90
+ /* @__PURE__ */ a("div", { className: "flex flex-col overflow-hidden", children: [
95
91
  /* @__PURE__ */ e("div", { className: "text-sm font-medium", children: r == null ? void 0 : r.username }),
96
92
  /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground w-full truncate", children: (r == null ? void 0 : r.email) || (r == null ? void 0 : r.walletAddress) })
97
93
  ] })
98
94
  ] }) }) }),
99
- /* @__PURE__ */ e(B, { className: "flex text-sm flex-col text-balance bg-background rounded-lg p-3 gap-3 mt-[10px]", children: /* @__PURE__ */ e("dl", { children: t.map((a) => /* @__PURE__ */ e(
95
+ /* @__PURE__ */ e(P, { className: "flex text-sm flex-col text-balance bg-background rounded-lg p-3 gap-3 mt-[10px]", children: /* @__PURE__ */ e("dl", { children: t.map((l) => /* @__PURE__ */ e(
100
96
  "dd",
101
97
  {
102
98
  className: "flex justify-start items-center gap-2 py-2",
103
- children: /* @__PURE__ */ e(p, { href: `/${a.href}?theme=${n}`, className: "flex-1 py-2", onClick: l, suppressHydrationWarning: !0, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, children: /* @__PURE__ */ e(u, { value: a.name, parentKey: "account" }) })
99
+ children: /* @__PURE__ */ e(p, { href: `/${l.href}`, className: "flex-1 py-2", onClick: n, suppressHydrationWarning: !0, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, children: /* @__PURE__ */ e(m, { value: l.name, parentKey: "account" }) })
104
100
  },
105
- a.name
101
+ l.name
106
102
  )) }) })
107
103
  ] })
108
104
  }
109
105
  );
110
106
  }
111
- function $({ onClick: t = () => {
107
+ function S({ onClick: t = () => {
112
108
  }, className: r }) {
113
- const l = y(), { resolvedTheme: n, theme: a } = f(), { gotoLogin: o } = L(), [i, m] = N("");
114
- return w(() => {
115
- m(o({
116
- locale: l,
117
- theme: n || a || "",
109
+ const n = b(), { gotoLogin: l } = N(), [i, s] = v("");
110
+ return x(() => {
111
+ s(l({
112
+ locale: n,
118
113
  redirect: window.location.href
119
114
  }));
120
- }, [l, n, a, o]), /* @__PURE__ */ e(
115
+ }, [n, l]), /* @__PURE__ */ e(
121
116
  p,
122
117
  {
123
118
  href: i,
124
119
  onClick: t,
125
120
  baseUrl: process.env.NEXT_PUBLIC_AUTH_URL,
126
121
  replace: !0,
127
- className: d(
122
+ className: c(
128
123
  "cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
129
124
  r
130
125
  ),
131
- children: /* @__PURE__ */ e(u, { value: "signIn", parentKey: "account" })
126
+ children: /* @__PURE__ */ e(m, { value: "signIn", parentKey: "account" })
132
127
  }
133
128
  );
134
129
  }
135
- const k = [
130
+ const L = [
136
131
  {
137
132
  name: "overview",
138
133
  href: "user-center"
@@ -154,159 +149,153 @@ const k = [
154
149
  href: void 0
155
150
  }
156
151
  ];
157
- function oe({ onClick: t = (n) => {
158
- }, className: r, userInfo: l }) {
159
- return l != null && l.id ? /* @__PURE__ */ s(A, { children: [
160
- /* @__PURE__ */ e("div", { className: d("hidden md:flex items-center", r), children: /* @__PURE__ */ e(ae, { list: k, userInfo: l, onClick: t }) }),
161
- /* @__PURE__ */ e("div", { className: d("block md:hidden w-full", r), children: /* @__PURE__ */ e(se, { list: k.filter((n) => n.href), userInfo: l, onClick: t }) })
162
- ] }) : /* @__PURE__ */ e($, { onClick: t, className: d(
152
+ function ne({ onClick: t = (l) => {
153
+ }, className: r, userInfo: n }) {
154
+ return n != null && n.id ? /* @__PURE__ */ a(k, { children: [
155
+ /* @__PURE__ */ e("div", { className: c("hidden md:flex items-center", r), children: /* @__PURE__ */ e(te, { list: L, userInfo: n, onClick: t }) }),
156
+ /* @__PURE__ */ e("div", { className: c("block md:hidden w-full", r), children: /* @__PURE__ */ e(le, { list: L.filter((l) => l.href), userInfo: n, onClick: t }) })
157
+ ] }) : /* @__PURE__ */ e(S, { onClick: t, className: c(
163
158
  "hidden md:flex cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
164
159
  "order-3"
165
160
  ) });
166
161
  }
167
- function T({ onClick: t = () => {
162
+ function _({ onClick: t = () => {
168
163
  } }) {
169
164
  var g;
170
- const r = y(), l = I(), n = E("lang"), a = E("setting"), o = [
171
- { name: n("en"), lang: "en" },
172
- { name: n("zh-hant"), lang: "zh-hant" },
173
- { name: n("zh-hans"), lang: "zh-hans" },
174
- { name: n("ja"), lang: "ja" },
175
- { name: n("ko"), lang: "ko" }
176
- ], i = H(), m = U(
177
- (c) => {
178
- const v = i.replace(new RegExp(`/${r}(/|$)`), `/${c}$1`), b = l.toString();
179
- return b ? `${v}?${b}` : v;
165
+ const r = b(), n = J(), l = U("lang"), i = U("setting"), s = [
166
+ { name: l("en"), lang: "en" },
167
+ { name: l("zh-hant"), lang: "zh-hant" },
168
+ { name: l("zh-hans"), lang: "zh-hans" },
169
+ { name: l("ja"), lang: "ja" },
170
+ { name: l("ko"), lang: "ko" }
171
+ ], f = j(), h = w(
172
+ (d) => {
173
+ const u = f.replace(new RegExp(`/${r}(/|$)`), `/${d}$1`), o = n.toString();
174
+ return o ? `${u}?${o}` : u;
180
175
  },
181
- [i, r, l]
176
+ [f, r, n]
182
177
  );
183
- return /* @__PURE__ */ s("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
184
- /* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(P, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ s(R, { value: r, className: "border-0", children: [
185
- /* @__PURE__ */ e(j, { className: "p-2 bg-background rounded-lg h-11 md:h-auto text-gray-500 w-full flex py-2 justify-between items-center hover:no-underline focus-visible:ring-0 focus-visible:ring-offset-0", children: /* @__PURE__ */ s("div", { className: "flex w-full justify-between items-center", children: [
186
- /* @__PURE__ */ e("span", { className: "text-title", children: a("language") }),
187
- /* @__PURE__ */ e("span", { className: "text-title", children: (g = o.find((c) => c.lang === r)) == null ? void 0 : g.name })
178
+ return /* @__PURE__ */ a("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
179
+ /* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(C, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ a(A, { value: r, className: "border-0", children: [
180
+ /* @__PURE__ */ e(T, { className: "p-2 bg-background rounded-lg h-11 md:h-auto text-gray-500 w-full flex py-2 justify-between items-center hover:no-underline focus-visible:ring-0 focus-visible:ring-offset-0", children: /* @__PURE__ */ a("div", { className: "flex w-full justify-between items-center", children: [
181
+ /* @__PURE__ */ e("span", { className: "text-title", children: i("language") }),
182
+ /* @__PURE__ */ e("span", { className: "text-title", children: (g = s.find((d) => d.lang === r)) == null ? void 0 : g.name })
188
183
  ] }) }),
189
- /* @__PURE__ */ e(B, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: o.map((c) => /* @__PURE__ */ e(
184
+ /* @__PURE__ */ e(P, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: s.map((d) => /* @__PURE__ */ e(
190
185
  p,
191
186
  {
192
187
  prefetch: !1,
193
188
  withLocale: !1,
194
- className: d(
189
+ className: c(
195
190
  "p-2 rounded-lg flex w-full justify-between items-center",
196
- r === c.lang ? "text-primary" : ""
191
+ r === d.lang ? "text-primary" : ""
197
192
  ),
198
- href: m(c.lang),
193
+ href: h(d.lang),
199
194
  onClick: t,
200
- children: c.name
195
+ children: d.name
201
196
  },
202
- c.lang
197
+ d.lang
203
198
  )) })
204
199
  ] }) }) }),
205
- /* @__PURE__ */ s("div", { className: "bg-background p-2 rounded-lg h-11 md:h-auto flex w-full justify-between items-center", children: [
206
- /* @__PURE__ */ e("div", { children: a("theme") }),
207
- /* @__PURE__ */ e(ee, {})
200
+ /* @__PURE__ */ a("div", { className: "bg-background p-2 rounded-lg h-11 md:h-auto flex w-full justify-between items-center", children: [
201
+ /* @__PURE__ */ e("div", { children: i("theme") }),
202
+ /* @__PURE__ */ e(Y, {})
208
203
  ] })
209
204
  ] });
210
205
  }
211
- function ie({ onClick: t = () => {
206
+ function ae({ onClick: t = () => {
212
207
  } }) {
213
- return /* @__PURE__ */ s("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
214
- /* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ s(V, { children: [
215
- /* @__PURE__ */ e(J, { asChild: !0, children: /* @__PURE__ */ e(S, { src: `${process.env.NEXT_PUBLIC_CDN_URL}/common/user/5c4a8103-f01c-488a-9d5e-7ef5e442353e.png`, width: 24, height: 24 }) }),
216
- /* @__PURE__ */ s(
217
- Y,
208
+ return /* @__PURE__ */ a("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
209
+ /* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ a(W, { children: [
210
+ /* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ e(R, { src: `${process.env.NEXT_PUBLIC_CDN_URL}/common/user/5c4a8103-f01c-488a-9d5e-7ef5e442353e.png`, width: 24, height: 24 }) }),
211
+ /* @__PURE__ */ a(
212
+ Q,
218
213
  {
219
214
  side: "bottom",
220
215
  className: "relative top-[10px] rounded-xl border border-stroke bg-module p-2 w-72 z-1000",
221
216
  children: [
222
- /* @__PURE__ */ e(Z, { className: "fill-module" }),
223
- /* @__PURE__ */ e(T, { onClick: t })
217
+ /* @__PURE__ */ e(V, { className: "fill-module" }),
218
+ /* @__PURE__ */ e(_, { onClick: t })
224
219
  ]
225
220
  }
226
221
  )
227
222
  ] }) }),
228
- /* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(T, {}) })
223
+ /* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(_, {}) })
229
224
  ] });
230
225
  }
231
- const C = {
226
+ const E = {
232
227
  PROFILE_UPDATED: "user-profile-updated",
233
228
  LOGGED_IN: "user-logged-in",
234
229
  LOGGED_OUT: "user-logged-out"
235
230
  };
236
- function je(t, r) {
237
- const l = new CustomEvent(t, { detail: r });
238
- window.dispatchEvent(l);
231
+ function Ae(t, r) {
232
+ const n = new CustomEvent(t, { detail: r });
233
+ window.dispatchEvent(n);
239
234
  }
240
- function ce(t, r) {
241
- const l = (n) => {
242
- r(n.detail);
235
+ function se(t, r) {
236
+ const n = (l) => {
237
+ r(l.detail);
243
238
  };
244
- return window.addEventListener(t, l), () => window.removeEventListener(t, l);
239
+ return window.addEventListener(t, n), () => window.removeEventListener(t, n);
245
240
  }
246
- function de(t, r) {
241
+ function ie(t, r) {
247
242
  window.removeEventListener(t, r);
248
243
  }
249
- function z({ onClick: t = () => {
250
- }, hideNews: r = !1, hideLogin: l = !1 }) {
251
- const { gotoAISQL: n, gotoChat: a } = L(), o = y(), { resolvedTheme: i, theme: m } = f(), g = H(), [c, v] = N(null), b = [
244
+ function H({ onClick: t = () => {
245
+ }, hideNews: r = !1, hideLogin: n = !1 }) {
246
+ const { gotoAISQL: l, gotoChat: i } = N(), s = b(), f = j(), [h, g] = v(null), d = [
252
247
  {
253
248
  baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
254
- href: `/explorer?theme=${i || m}`,
249
+ href: "/explorer",
255
250
  key: "/explorer",
256
- label: /* @__PURE__ */ e("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: /* @__PURE__ */ e(u, { value: "title", parentKey: "browser" }) })
251
+ label: /* @__PURE__ */ e("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: /* @__PURE__ */ e(m, { value: "title", parentKey: "browser" }) })
257
252
  },
258
253
  {
259
254
  baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
260
- href: a({
261
- theme: i || m,
262
- locale: o
263
- }),
255
+ href: i({ locale: s }),
264
256
  key: "/chat",
265
- label: /* @__PURE__ */ s("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
257
+ label: /* @__PURE__ */ a("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
266
258
  /* @__PURE__ */ e("span", { role: "img", "aria-label": "hot", children: "🔥" }),
267
259
  /* @__PURE__ */ e("span", { children: "iGoChat" })
268
260
  ] })
269
261
  },
270
262
  {
271
263
  baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
272
- href: n({
273
- theme: i || m,
274
- locale: o
275
- }),
264
+ href: l({ locale: s }),
276
265
  key: "/sql",
277
266
  label: "AISQL"
278
267
  },
279
268
  {
280
269
  baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
281
- href: `/etf/btc-us?theme=${i || m}`,
270
+ href: "/etf/btc-us",
282
271
  key: "/etf",
283
- label: /* @__PURE__ */ e(u, { value: "etf", parentKey: "menu" })
272
+ label: /* @__PURE__ */ e(m, { value: "etf", parentKey: "menu" })
284
273
  },
285
274
  {
286
275
  baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
287
- href: `/news?theme=${i || m}`,
276
+ href: "/news",
288
277
  key: "/news",
289
- label: /* @__PURE__ */ e(u, { value: "news", parentKey: "menu" })
278
+ label: /* @__PURE__ */ e(m, { value: "news", parentKey: "menu" })
290
279
  },
291
280
  {
292
281
  baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
293
- href: `/ranking/token?theme=${i || m}`,
282
+ href: "/ranking/token",
294
283
  key: "/ranking",
295
- label: /* @__PURE__ */ e(u, { value: "ranking", parentKey: "menu" })
284
+ label: /* @__PURE__ */ e(m, { value: "ranking", parentKey: "menu" })
296
285
  }
297
- ].filter((h) => r ? !["/explorer", "/chat", "/sql"].includes(h.key) : !0), x = U(() => {
298
- Q().then((h) => {
299
- v(h);
286
+ ].filter((o) => r ? !["/explorer", "/chat", "/sql"].includes(o.key) : !0), u = w(() => {
287
+ F().then((o) => {
288
+ g(o);
300
289
  });
301
290
  }, []);
302
- return w(() => {
303
- x();
304
- }, [x]), w(() => (ce(C.PROFILE_UPDATED, x), () => {
305
- de(C.PROFILE_UPDATED, x);
306
- }), [x]), /* @__PURE__ */ s(
291
+ return x(() => {
292
+ u();
293
+ }, [u]), x(() => (se(E.PROFILE_UPDATED, u), () => {
294
+ ie(E.PROFILE_UPDATED, u);
295
+ }), [u]), /* @__PURE__ */ a(
307
296
  "nav",
308
297
  {
309
- className: d(
298
+ className: c(
310
299
  "flex flex-col justify-start items-start md:px-3",
311
300
  "md:flex-row md:justify-end md:items-start md:px-0",
312
301
  "md:gap-6"
@@ -315,47 +304,46 @@ function z({ onClick: t = () => {
315
304
  /* @__PURE__ */ e(
316
305
  "ul",
317
306
  {
318
- className: d(
307
+ className: c(
319
308
  "flex flex-col justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-title",
320
309
  "md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
321
310
  "order-2 md:order-0"
322
311
  ),
323
- children: b.map((h, O) => /* @__PURE__ */ e("li", { className: d("w-full md:w-auto h-11 md:h-auto cursor-pointer", g.includes(h.key) && "border-b-2 border-primary text-primary "), children: /* @__PURE__ */ e(p, { href: h.href, onClick: t, className: "h-full flex items-center justify-start", baseUrl: h.baseUrl, suppressHydrationWarning: !0, children: h.label }) }, O))
312
+ children: d.map((o, D) => /* @__PURE__ */ e("li", { className: c("w-full md:w-auto h-11 md:h-auto cursor-pointer", f.includes(o.key) && "border-b-2 border-primary text-primary "), children: /* @__PURE__ */ e(p, { href: o.href, onClick: t, className: "h-full flex items-center justify-start", baseUrl: o.baseUrl, suppressHydrationWarning: !0, children: o.label }) }, D))
324
313
  }
325
314
  ),
326
- /* @__PURE__ */ e(ie, { onClick: t }),
327
- !g.includes("/login") && !l ? /* @__PURE__ */ s(A, { children: [
328
- /* @__PURE__ */ e(oe, { onClick: t, userInfo: c }),
329
- c != null && c.id ? /* @__PURE__ */ e("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__ */ e(D, {}) }) : /* @__PURE__ */ e($, { onClick: t, className: "flex md:hidden h-11 cursor-pointer whitespace-nowrap order-3 bg-primary text-[#fff] rounded-lg p-2 mt-3 w-full items-center justify-center" })
315
+ /* @__PURE__ */ e(ae, { onClick: t }),
316
+ !f.includes("/login") && !n ? /* @__PURE__ */ a(k, { children: [
317
+ /* @__PURE__ */ e(ne, { onClick: t, userInfo: h }),
318
+ h != null && h.id ? /* @__PURE__ */ e("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__ */ e(B, {}) }) : /* @__PURE__ */ e(S, { onClick: t, className: "flex md:hidden h-11 cursor-pointer whitespace-nowrap order-3 bg-primary text-[#fff] rounded-lg p-2 mt-3 w-full items-center justify-center" })
330
319
  ] }) : null
331
320
  ]
332
321
  }
333
322
  );
334
323
  }
335
- function me({ hideLogin: t, hideNews: r }) {
336
- const [l, n] = N(!1);
337
- if (!l)
338
- return /* @__PURE__ */ e(te, { onClick: () => n(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden ml-2.5 bg-module rounded-lg p-[4px] " });
339
- const a = (o) => {
340
- o == null || o.preventDefault(), o == null || o.stopPropagation(), n(!1);
324
+ function oe({ hideLogin: t, hideNews: r }) {
325
+ const [n, l] = v(!1);
326
+ if (!n)
327
+ return /* @__PURE__ */ e(I, { onClick: () => l(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden ml-2.5 bg-module rounded-lg p-[4px] " });
328
+ const i = (s) => {
329
+ s == null || s.preventDefault(), s == null || s.stopPropagation(), l(!1);
341
330
  };
342
- return /* @__PURE__ */ e(re, { open: l, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background p-2", children: /* @__PURE__ */ s("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
343
- /* @__PURE__ */ e("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ e(le, { size: 24, style: { color: "var(--title)" }, onClick: (o) => a(o) }) }),
344
- /* @__PURE__ */ e(z, { onClick: (o) => a(o), hideLogin: t, hideNews: r })
331
+ return /* @__PURE__ */ e(Z, { open: n, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background p-2", children: /* @__PURE__ */ a("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
332
+ /* @__PURE__ */ e("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ e(ee, { size: 24, style: { color: "var(--title)" }, onClick: (s) => i(s) }) }),
333
+ /* @__PURE__ */ e(H, { onClick: (s) => i(s), hideLogin: t, hideNews: r })
345
334
  ] }) });
346
335
  }
347
- function ue({ hideNews: t, hideLogin: r }) {
348
- return /* @__PURE__ */ s("div", { className: "flex justify-end items-center md:gap-10 z-1001 ", children: [
349
- /* @__PURE__ */ e(me, { hideLogin: r, hideNews: t }),
350
- /* @__PURE__ */ e("div", { className: "hidden md:block", children: /* @__PURE__ */ e(z, { hideNews: t, hideLogin: r }) })
336
+ function ce({ hideNews: t, hideLogin: r }) {
337
+ return /* @__PURE__ */ a("div", { className: "flex justify-end items-center md:gap-10 z-1001 ", children: [
338
+ /* @__PURE__ */ e(oe, { hideLogin: r, hideNews: t }),
339
+ /* @__PURE__ */ e("div", { className: "hidden md:block", children: /* @__PURE__ */ e(H, { hideNews: t, hideLogin: r }) })
351
340
  ] });
352
341
  }
353
- function he() {
354
- const { resolvedTheme: t, theme: r } = f();
355
- return /* @__PURE__ */ e(p, { suppressHydrationWarning: !0, href: `/?theme=${t || r}`, baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL, className: d(
342
+ function de() {
343
+ return /* @__PURE__ */ e(p, { suppressHydrationWarning: !0, href: "/", baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL, className: c(
356
344
  "w-auto shrink-0 block"
357
345
  ), children: /* @__PURE__ */ e(
358
- S,
346
+ R,
359
347
  {
360
348
  src: "https://cdn.ichaingo.com/uploads/logo_20250526_9aa337bef7.png",
361
349
  width: 116,
@@ -366,21 +354,21 @@ function he() {
366
354
  }
367
355
  ) });
368
356
  }
369
- function Be({ extra: t, children: r, className: l, hideNews: n, hideLogin: a }) {
370
- return /* @__PURE__ */ s("div", { className: d("sticky left-0 right-0 top-0 bg-background h-16 z-999", l), children: [
371
- /* @__PURE__ */ s("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
372
- /* @__PURE__ */ s("div", { className: "flex items-center flex-1 gap-6", children: [
373
- /* @__PURE__ */ e(he, {}),
357
+ function Te({ extra: t, children: r, className: n, hideNews: l, hideLogin: i }) {
358
+ return /* @__PURE__ */ a("div", { className: c("sticky left-0 right-0 top-0 bg-background h-16 z-999", n), children: [
359
+ /* @__PURE__ */ a("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
360
+ /* @__PURE__ */ a("div", { className: "flex items-center flex-1 gap-6", children: [
361
+ /* @__PURE__ */ e(de, {}),
374
362
  r
375
363
  ] }),
376
- /* @__PURE__ */ e(ue, { hideNews: n, hideLogin: a })
364
+ /* @__PURE__ */ e(ce, { hideNews: l, hideLogin: i })
377
365
  ] }),
378
366
  t
379
367
  ] });
380
368
  }
381
369
  export {
382
- C as USER_EVENTS,
383
- Be as default,
384
- je as emitUserEvent,
385
- ce as onUserEvent
370
+ E as USER_EVENTS,
371
+ Te as default,
372
+ Ae as emitUserEvent,
373
+ se as onUserEvent
386
374
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/header",
3
- "version": "1.3.7",
3
+ "version": "1.3.71",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -22,23 +22,23 @@
22
22
  "js-cookie": "^3.0.5",
23
23
  "lucide-react": "^0.539.0",
24
24
  "next-intl": "^4.3.4",
25
- "next-themes": "^0.4.4",
25
+ "@ichaingo/next-themes": "^0.4.11",
26
26
  "rc-drawer": "^1.0.1",
27
27
  "react": "^19.1.0",
28
28
  "react-dom": "^19.1.0",
29
29
  "rollup-plugin-preserve-use-client": "^1.0.0",
30
30
  "tailwind-merge": "^2.5.5",
31
31
  "next": "15.1.6",
32
- "@ichaingo/auth": "1.3.7",
33
- "@ichaingo/link": "1.3.7",
34
- "@ichaingo/translation": "1.3.7",
35
- "@ichaingo/ui": "1.3.7",
36
- "@ichaingo/i18n": "1.3.7",
37
- "@ichaingo/providers": "1.3.7",
38
- "@ichaingo/image": "1.3.7",
39
- "@ichaingo/avatar": "1.3.7",
40
- "@ichaingo/better-link": "1.3.7",
41
- "@ichaingo/theme-toggle": "1.3.7"
32
+ "@ichaingo/auth": "1.3.71",
33
+ "@ichaingo/image": "1.3.71",
34
+ "@ichaingo/translation": "1.3.71",
35
+ "@ichaingo/link": "1.3.71",
36
+ "@ichaingo/ui": "1.3.71",
37
+ "@ichaingo/better-link": "1.3.71",
38
+ "@ichaingo/theme-toggle": "1.3.71",
39
+ "@ichaingo/i18n": "1.3.71",
40
+ "@ichaingo/avatar": "1.3.71",
41
+ "@ichaingo/providers": "1.3.71"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/js-cookie": "^3.0.6"