@ichaingo/header 1.3.89 → 1.3.90
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.js +40 -9
- package/dist/lib/Drawer.js +21 -0
- package/dist/lib/Nav.js +96 -0
- package/dist/lib/Right.js +12 -0
- package/dist/lib/Setting/SettingBody.js +56 -0
- package/dist/lib/Setting/index.js +28 -0
- package/dist/lib/User/Logout.js +22 -0
- package/dist/lib/User/MainTrigger.js +34 -0
- package/dist/lib/User/Mobile.js +41 -0
- package/dist/lib/User/Pc.js +30 -0
- package/dist/lib/User/SignIn.js +33 -0
- package/dist/lib/User/index.js +41 -0
- package/dist/lib/events.js +24 -0
- package/package.json +13 -13
- package/dist/Right-Duk1k2Xj.js +0 -325
- package/dist/index-CeUO6r-I.js +0 -2095
- /package/dist/{Logo-BxSWGm8n.js → lib/Logo.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "tailwind-merge";
|
|
3
|
-
import "@ichaingo/request";
|
|
4
|
-
import {
|
|
5
|
-
import "
|
|
1
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge as p } from "tailwind-merge";
|
|
3
|
+
import d from "@ichaingo/request";
|
|
4
|
+
import { cookies as l } from "next/headers";
|
|
5
|
+
import x from "./lib/Right.js";
|
|
6
|
+
import h from "./lib/Logo.js";
|
|
7
|
+
import { USER_EVENTS as R, emitUserEvent as S, onUserEvent as T } from "./lib/events.js";
|
|
8
|
+
async function _({ extra: i, children: s, className: c, hideNews: n, hideLogin: m }) {
|
|
9
|
+
var r;
|
|
10
|
+
let e = {
|
|
11
|
+
data: {}
|
|
12
|
+
};
|
|
13
|
+
try {
|
|
14
|
+
const o = (r = (await l()).get("refresh_token")) == null ? void 0 : r.value;
|
|
15
|
+
if (typeof o < "u" && o !== "")
|
|
16
|
+
try {
|
|
17
|
+
e = await d.get("/v2/users/profile", {
|
|
18
|
+
baseURL: process.env.ICHAINGO_AUTH_INNER_API_URL
|
|
19
|
+
});
|
|
20
|
+
} catch (f) {
|
|
21
|
+
console.error(f), e = { data: {} };
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
e = { data: {} };
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ t("div", { className: p("sticky left-0 right-0 top-0 bg-background h-16 z-999", c), children: [
|
|
27
|
+
/* @__PURE__ */ t("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
|
|
28
|
+
/* @__PURE__ */ t("div", { className: "flex items-center flex-1 gap-6", children: [
|
|
29
|
+
/* @__PURE__ */ a(h, {}),
|
|
30
|
+
s
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ a(x, { hideNews: n, hideLogin: m, user: (e == null ? void 0 : e.data) || {} })
|
|
33
|
+
] }),
|
|
34
|
+
i
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
6
37
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
38
|
+
R as USER_EVENTS,
|
|
39
|
+
_ as default,
|
|
40
|
+
S as emitUserEvent,
|
|
41
|
+
T as onUserEvent
|
|
11
42
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
+
import m from "rc-drawer";
|
|
4
|
+
import { Menu as d, X as c } from "lucide-react";
|
|
5
|
+
import f from "./Nav.js";
|
|
6
|
+
import { useState as p } from "react";
|
|
7
|
+
function b({ hideLogin: i, hideNews: a, user: n }) {
|
|
8
|
+
const [t, l] = p(!1);
|
|
9
|
+
if (!t)
|
|
10
|
+
return /* @__PURE__ */ o(d, { onClick: () => l(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden ml-2.5 bg-module rounded-lg p-[4px] " });
|
|
11
|
+
const r = (e) => {
|
|
12
|
+
e == null || e.preventDefault(), e == null || e.stopPropagation(), l(!1);
|
|
13
|
+
};
|
|
14
|
+
return /* @__PURE__ */ o(m, { 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__ */ s("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(c, { size: 24, style: { color: "var(--title)" }, onClick: (e) => r(e) }) }),
|
|
16
|
+
/* @__PURE__ */ o(f, { onClick: (e) => r(e), hideLogin: i, hideNews: a, user: n })
|
|
17
|
+
] }) });
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
b as default
|
|
21
|
+
};
|
package/dist/lib/Nav.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as e, jsxs as n, Fragment as y } from "react/jsx-runtime";
|
|
3
|
+
import E from "@ichaingo/link";
|
|
4
|
+
import L from "./User/index.js";
|
|
5
|
+
import N from "./Setting/index.js";
|
|
6
|
+
import l from "@ichaingo/translation";
|
|
7
|
+
import { twMerge as o } from "tailwind-merge";
|
|
8
|
+
import I from "@ichaingo/better-link";
|
|
9
|
+
import { useLocale as A } from "next-intl";
|
|
10
|
+
import v from "./User/Logout.js";
|
|
11
|
+
import { useState as d, useCallback as C, useEffect as S } from "react";
|
|
12
|
+
import k from "./User/SignIn.js";
|
|
13
|
+
import { fetchUserProfile as P } from "@ichaingo/auth";
|
|
14
|
+
import { onUserEvent as R, cleanUserEvent as T, USER_EVENTS as c } from "./events.js";
|
|
15
|
+
import { usePathname as B } from "next/navigation";
|
|
16
|
+
function J({ onClick: t = () => {
|
|
17
|
+
}, hideNews: f = !1, hideLogin: u = !1, user: h }) {
|
|
18
|
+
const { gotoAISQL: U, gotoChat: g } = I(), i = A(), m = B(), [x, b] = d(""), [s, _] = d(h), w = [
|
|
19
|
+
{
|
|
20
|
+
baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
|
|
21
|
+
href: "/explorer",
|
|
22
|
+
key: "/explorer",
|
|
23
|
+
label: /* @__PURE__ */ e("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: /* @__PURE__ */ e(l, { value: "title", parentKey: "browser" }) })
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
27
|
+
href: g({ locale: i }),
|
|
28
|
+
key: "/chat",
|
|
29
|
+
label: /* @__PURE__ */ n("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
|
|
30
|
+
/* @__PURE__ */ e("span", { role: "img", "aria-label": "hot", children: "🔥" }),
|
|
31
|
+
/* @__PURE__ */ e("span", { children: "iGoChat" })
|
|
32
|
+
] })
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
36
|
+
href: U({ locale: i }),
|
|
37
|
+
key: "/sql",
|
|
38
|
+
label: "AISQL"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
|
|
42
|
+
href: "/etf/btc-us",
|
|
43
|
+
key: "/etf",
|
|
44
|
+
label: /* @__PURE__ */ e(l, { value: "etf", parentKey: "menu" })
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
|
|
48
|
+
href: "/news",
|
|
49
|
+
key: "/news",
|
|
50
|
+
label: /* @__PURE__ */ e(l, { value: "news", parentKey: "menu" })
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
baseUrl: process.env.NEXT_PUBLIC_ICHAINGO_SEARCH_BASEURL,
|
|
54
|
+
href: "/ranking/token",
|
|
55
|
+
key: "/ranking",
|
|
56
|
+
label: /* @__PURE__ */ e(l, { value: "ranking", parentKey: "menu" })
|
|
57
|
+
}
|
|
58
|
+
].filter((r) => f ? !["/explorer", "/chat", "/sql"].includes(r.key) : !0), p = C(() => new Promise((r) => {
|
|
59
|
+
P().then((a) => {
|
|
60
|
+
_(a), b((/* @__PURE__ */ new Date()).getTime().toString()), r(a);
|
|
61
|
+
});
|
|
62
|
+
}), []);
|
|
63
|
+
return S(() => (R(c.PROFILE_UPDATED, p), () => {
|
|
64
|
+
T(c.PROFILE_UPDATED, p);
|
|
65
|
+
}), []), /* @__PURE__ */ n(
|
|
66
|
+
"nav",
|
|
67
|
+
{
|
|
68
|
+
className: o(
|
|
69
|
+
"flex flex-col justify-start items-start md:px-3",
|
|
70
|
+
"md:flex-row md:justify-end md:items-start md:px-0",
|
|
71
|
+
"md:gap-6"
|
|
72
|
+
),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ e(
|
|
75
|
+
"ul",
|
|
76
|
+
{
|
|
77
|
+
className: o(
|
|
78
|
+
"flex flex-col justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-title",
|
|
79
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
|
|
80
|
+
"order-2 md:order-0"
|
|
81
|
+
),
|
|
82
|
+
children: w.map((r, a) => /* @__PURE__ */ e("li", { className: o("w-full md:w-auto h-11 md:h-auto cursor-pointer", m.includes(r.key) && "border-b-2 border-primary text-primary "), children: /* @__PURE__ */ e(E, { href: r.href, onClick: t, className: "h-full flex items-center justify-start", baseUrl: r.baseUrl, suppressHydrationWarning: !0, children: r.label }) }, a))
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ e(N, { onClick: t }),
|
|
86
|
+
!m.includes("/login") && !u ? /* @__PURE__ */ n(y, { children: [
|
|
87
|
+
/* @__PURE__ */ e(L, { onClick: t, userInfo: s }, x),
|
|
88
|
+
s != null && s.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(v, {}) }) : /* @__PURE__ */ e(k, { 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" })
|
|
89
|
+
] }) : null
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
export {
|
|
95
|
+
J as default
|
|
96
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import i from "./Nav.js";
|
|
3
|
+
import d from "./Drawer.js";
|
|
4
|
+
function f({ hideNews: m, hideLogin: t, user: e }) {
|
|
5
|
+
return /* @__PURE__ */ a("div", { className: "flex justify-end items-center md:gap-10 z-1001 ", children: [
|
|
6
|
+
/* @__PURE__ */ r(d, { hideLogin: t, hideNews: m, user: e }),
|
|
7
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(i, { hideNews: m, hideLogin: t, user: e }) })
|
|
8
|
+
] });
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
f as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale as h, useTranslations as d } from "next-intl";
|
|
4
|
+
import { useSearchParams as p, usePathname as x } from "next/navigation";
|
|
5
|
+
import { Accordion as b, AccordionItem as w, AccordionTrigger as y, AccordionContent as N } from "@ichaingo/ui/accordion";
|
|
6
|
+
import { twMerge as j } from "tailwind-merge";
|
|
7
|
+
import { useCallback as v } from "react";
|
|
8
|
+
import k from "@ichaingo/link";
|
|
9
|
+
import $ from "@ichaingo/theme-toggle";
|
|
10
|
+
function U({ onClick: f = () => {
|
|
11
|
+
} }) {
|
|
12
|
+
var i;
|
|
13
|
+
const a = h(), r = p(), t = d("lang"), s = d("setting"), o = [
|
|
14
|
+
{ name: t("en"), lang: "en" },
|
|
15
|
+
{ name: t("zh-hant"), lang: "zh-hant" },
|
|
16
|
+
{ name: t("zh-hans"), lang: "zh-hans" },
|
|
17
|
+
{ name: t("ja"), lang: "ja" },
|
|
18
|
+
{ name: t("ko"), lang: "ko" }
|
|
19
|
+
], c = x(), u = v(
|
|
20
|
+
(n) => {
|
|
21
|
+
const m = c.replace(new RegExp(`/${a}(/|$)`), `/${n}$1`), g = r.toString();
|
|
22
|
+
return g ? `${m}?${g}` : m;
|
|
23
|
+
},
|
|
24
|
+
[c, a, r]
|
|
25
|
+
);
|
|
26
|
+
return /* @__PURE__ */ l("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(b, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ l(w, { value: a, className: "border-0", children: [
|
|
28
|
+
/* @__PURE__ */ e(y, { 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__ */ l("div", { className: "flex w-full justify-between items-center", children: [
|
|
29
|
+
/* @__PURE__ */ e("span", { className: "text-title", children: s("language") }),
|
|
30
|
+
/* @__PURE__ */ e("span", { className: "text-title", children: (i = o.find((n) => n.lang === a)) == null ? void 0 : i.name })
|
|
31
|
+
] }) }),
|
|
32
|
+
/* @__PURE__ */ e(N, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: o.map((n) => /* @__PURE__ */ e(
|
|
33
|
+
k,
|
|
34
|
+
{
|
|
35
|
+
prefetch: !1,
|
|
36
|
+
withLocale: !1,
|
|
37
|
+
className: j(
|
|
38
|
+
"p-2 rounded-lg flex w-full justify-between items-center",
|
|
39
|
+
a === n.lang ? "text-primary" : ""
|
|
40
|
+
),
|
|
41
|
+
href: u(n.lang),
|
|
42
|
+
onClick: f,
|
|
43
|
+
children: n.name
|
|
44
|
+
},
|
|
45
|
+
n.lang
|
|
46
|
+
)) })
|
|
47
|
+
] }) }) }),
|
|
48
|
+
/* @__PURE__ */ l("div", { className: "bg-background p-2 rounded-lg h-11 md:h-auto flex w-full justify-between items-center", children: [
|
|
49
|
+
/* @__PURE__ */ e("div", { children: s("theme") }),
|
|
50
|
+
/* @__PURE__ */ e($, {})
|
|
51
|
+
] })
|
|
52
|
+
] });
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
U as default
|
|
56
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import t from "@ichaingo/iconfont";
|
|
3
|
+
import { Popover as i, PopoverTrigger as l, PopoverContent as m } from "@ichaingo/ui/popover";
|
|
4
|
+
import { PopoverArrow as n } from "@radix-ui/react-popover";
|
|
5
|
+
import o from "./SettingBody.js";
|
|
6
|
+
function f({ onClick: d = () => {
|
|
7
|
+
} }) {
|
|
8
|
+
return /* @__PURE__ */ r("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
9
|
+
/* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ r(i, { children: [
|
|
10
|
+
/* @__PURE__ */ e(l, { asChild: !0, children: /* @__PURE__ */ e(t, { type: "icon-setting", className: "text-2xl" }) }),
|
|
11
|
+
/* @__PURE__ */ r(
|
|
12
|
+
m,
|
|
13
|
+
{
|
|
14
|
+
side: "bottom",
|
|
15
|
+
className: "relative top-[10px] rounded-xl border border-stroke bg-module p-2 w-72 z-1000",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ e(n, { className: "fill-module" }),
|
|
18
|
+
/* @__PURE__ */ e(o, { onClick: d })
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] }) }),
|
|
23
|
+
/* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(o, {}) })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
f as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { logout as a } from "@ichaingo/auth";
|
|
4
|
+
import { useCallback as e } from "react";
|
|
5
|
+
import { twMerge as n } from "tailwind-merge";
|
|
6
|
+
import l from "@ichaingo/translation";
|
|
7
|
+
function p({ className: t }) {
|
|
8
|
+
const r = e(async () => {
|
|
9
|
+
await a();
|
|
10
|
+
}, []);
|
|
11
|
+
return /* @__PURE__ */ o(
|
|
12
|
+
"button",
|
|
13
|
+
{
|
|
14
|
+
onClick: r,
|
|
15
|
+
className: n("cursor-pointer relative", t),
|
|
16
|
+
children: /* @__PURE__ */ o(l, { value: "logout", parentKey: "account" })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
p as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as m, useMemo as c, useEffect as p } from "react";
|
|
4
|
+
import s from "@ichaingo/link";
|
|
5
|
+
import l from "@ichaingo/translation";
|
|
6
|
+
import f from "@ichaingo/better-link";
|
|
7
|
+
import { useLocale as g } from "next-intl";
|
|
8
|
+
import u from "@ichaingo/avatar";
|
|
9
|
+
function v({
|
|
10
|
+
userInfo: t
|
|
11
|
+
}) {
|
|
12
|
+
const { gotoLogin: e } = f(), [i, a] = m(""), o = g(), n = c(() => t == null ? void 0 : t.id, [t]);
|
|
13
|
+
return p(() => {
|
|
14
|
+
a(e({
|
|
15
|
+
locale: o,
|
|
16
|
+
redirect: window.location.href
|
|
17
|
+
}));
|
|
18
|
+
}, [o, e]), n ? (
|
|
19
|
+
// userInfo?.profileUrl
|
|
20
|
+
// https://images.ichaingo.com/user-profile/100000201.png
|
|
21
|
+
/* @__PURE__ */ r(u, { userInfo: t, className: "w-8 h-8" })
|
|
22
|
+
) : /* @__PURE__ */ r(
|
|
23
|
+
s,
|
|
24
|
+
{
|
|
25
|
+
href: i,
|
|
26
|
+
className: "cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
|
|
27
|
+
replace: !0,
|
|
28
|
+
children: /* @__PURE__ */ r(l, { value: "signIn", parentKey: "account" })
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
v as default
|
|
34
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
3
|
+
import i from "@ichaingo/link";
|
|
4
|
+
import { Accordion as d, AccordionItem as m, AccordionTrigger as n, AccordionContent as s } from "@ichaingo/ui/accordion";
|
|
5
|
+
import o from "@ichaingo/translation";
|
|
6
|
+
import p from "@ichaingo/avatar";
|
|
7
|
+
function b({
|
|
8
|
+
list: c,
|
|
9
|
+
userInfo: l,
|
|
10
|
+
onClick: t
|
|
11
|
+
}) {
|
|
12
|
+
return /* @__PURE__ */ e(
|
|
13
|
+
d,
|
|
14
|
+
{
|
|
15
|
+
type: "single",
|
|
16
|
+
collapsible: !0,
|
|
17
|
+
className: "w-full",
|
|
18
|
+
defaultValue: "",
|
|
19
|
+
children: /* @__PURE__ */ r(m, { value: "item-1", className: "p-0 w-full border border-none", children: [
|
|
20
|
+
/* @__PURE__ */ e(n, { 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__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
21
|
+
/* @__PURE__ */ e(p, { userInfo: l, className: "w-8 h-8 shrink-0" }),
|
|
22
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col overflow-hidden", children: [
|
|
23
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium", children: l == null ? void 0 : l.username }),
|
|
24
|
+
/* @__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) })
|
|
25
|
+
] })
|
|
26
|
+
] }) }) }),
|
|
27
|
+
/* @__PURE__ */ e(s, { className: "flex text-sm flex-col text-balance bg-background rounded-lg p-3 gap-3 mt-[10px]", children: /* @__PURE__ */ e("dl", { children: c.map((a) => /* @__PURE__ */ e(
|
|
28
|
+
"dd",
|
|
29
|
+
{
|
|
30
|
+
className: "flex justify-start items-center gap-2 py-2",
|
|
31
|
+
children: /* @__PURE__ */ e(i, { href: `/${a.href}`, className: "flex-1 py-2", onClick: t, suppressHydrationWarning: !0, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, children: /* @__PURE__ */ e(o, { value: a.name, parentKey: "account" }) })
|
|
32
|
+
},
|
|
33
|
+
a.name
|
|
34
|
+
)) }) })
|
|
35
|
+
] })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
b as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import { DropdownMenu as d, DropdownMenuTrigger as i, DropdownMenuContent as c, DropdownMenuGroup as t, DropdownMenuItem as m } from "@ichaingo/ui/dropdown-menu";
|
|
4
|
+
import s from "@ichaingo/link";
|
|
5
|
+
import p from "@ichaingo/translation";
|
|
6
|
+
import x from "./MainTrigger.js";
|
|
7
|
+
import g from "./Logout.js";
|
|
8
|
+
import u from "@ichaingo/avatar";
|
|
9
|
+
function M({
|
|
10
|
+
list: o,
|
|
11
|
+
userInfo: l,
|
|
12
|
+
onClick: n
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ a(d, { children: [
|
|
15
|
+
/* @__PURE__ */ e(i, { className: "outline-none cursor-pointer", children: /* @__PURE__ */ e(x, { userInfo: l }) }),
|
|
16
|
+
/* @__PURE__ */ e(c, { align: "end", className: "z-2000 w-75 p-0 border-transparent outline-none border border-stroke", children: /* @__PURE__ */ a(t, { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
|
|
17
|
+
/* @__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: [
|
|
18
|
+
/* @__PURE__ */ e(u, { userInfo: l, className: "w-8 h-8" }),
|
|
19
|
+
/* @__PURE__ */ a("div", { className: "flex flex-col overflow-hidden", children: [
|
|
20
|
+
/* @__PURE__ */ e("div", { className: "text-sm font-medium", children: (l == null ? void 0 : l.username) || "--" }),
|
|
21
|
+
/* @__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) })
|
|
22
|
+
] })
|
|
23
|
+
] }) }),
|
|
24
|
+
o.map((r) => /* @__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: r.name === "logout" ? /* @__PURE__ */ e(g, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ e(s, { href: `/${r.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(p, { value: r.name, parentKey: "account" }) }) }) }, r.name))
|
|
25
|
+
] }) })
|
|
26
|
+
] });
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
M as default
|
|
30
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import a from "@ichaingo/link";
|
|
3
|
+
import { useLocale as m } from "next-intl";
|
|
4
|
+
import c from "@ichaingo/better-link";
|
|
5
|
+
import p from "@ichaingo/translation";
|
|
6
|
+
import { twMerge as f } from "tailwind-merge";
|
|
7
|
+
import { useState as l, useEffect as u } from "react";
|
|
8
|
+
function U({ onClick: t = () => {
|
|
9
|
+
}, className: n }) {
|
|
10
|
+
const r = m(), { gotoLogin: e } = c(), [i, s] = l("");
|
|
11
|
+
return u(() => {
|
|
12
|
+
s(e({
|
|
13
|
+
locale: r,
|
|
14
|
+
redirect: window.location.href
|
|
15
|
+
}));
|
|
16
|
+
}, [r, e]), /* @__PURE__ */ o(
|
|
17
|
+
a,
|
|
18
|
+
{
|
|
19
|
+
href: i,
|
|
20
|
+
onClick: t,
|
|
21
|
+
baseUrl: process.env.NEXT_PUBLIC_AUTH_URL,
|
|
22
|
+
replace: !0,
|
|
23
|
+
className: f(
|
|
24
|
+
"cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
|
|
25
|
+
n
|
|
26
|
+
),
|
|
27
|
+
children: /* @__PURE__ */ o(p, { value: "signIn", parentKey: "account" })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
U as default
|
|
33
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as r, jsxs as n, Fragment as o } from "react/jsx-runtime";
|
|
3
|
+
import a from "./Pc.js";
|
|
4
|
+
import c from "./Mobile.js";
|
|
5
|
+
import { twMerge as i } from "tailwind-merge";
|
|
6
|
+
import s from "./SignIn.js";
|
|
7
|
+
const d = [
|
|
8
|
+
{
|
|
9
|
+
name: "overview",
|
|
10
|
+
href: "user-center"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "collect",
|
|
14
|
+
href: "user-center/collect"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "privateLabel",
|
|
18
|
+
href: "user-center/private-label"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "setting",
|
|
22
|
+
href: "user-center/setting"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "logout",
|
|
26
|
+
href: void 0
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
function x({ onClick: t = (l) => {
|
|
30
|
+
}, className: m, userInfo: e }) {
|
|
31
|
+
return e != null && e.id ? /* @__PURE__ */ n(o, { children: [
|
|
32
|
+
/* @__PURE__ */ r("div", { className: i("hidden md:flex items-center", m), children: /* @__PURE__ */ r(a, { list: d, userInfo: e, onClick: t }) }),
|
|
33
|
+
/* @__PURE__ */ r("div", { className: i("block md:hidden w-full", m), children: /* @__PURE__ */ r(c, { list: d.filter((l) => l.href), userInfo: e, onClick: t }) })
|
|
34
|
+
] }) : /* @__PURE__ */ r(s, { onClick: t, className: i(
|
|
35
|
+
"hidden md:flex cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
|
|
36
|
+
"order-3"
|
|
37
|
+
) });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
x as default
|
|
41
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const E = {
|
|
2
|
+
PROFILE_UPDATED: "user-profile-updated",
|
|
3
|
+
LOGGED_IN: "user-logged-in",
|
|
4
|
+
LOGGED_OUT: "user-logged-out"
|
|
5
|
+
};
|
|
6
|
+
function i(e, n) {
|
|
7
|
+
const t = new CustomEvent(e, { detail: n });
|
|
8
|
+
window.dispatchEvent(t);
|
|
9
|
+
}
|
|
10
|
+
function r(e, n) {
|
|
11
|
+
const t = (o) => {
|
|
12
|
+
n(o.detail);
|
|
13
|
+
};
|
|
14
|
+
return window.addEventListener(e, t), () => window.removeEventListener(e, t);
|
|
15
|
+
}
|
|
16
|
+
function d(e, n) {
|
|
17
|
+
window.removeEventListener(e, n);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
E as USER_EVENTS,
|
|
21
|
+
d as cleanUserEvent,
|
|
22
|
+
i as emitUserEvent,
|
|
23
|
+
r as onUserEvent
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.90",
|
|
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/
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/iconfont": "1.3.
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/request": "1.3.
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/theme-toggle": "1.3.
|
|
32
|
+
"@ichaingo/auth": "1.3.90",
|
|
33
|
+
"@ichaingo/avatar": "1.3.90",
|
|
34
|
+
"@ichaingo/image": "1.3.90",
|
|
35
|
+
"@ichaingo/translation": "1.3.90",
|
|
36
|
+
"@ichaingo/ui": "1.3.90",
|
|
37
|
+
"@ichaingo/i18n": "1.3.90",
|
|
38
|
+
"@ichaingo/better-link": "1.3.90",
|
|
39
|
+
"@ichaingo/iconfont": "1.3.90",
|
|
40
|
+
"@ichaingo/providers": "1.3.90",
|
|
41
|
+
"@ichaingo/request": "1.3.90",
|
|
42
|
+
"@ichaingo/link": "1.3.90",
|
|
43
|
+
"@ichaingo/theme-toggle": "1.3.90"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/js-cookie": "^3.0.6"
|