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