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