@ichaingo/header 1.5.4 → 1.5.6-beta
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/lib/Nav.js +28 -28
- package/dist/lib/Setting/SettingBody.js +18 -18
- package/dist/lib/User/MainTrigger.js +15 -15
- package/dist/lib/User/Pc.js +10 -10
- package/package.json +15 -15
package/dist/lib/Nav.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as a, jsx as r, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { jsxs as a, jsx as r, Fragment as L } from "react/jsx-runtime";
|
|
3
|
+
import _ from "@ichaingo/link";
|
|
4
|
+
import v from "./User/index.js";
|
|
5
|
+
import N from "./Setting/index.js";
|
|
6
6
|
import i from "@ichaingo/translation";
|
|
7
7
|
import { twMerge as m } from "tailwind-merge";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { useState as d, useCallback as
|
|
8
|
+
import S from "@ichaingo/better-link";
|
|
9
|
+
import { useTolgee as k } from "@ichaingo/tolgee/client";
|
|
10
|
+
import B from "./User/Logout.js";
|
|
11
|
+
import { useState as d, useCallback as P, useEffect as T } from "react";
|
|
12
12
|
import I from "./User/SignIn.js";
|
|
13
|
-
import { fetchUserProfile as
|
|
14
|
-
import { onUserEvent as
|
|
15
|
-
import { usePathname as
|
|
16
|
-
import
|
|
17
|
-
function
|
|
13
|
+
import { fetchUserProfile as A } from "@ichaingo/auth";
|
|
14
|
+
import { onUserEvent as R, cleanUserEvent as j, USER_EVENTS as c } from "./events.js";
|
|
15
|
+
import { usePathname as C } from "next/navigation";
|
|
16
|
+
import X from "./Explorer.js";
|
|
17
|
+
function Z({ onClick: s = () => {
|
|
18
18
|
}, hideNews: f = !1, hideLogin: p = !1, user: h }) {
|
|
19
|
-
const { gotoAISQL:
|
|
19
|
+
const { gotoAISQL: g, gotoChat: U } = S(), { getLanguage: w } = k(), t = w(), o = C(), [x, b] = d(""), [n, y] = d(h), E = [
|
|
20
20
|
{
|
|
21
21
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
22
|
-
href:
|
|
22
|
+
href: U({ locale: t }),
|
|
23
23
|
key: `/${t}`,
|
|
24
24
|
label: /* @__PURE__ */ a("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
|
|
25
25
|
/* @__PURE__ */ r("span", { role: "img", "aria-label": "hot", children: "🔥" }),
|
|
@@ -29,7 +29,7 @@ function Y({ onClick: s = () => {
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
32
|
-
href:
|
|
32
|
+
href: g({ locale: t }),
|
|
33
33
|
key: "/sql",
|
|
34
34
|
label: "AISQL",
|
|
35
35
|
show: (e) => e.includes(`/${t}/sql`)
|
|
@@ -38,7 +38,7 @@ function Y({ onClick: s = () => {
|
|
|
38
38
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
39
39
|
href: "/explorer",
|
|
40
40
|
key: "/explorer",
|
|
41
|
-
label: /* @__PURE__ */ r(
|
|
41
|
+
label: /* @__PURE__ */ r(X, {}),
|
|
42
42
|
show: (e) => e.includes("/explorer")
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -62,13 +62,13 @@ function Y({ onClick: s = () => {
|
|
|
62
62
|
label: /* @__PURE__ */ r(i, { value: "ranking", parentKey: "menu" }),
|
|
63
63
|
show: (e) => e.includes("/ranking")
|
|
64
64
|
}
|
|
65
|
-
].filter((e) => f ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), u =
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
].filter((e) => f ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), u = P(() => new Promise((e) => {
|
|
66
|
+
A().then((l) => {
|
|
67
|
+
y(l), b((/* @__PURE__ */ new Date()).getTime().toString()), e(l);
|
|
68
68
|
});
|
|
69
69
|
}), []);
|
|
70
|
-
return
|
|
71
|
-
|
|
70
|
+
return T(() => (R(c.PROFILE_UPDATED, u), () => {
|
|
71
|
+
j(c.PROFILE_UPDATED, u);
|
|
72
72
|
}), []), /* @__PURE__ */ a(
|
|
73
73
|
"nav",
|
|
74
74
|
{
|
|
@@ -86,18 +86,18 @@ function Y({ onClick: s = () => {
|
|
|
86
86
|
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
|
|
87
87
|
"order-2 md:order-0"
|
|
88
88
|
),
|
|
89
|
-
children:
|
|
89
|
+
children: E.map((e, l) => /* @__PURE__ */ r("li", { className: m("w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary", e.show(o) && "border-b-2 border-primary text-primary "), children: e.href === o ? e.label : /* @__PURE__ */ r(_, { href: e.href, onClick: s, className: "h-full flex items-center justify-start", baseUrl: e.baseUrl, suppressHydrationWarning: !0, children: e.label }) }, l))
|
|
90
90
|
}
|
|
91
91
|
),
|
|
92
|
-
/* @__PURE__ */ r(
|
|
93
|
-
!o.includes("/login") && !p ? /* @__PURE__ */ a(
|
|
94
|
-
/* @__PURE__ */ r(
|
|
95
|
-
n != null && n.id ? /* @__PURE__ */ r("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__ */ r(
|
|
92
|
+
/* @__PURE__ */ r(N, { onClick: s }),
|
|
93
|
+
!o.includes("/login") && !p ? /* @__PURE__ */ a(L, { children: [
|
|
94
|
+
/* @__PURE__ */ r(v, { onClick: s, userInfo: n }, x),
|
|
95
|
+
n != null && n.id ? /* @__PURE__ */ r("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__ */ r(B, {}) }) : /* @__PURE__ */ r(I, { onClick: s, 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" })
|
|
96
96
|
] }) : null
|
|
97
97
|
]
|
|
98
98
|
}
|
|
99
99
|
);
|
|
100
100
|
}
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
Z as default
|
|
103
103
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
4
|
-
import { useSearchParams as
|
|
5
|
-
import { Accordion as
|
|
6
|
-
import { twMerge as
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
3
|
+
import { useTolgee as p, useTranslate as d } from "@ichaingo/tolgee/client";
|
|
4
|
+
import { useSearchParams as x, usePathname as b } from "next/navigation";
|
|
5
|
+
import { Accordion as w, AccordionItem as y, AccordionTrigger as N, AccordionContent as j } from "@ichaingo/ui/accordion";
|
|
6
|
+
import { twMerge as v } from "tailwind-merge";
|
|
7
|
+
import { useCallback as k } from "react";
|
|
8
|
+
import $ from "@ichaingo/link";
|
|
9
|
+
import L from "@ichaingo/theme-toggle";
|
|
10
|
+
function E({ onClick: f = () => {
|
|
11
11
|
} }) {
|
|
12
12
|
var i;
|
|
13
|
-
const a =
|
|
13
|
+
const { getLanguage: u } = p(), a = u(), r = x(), { t } = d(), s = d(), o = [
|
|
14
14
|
{ name: t("en"), lang: "en" },
|
|
15
15
|
{ name: t("ja"), lang: "ja" },
|
|
16
16
|
{ name: t("ko"), lang: "ko" },
|
|
17
17
|
{ name: t("zh-hant"), lang: "zh-hant" },
|
|
18
18
|
{ name: t("zh-hans"), lang: "zh-hans" }
|
|
19
|
-
], c =
|
|
19
|
+
], c = b(), h = k(
|
|
20
20
|
(n) => {
|
|
21
21
|
const m = c.replace(new RegExp(`/${a}(/|$)`), `/${n}$1`), g = r.toString();
|
|
22
22
|
return g ? `${m}?${g}` : m;
|
|
@@ -24,21 +24,21 @@ function U({ onClick: f = () => {
|
|
|
24
24
|
[c, a, r]
|
|
25
25
|
);
|
|
26
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(
|
|
28
|
-
/* @__PURE__ */ e(
|
|
27
|
+
/* @__PURE__ */ e("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ e(w, { type: "single", className: "flex-1", collapsible: !0, children: /* @__PURE__ */ l(y, { value: a, className: "border-0", children: [
|
|
28
|
+
/* @__PURE__ */ e(N, { 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
29
|
/* @__PURE__ */ e("span", { className: "text-title", children: s("language") }),
|
|
30
30
|
/* @__PURE__ */ e("span", { className: "text-title", children: (i = o.find((n) => n.lang === a)) == null ? void 0 : i.name })
|
|
31
31
|
] }) }),
|
|
32
|
-
/* @__PURE__ */ e(
|
|
33
|
-
|
|
32
|
+
/* @__PURE__ */ e(j, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: o.map((n) => /* @__PURE__ */ e(
|
|
33
|
+
$,
|
|
34
34
|
{
|
|
35
35
|
prefetch: !1,
|
|
36
36
|
withLocale: !1,
|
|
37
|
-
className:
|
|
37
|
+
className: v(
|
|
38
38
|
"p-2 rounded-lg flex w-full justify-between items-center",
|
|
39
39
|
a === n.lang ? "text-primary" : ""
|
|
40
40
|
),
|
|
41
|
-
href:
|
|
41
|
+
href: h(n.lang),
|
|
42
42
|
onClick: f,
|
|
43
43
|
children: n.name
|
|
44
44
|
},
|
|
@@ -47,10 +47,10 @@ function U({ onClick: f = () => {
|
|
|
47
47
|
] }) }) }),
|
|
48
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
49
|
/* @__PURE__ */ e("div", { children: s("theme") }),
|
|
50
|
-
/* @__PURE__ */ e(
|
|
50
|
+
/* @__PURE__ */ e(L, {})
|
|
51
51
|
] })
|
|
52
52
|
] });
|
|
53
53
|
}
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
E as default
|
|
56
56
|
};
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as m, useMemo as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
2
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import { useState as m, useMemo as s, useEffect as l } from "react";
|
|
4
|
+
import p from "@ichaingo/link";
|
|
5
|
+
import g from "@ichaingo/translation";
|
|
6
6
|
import u from "@ichaingo/better-link";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { useTolgee as f } from "@ichaingo/tolgee/client";
|
|
8
|
+
import d from "@ichaingo/avatar";
|
|
9
9
|
function v({
|
|
10
|
-
userInfo:
|
|
10
|
+
userInfo: t
|
|
11
11
|
}) {
|
|
12
|
-
const { gotoLogin: e } = u(), [i, n] = m(""),
|
|
13
|
-
return
|
|
12
|
+
const { gotoLogin: e } = u(), [i, n] = m(""), { getLanguage: a } = f(), o = a(), c = s(() => t == null ? void 0 : t.id, [t]);
|
|
13
|
+
return l(() => {
|
|
14
14
|
n(e({
|
|
15
|
-
locale: o,
|
|
15
|
+
locale: o || "",
|
|
16
16
|
redirect: window.location.href
|
|
17
17
|
}));
|
|
18
|
-
}, [o, e]),
|
|
18
|
+
}, [o, e]), c ? (
|
|
19
19
|
// userInfo?.profileUrl
|
|
20
20
|
// https://images.ichatgo.ai/user-profile/100000201.png
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
) : /* @__PURE__ */
|
|
23
|
-
|
|
21
|
+
/* @__PURE__ */ r(d, { userInfo: t, className: "w-8 h-8 cursor-pointer" })
|
|
22
|
+
) : /* @__PURE__ */ r(
|
|
23
|
+
p,
|
|
24
24
|
{
|
|
25
25
|
href: i,
|
|
26
26
|
className: "cursor-pointer text-sm text-white bg-primary py-2 px-3 rounded-lg",
|
|
27
27
|
replace: !0,
|
|
28
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ r(g, { value: "signIn", parentKey: "account" })
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
}
|
package/dist/lib/User/Pc.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as l, jsxs as
|
|
2
|
+
import { jsx as l, jsxs as r } from "react/jsx-runtime";
|
|
3
3
|
import d from "@ichaingo/link";
|
|
4
|
-
import
|
|
4
|
+
import o from "@ichaingo/translation";
|
|
5
5
|
import m from "./MainTrigger.js";
|
|
6
6
|
import c from "./Logout.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import n from "@ichaingo/avatar";
|
|
8
|
+
import s from "@ichaingo/tooltip";
|
|
9
9
|
function u({
|
|
10
10
|
list: t,
|
|
11
11
|
userInfo: e,
|
|
12
|
-
onClick:
|
|
12
|
+
onClick: i
|
|
13
13
|
}) {
|
|
14
|
-
return /* @__PURE__ */ l(
|
|
15
|
-
/* @__PURE__ */ l("div", { className: "flex flex-col gap-3 w-full bg-background rounded-lg p-2", children: /* @__PURE__ */
|
|
16
|
-
/* @__PURE__ */ l(
|
|
17
|
-
/* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ l(s, { trigger: /* @__PURE__ */ l(m, { userInfo: e }), arrowClassName: "fill-module", contentClassName: "text-title w-75 p-0 border-transparent outline-none ", children: /* @__PURE__ */ r("div", { className: "flex flex-col gap-2 p-3 bg-module rounded-md", children: [
|
|
15
|
+
/* @__PURE__ */ l("div", { className: "flex flex-col gap-3 w-full bg-background rounded-lg p-2", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
|
|
16
|
+
/* @__PURE__ */ l(n, { userInfo: e, className: "w-8 h-8" }),
|
|
17
|
+
/* @__PURE__ */ r("div", { className: "flex flex-col overflow-hidden", children: [
|
|
18
18
|
/* @__PURE__ */ l("div", { className: "text-sm font-medium", children: (e == null ? void 0 : e.username) || "--" }),
|
|
19
19
|
/* @__PURE__ */ l("div", { className: "text-xs text-muted-foreground w-full truncate", children: (e == null ? void 0 : e.email) || (e == null ? void 0 : e.walletAddress) })
|
|
20
20
|
] })
|
|
21
21
|
] }) }),
|
|
22
|
-
t.map((
|
|
22
|
+
t.map((a) => /* @__PURE__ */ l("div", { className: "px-0 py-0 focus-visible:border-none focus-visible:outline-none", children: /* @__PURE__ */ l("div", { className: "flex items-center gap-2 w-full", children: a.name === "logout" ? /* @__PURE__ */ l(c, { className: "flex-1 flex py-3 border-t border-stroke w-full px-2 hover:bg-background" }) : /* @__PURE__ */ l(d, { href: `/${a.href}`, baseUrl: process.env.NEXT_PUBLIC_AUTH_URL, className: "flex-1 flex py-3 h-full w-full px-2 hover:bg-background hover:text-primary rounded-lg ", onClick: i, children: /* @__PURE__ */ l(o, { value: a.name, parentKey: "account" }) }) }) }, a.name))
|
|
23
23
|
] }) });
|
|
24
24
|
}
|
|
25
25
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.6-beta",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"js-cookie": "3.0.5",
|
|
26
26
|
"lucide-react": "0.539.0",
|
|
27
|
-
"next-intl": "4.6.1",
|
|
28
27
|
"@ichaingo/next-themes": "0.5.0",
|
|
29
28
|
"rc-drawer": "7.3.0",
|
|
30
29
|
"react": "19.1.1",
|
|
@@ -32,18 +31,19 @@
|
|
|
32
31
|
"tailwind-merge": "3.3.1",
|
|
33
32
|
"next": "15.5.6",
|
|
34
33
|
"antd": "6.1.1",
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/link": "1.5.
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
46
|
-
"@ichaingo/
|
|
47
|
-
"@ichaingo/
|
|
34
|
+
"@ichaingo/image": "1.5.6-beta",
|
|
35
|
+
"@ichaingo/link": "1.5.6-beta",
|
|
36
|
+
"@ichaingo/translation": "1.5.6-beta",
|
|
37
|
+
"@ichaingo/ui": "1.5.6-beta",
|
|
38
|
+
"@ichaingo/better-link": "1.5.6-beta",
|
|
39
|
+
"@ichaingo/avatar": "1.5.6-beta",
|
|
40
|
+
"@ichaingo/request": "1.5.6-beta",
|
|
41
|
+
"@ichaingo/with-login": "1.5.6-beta",
|
|
42
|
+
"@ichaingo/iconfont": "1.5.6-beta",
|
|
43
|
+
"@ichaingo/tolgee": "1.5.6-beta",
|
|
44
|
+
"@ichaingo/auth": "1.5.6-beta",
|
|
45
|
+
"@ichaingo/tooltip": "1.5.6-beta",
|
|
46
|
+
"@ichaingo/theme-toggle": "1.5.6-beta",
|
|
47
|
+
"@ichaingo/token": "1.5.6-beta"
|
|
48
48
|
}
|
|
49
49
|
}
|