@ichaingo/header 1.3.82 → 1.3.83

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,5 +1,5 @@
1
1
  'use client';
2
- import { jsx as e, jsxs as a, Fragment as C } from "react/jsx-runtime";
2
+ import { jsx as e, jsxs as n, Fragment as C } from "react/jsx-runtime";
3
3
  import h from "@ichaingo/link";
4
4
  import { DropdownMenu as z, DropdownMenuTrigger as M, DropdownMenuContent as X, DropdownMenuGroup as K, DropdownMenuItem as $ } from "@ichaingo/ui/dropdown-menu";
5
5
  import d from "@ichaingo/translation";
@@ -15,13 +15,13 @@ import { Popover as Q, PopoverTrigger as V, PopoverContent as W } from "@ichaing
15
15
  import { PopoverArrow as J } from "@radix-ui/react-popover";
16
16
  import { useSearchParams as Y, usePathname as R } from "next/navigation";
17
17
  import Z from "@ichaingo/theme-toggle";
18
- import { o as I, c as ee, U as L } from "./index-6LC2FFG_.js";
18
+ import { o as I, c as ee, U as L } from "./index-Y29nbZMy.js";
19
19
  import le from "rc-drawer";
20
20
  import { Menu as re, X as te } from "lucide-react";
21
- function ne({
21
+ function ae({
22
22
  userInfo: r
23
23
  }) {
24
- const { gotoLogin: l } = y(), [n, t] = b(""), i = v(), o = O(() => r == null ? void 0 : r.id, [r]);
24
+ const { gotoLogin: l } = y(), [a, t] = b(""), i = v(), o = O(() => r == null ? void 0 : r.id, [r]);
25
25
  return w(() => {
26
26
  t(l({
27
27
  locale: i,
@@ -34,7 +34,7 @@ function ne({
34
34
  ) : /* @__PURE__ */ e(
35
35
  h,
36
36
  {
37
- href: n,
37
+ href: a,
38
38
  className: "cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
39
39
  replace: !0,
40
40
  children: /* @__PURE__ */ e(d, { value: "signIn", parentKey: "account" })
@@ -54,29 +54,29 @@ function S({ className: r }) {
54
54
  }
55
55
  );
56
56
  }
57
- function ae({
57
+ function ne({
58
58
  list: r,
59
59
  userInfo: l,
60
- onClick: n
60
+ onClick: a
61
61
  }) {
62
- return /* @__PURE__ */ a(z, { children: [
63
- /* @__PURE__ */ e(M, { className: "outline-none cursor-pointer", children: /* @__PURE__ */ e(ne, { userInfo: l }) }),
64
- /* @__PURE__ */ e(X, { align: "end", className: "z-2000 w-75 p-0 border-transparent outline-none border border-stroke", children: /* @__PURE__ */ a(K, { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
65
- /* @__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: [
62
+ return /* @__PURE__ */ n(z, { children: [
63
+ /* @__PURE__ */ e(M, { className: "outline-none cursor-pointer", children: /* @__PURE__ */ e(ae, { userInfo: l }) }),
64
+ /* @__PURE__ */ e(X, { align: "end", className: "z-2000 w-75 p-0 border-transparent outline-none border border-stroke", children: /* @__PURE__ */ n(K, { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
65
+ /* @__PURE__ */ e("div", { className: "flex flex-col gap-3 w-full bg-background rounded-lg p-2", children: /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
66
66
  /* @__PURE__ */ e(U, { userInfo: l, className: "w-8 h-8" }),
67
- /* @__PURE__ */ a("div", { className: "flex flex-col overflow-hidden", children: [
67
+ /* @__PURE__ */ n("div", { className: "flex flex-col overflow-hidden", children: [
68
68
  /* @__PURE__ */ e("div", { className: "text-sm font-medium", children: (l == null ? void 0 : l.username) || "--" }),
69
69
  /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground w-full truncate", children: (l == null ? void 0 : l.email) || (l == null ? void 0 : l.walletAddress) })
70
70
  ] })
71
71
  ] }) }),
72
- r.map((t) => /* @__PURE__ */ e($, { 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: t.name === "logout" ? /* @__PURE__ */ e(S, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ e(h, { href: `/${t.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(d, { value: t.name, parentKey: "account" }) }) }) }, t.name))
72
+ r.map((t) => /* @__PURE__ */ e($, { 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: t.name === "logout" ? /* @__PURE__ */ e(S, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ e(h, { href: `/${t.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: a, children: /* @__PURE__ */ e(d, { value: t.name, parentKey: "account" }) }) }) }, t.name))
73
73
  ] }) })
74
74
  ] });
75
75
  }
76
76
  function se({
77
77
  list: r,
78
78
  userInfo: l,
79
- onClick: n
79
+ onClick: a
80
80
  }) {
81
81
  return /* @__PURE__ */ e(
82
82
  E,
@@ -85,10 +85,10 @@ function se({
85
85
  collapsible: !0,
86
86
  className: "w-full",
87
87
  defaultValue: "",
88
- children: /* @__PURE__ */ a(T, { value: "item-1", className: "p-0 w-full border border-none", children: [
89
- /* @__PURE__ */ e(P, { 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: [
88
+ children: /* @__PURE__ */ n(T, { value: "item-1", className: "p-0 w-full border border-none", children: [
89
+ /* @__PURE__ */ e(P, { 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__ */ n("div", { className: "flex items-center gap-2", children: [
90
90
  /* @__PURE__ */ e(U, { userInfo: l, className: "w-8 h-8 shrink-0" }),
91
- /* @__PURE__ */ a("div", { className: "flex flex-col overflow-hidden", children: [
91
+ /* @__PURE__ */ n("div", { className: "flex flex-col overflow-hidden", children: [
92
92
  /* @__PURE__ */ e("div", { className: "text-sm font-medium", children: l == null ? void 0 : l.username }),
93
93
  /* @__PURE__ */ e("div", { className: "text-xs text-muted-foreground w-full truncate", children: (l == null ? void 0 : l.email) || (l == null ? void 0 : l.walletAddress) })
94
94
  ] })
@@ -97,7 +97,7 @@ function se({
97
97
  "dd",
98
98
  {
99
99
  className: "flex justify-start items-center gap-2 py-2",
100
- children: /* @__PURE__ */ e(h, { href: `/${t.href}`, className: "flex-1 py-2", onClick: n, suppressHydrationWarning: !0, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, children: /* @__PURE__ */ e(d, { value: t.name, parentKey: "account" }) })
100
+ children: /* @__PURE__ */ e(h, { href: `/${t.href}`, className: "flex-1 py-2", onClick: a, suppressHydrationWarning: !0, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, children: /* @__PURE__ */ e(d, { value: t.name, parentKey: "account" }) })
101
101
  },
102
102
  t.name
103
103
  )) }) })
@@ -107,13 +107,13 @@ function se({
107
107
  }
108
108
  function B({ onClick: r = () => {
109
109
  }, className: l }) {
110
- const n = v(), { gotoLogin: t } = y(), [i, o] = b("");
110
+ const a = v(), { gotoLogin: t } = y(), [i, o] = b("");
111
111
  return w(() => {
112
112
  o(t({
113
- locale: n,
113
+ locale: a,
114
114
  redirect: window.location.href
115
115
  }));
116
- }, [n, t]), /* @__PURE__ */ e(
116
+ }, [a, t]), /* @__PURE__ */ e(
117
117
  h,
118
118
  {
119
119
  href: i,
@@ -151,10 +151,10 @@ const _ = [
151
151
  }
152
152
  ];
153
153
  function ie({ onClick: r = (t) => {
154
- }, className: l, userInfo: n }) {
155
- return console.log("userInfo", n), n != null && n.id ? /* @__PURE__ */ a(C, { children: [
156
- /* @__PURE__ */ e("div", { className: m("hidden md:flex items-center", l), children: /* @__PURE__ */ e(ae, { list: _, userInfo: n, onClick: r }) }),
157
- /* @__PURE__ */ e("div", { className: m("block md:hidden w-full", l), children: /* @__PURE__ */ e(se, { list: _.filter((t) => t.href), userInfo: n, onClick: r }) })
154
+ }, className: l, userInfo: a }) {
155
+ return a != null && a.id ? /* @__PURE__ */ n(C, { children: [
156
+ /* @__PURE__ */ e("div", { className: m("hidden md:flex items-center", l), children: /* @__PURE__ */ e(ne, { list: _, userInfo: a, onClick: r }) }),
157
+ /* @__PURE__ */ e("div", { className: m("block md:hidden w-full", l), children: /* @__PURE__ */ e(se, { list: _.filter((t) => t.href), userInfo: a, onClick: r }) })
158
158
  ] }) : /* @__PURE__ */ e(B, { onClick: r, className: m(
159
159
  "hidden md:flex cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
160
160
  "order-3"
@@ -163,7 +163,7 @@ function ie({ onClick: r = (t) => {
163
163
  function A({ onClick: r = () => {
164
164
  } }) {
165
165
  var u;
166
- const l = v(), n = Y(), t = k("lang"), i = k("setting"), o = [
166
+ const l = v(), a = Y(), t = k("lang"), i = k("setting"), o = [
167
167
  { name: t("en"), lang: "en" },
168
168
  { name: t("zh-hant"), lang: "zh-hant" },
169
169
  { name: t("zh-hans"), lang: "zh-hans" },
@@ -171,14 +171,14 @@ function A({ onClick: r = () => {
171
171
  { name: t("ko"), lang: "ko" }
172
172
  ], s = R(), g = N(
173
173
  (c) => {
174
- const x = s.replace(new RegExp(`/${l}(/|$)`), `/${c}$1`), f = n.toString();
174
+ const x = s.replace(new RegExp(`/${l}(/|$)`), `/${c}$1`), f = a.toString();
175
175
  return f ? `${x}?${f}` : x;
176
176
  },
177
- [s, l, n]
177
+ [s, l, a]
178
178
  );
179
- return /* @__PURE__ */ a("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
180
- /* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(E, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ a(T, { value: l, className: "border-0", children: [
181
- /* @__PURE__ */ e(P, { 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: [
179
+ return /* @__PURE__ */ n("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
180
+ /* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(E, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ n(T, { value: l, className: "border-0", children: [
181
+ /* @__PURE__ */ e(P, { 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__ */ n("div", { className: "flex w-full justify-between items-center", children: [
182
182
  /* @__PURE__ */ e("span", { className: "text-title", children: i("language") }),
183
183
  /* @__PURE__ */ e("span", { className: "text-title", children: (u = o.find((c) => c.lang === l)) == null ? void 0 : u.name })
184
184
  ] }) }),
@@ -198,7 +198,7 @@ function A({ onClick: r = () => {
198
198
  c.lang
199
199
  )) })
200
200
  ] }) }) }),
201
- /* @__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__ */ n("div", { className: "bg-background p-2 rounded-lg h-11 md:h-auto flex w-full justify-between items-center", children: [
202
202
  /* @__PURE__ */ e("div", { children: i("theme") }),
203
203
  /* @__PURE__ */ e(Z, {})
204
204
  ] })
@@ -206,10 +206,10 @@ function A({ onClick: r = () => {
206
206
  }
207
207
  function oe({ onClick: r = () => {
208
208
  } }) {
209
- return /* @__PURE__ */ a("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
210
- /* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ a(Q, { children: [
209
+ return /* @__PURE__ */ n("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
210
+ /* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ n(Q, { children: [
211
211
  /* @__PURE__ */ e(V, { asChild: !0, children: /* @__PURE__ */ e(q, { type: "icon-setting", className: "text-2xl" }) }),
212
- /* @__PURE__ */ a(
212
+ /* @__PURE__ */ n(
213
213
  W,
214
214
  {
215
215
  side: "bottom",
@@ -225,7 +225,7 @@ function oe({ onClick: r = () => {
225
225
  ] });
226
226
  }
227
227
  function H({ onClick: r = () => {
228
- }, hideNews: l = !1, hideLogin: n = !1, user: t }) {
228
+ }, hideNews: l = !1, hideLogin: a = !1, user: t }) {
229
229
  const { gotoAISQL: i, gotoChat: o } = y(), s = v(), g = R(), [u, c] = b(t), x = [
230
230
  {
231
231
  baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
@@ -237,7 +237,7 @@ function H({ onClick: r = () => {
237
237
  baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
238
238
  href: o({ locale: s }),
239
239
  key: "/chat",
240
- label: /* @__PURE__ */ a("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
240
+ label: /* @__PURE__ */ n("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
241
241
  /* @__PURE__ */ e("span", { role: "img", "aria-label": "hot", children: "🔥" }),
242
242
  /* @__PURE__ */ e("span", { children: "iGoChat" })
243
243
  ] })
@@ -273,7 +273,7 @@ function H({ onClick: r = () => {
273
273
  }, []);
274
274
  return w(() => (I(L.PROFILE_UPDATED, f), () => {
275
275
  ee(L.PROFILE_UPDATED, f);
276
- }), []), /* @__PURE__ */ a(
276
+ }), []), /* @__PURE__ */ n(
277
277
  "nav",
278
278
  {
279
279
  className: m(
@@ -294,7 +294,7 @@ function H({ onClick: r = () => {
294
294
  }
295
295
  ),
296
296
  /* @__PURE__ */ e(oe, { onClick: r }),
297
- !g.includes("/login") && !n ? /* @__PURE__ */ a(C, { children: [
297
+ !g.includes("/login") && !a ? /* @__PURE__ */ n(C, { children: [
298
298
  /* @__PURE__ */ e(ie, { onClick: r, userInfo: u }),
299
299
  u != null && u.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(S, {}) }) : /* @__PURE__ */ e(B, { onClick: r, 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" })
300
300
  ] }) : null
@@ -302,22 +302,22 @@ function H({ onClick: r = () => {
302
302
  }
303
303
  );
304
304
  }
305
- function ce({ hideLogin: r, hideNews: l, user: n }) {
305
+ function ce({ hideLogin: r, hideNews: l, user: a }) {
306
306
  const [t, i] = b(!1);
307
307
  if (!t)
308
308
  return /* @__PURE__ */ e(re, { onClick: () => i(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden ml-2.5 bg-module rounded-lg p-[4px] " });
309
309
  const o = (s) => {
310
310
  s == null || s.preventDefault(), s == null || s.stopPropagation(), i(!1);
311
311
  };
312
- return /* @__PURE__ */ e(le, { open: t, 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: [
312
+ return /* @__PURE__ */ e(le, { open: t, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background p-2", children: /* @__PURE__ */ n("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
313
313
  /* @__PURE__ */ e("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ e(te, { size: 24, style: { color: "var(--title)" }, onClick: (s) => o(s) }) }),
314
- /* @__PURE__ */ e(H, { onClick: (s) => o(s), hideLogin: r, hideNews: l, user: n })
314
+ /* @__PURE__ */ e(H, { onClick: (s) => o(s), hideLogin: r, hideNews: l, user: a })
315
315
  ] }) });
316
316
  }
317
- function Ee({ hideNews: r, hideLogin: l, user: n }) {
318
- return /* @__PURE__ */ a("div", { className: "flex justify-end items-center md:gap-10 z-1001 ", children: [
319
- /* @__PURE__ */ e(ce, { hideLogin: l, hideNews: r, user: n }),
320
- /* @__PURE__ */ e("div", { className: "hidden md:block", children: /* @__PURE__ */ e(H, { hideNews: r, hideLogin: l, user: n }) })
317
+ function Ee({ hideNews: r, hideLogin: l, user: a }) {
318
+ return /* @__PURE__ */ n("div", { className: "flex justify-end items-center md:gap-10 z-1001 ", children: [
319
+ /* @__PURE__ */ e(ce, { hideLogin: l, hideNews: r, user: a }),
320
+ /* @__PURE__ */ e("div", { className: "hidden md:block", children: /* @__PURE__ */ e(H, { hideNews: r, hideLogin: l, user: a }) })
321
321
  ] });
322
322
  }
323
323
  export {
@@ -20,7 +20,7 @@ function h(e, t) {
20
20
  function U(e, t) {
21
21
  window.removeEventListener(e, t);
22
22
  }
23
- const m = c(() => import("./Right-Bp1kiuv-.js"), { ssr: !1 }), u = c(() => import("./Logo-BwpYr4IY.js"), { ssr: !1 });
23
+ const m = c(() => import("./Right-DMWuFMki.js"), { ssr: !1 }), u = c(() => import("./Logo-BwpYr4IY.js"), { ssr: !1 });
24
24
  async function x({ extra: e, children: t, className: s, hideNews: r, hideLogin: i }) {
25
25
  let n = {
26
26
  data: {}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "tailwind-merge";
3
3
  import "@ichaingo/request";
4
4
  import "next/dynamic";
5
- import { U as a, H as i, e as p, o as E } from "./index-6LC2FFG_.js";
5
+ import { U as a, H as i, e as p, o as E } from "./index-Y29nbZMy.js";
6
6
  export {
7
7
  a as USER_EVENTS,
8
8
  i as default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/header",
3
- "version": "1.3.82",
3
+ "version": "1.3.83",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -29,18 +29,18 @@
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/avatar": "1.3.82",
33
- "@ichaingo/auth": "1.3.82",
34
- "@ichaingo/better-link": "1.3.82",
35
- "@ichaingo/image": "1.3.82",
36
- "@ichaingo/link": "1.3.82",
37
- "@ichaingo/translation": "1.3.82",
38
- "@ichaingo/theme-toggle": "1.3.82",
39
- "@ichaingo/i18n": "1.3.82",
40
- "@ichaingo/request": "1.3.82",
41
- "@ichaingo/ui": "1.3.82",
42
- "@ichaingo/iconfont": "1.3.82",
43
- "@ichaingo/providers": "1.3.82"
32
+ "@ichaingo/auth": "1.3.83",
33
+ "@ichaingo/avatar": "1.3.83",
34
+ "@ichaingo/image": "1.3.83",
35
+ "@ichaingo/link": "1.3.83",
36
+ "@ichaingo/better-link": "1.3.83",
37
+ "@ichaingo/translation": "1.3.83",
38
+ "@ichaingo/ui": "1.3.83",
39
+ "@ichaingo/i18n": "1.3.83",
40
+ "@ichaingo/theme-toggle": "1.3.83",
41
+ "@ichaingo/request": "1.3.83",
42
+ "@ichaingo/iconfont": "1.3.83",
43
+ "@ichaingo/providers": "1.3.83"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/js-cookie": "^3.0.6"