@ichaingo/header 1.5.7-beta → 1.5.8
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/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 E } from "react/jsx-runtime";
|
|
3
|
+
import L from "@ichaingo/link";
|
|
4
|
+
import _ from "./User/index.js";
|
|
5
|
+
import v 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 N from "@ichaingo/better-link";
|
|
9
|
+
import { useLocale as S } from "next-intl";
|
|
10
|
+
import k from "./User/Logout.js";
|
|
11
|
+
import { useState as d, useCallback as B, useEffect as P } 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 T } from "@ichaingo/auth";
|
|
14
|
+
import { onUserEvent as A, cleanUserEvent as R, USER_EVENTS as c } from "./events.js";
|
|
15
|
+
import { usePathname as j } from "next/navigation";
|
|
16
|
+
import C from "./Explorer.js";
|
|
17
|
+
function Y({ onClick: s = () => {
|
|
18
18
|
}, hideNews: f = !1, hideLogin: p = !1, user: h }) {
|
|
19
|
-
const { gotoAISQL:
|
|
19
|
+
const { gotoAISQL: U, gotoChat: w } = N(), t = S(), o = j(), [x, g] = d(""), [n, b] = d(h), y = [
|
|
20
20
|
{
|
|
21
21
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
22
|
-
href:
|
|
22
|
+
href: w({ 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 Z({ onClick: s = () => {
|
|
|
29
29
|
},
|
|
30
30
|
{
|
|
31
31
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
32
|
-
href:
|
|
32
|
+
href: U({ locale: t }),
|
|
33
33
|
key: "/sql",
|
|
34
34
|
label: "AISQL",
|
|
35
35
|
show: (e) => e.includes(`/${t}/sql`)
|
|
@@ -38,7 +38,7 @@ function Z({ 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(C, {}),
|
|
42
42
|
show: (e) => e.includes("/explorer")
|
|
43
43
|
},
|
|
44
44
|
{
|
|
@@ -62,13 +62,13 @@ function Z({ 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 = B(() => new Promise((e) => {
|
|
66
|
+
T().then((l) => {
|
|
67
|
+
b(l), g((/* @__PURE__ */ new Date()).getTime().toString()), e(l);
|
|
68
68
|
});
|
|
69
69
|
}), []);
|
|
70
|
-
return
|
|
71
|
-
|
|
70
|
+
return P(() => (A(c.PROFILE_UPDATED, u), () => {
|
|
71
|
+
R(c.PROFILE_UPDATED, u);
|
|
72
72
|
}), []), /* @__PURE__ */ a(
|
|
73
73
|
"nav",
|
|
74
74
|
{
|
|
@@ -86,18 +86,18 @@ function Z({ 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: y.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(L, { 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(v, { onClick: s }),
|
|
93
|
+
!o.includes("/login") && !p ? /* @__PURE__ */ a(E, { children: [
|
|
94
|
+
/* @__PURE__ */ r(_, { 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(k, {}) }) : /* @__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
|
+
Y 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 { 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
11
|
} }) {
|
|
12
12
|
var i;
|
|
13
|
-
const
|
|
13
|
+
const a = h(), r = p(), t = d("lang"), s = d("setting"), 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 = x(), u = v(
|
|
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 E({ 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(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
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(N, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: o.map((n) => /* @__PURE__ */ e(
|
|
33
|
+
k,
|
|
34
34
|
{
|
|
35
35
|
prefetch: !1,
|
|
36
36
|
withLocale: !1,
|
|
37
|
-
className:
|
|
37
|
+
className: j(
|
|
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: u(n.lang),
|
|
42
42
|
onClick: f,
|
|
43
43
|
children: n.name
|
|
44
44
|
},
|
|
@@ -47,10 +47,10 @@ function E({ 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($, {})
|
|
51
51
|
] })
|
|
52
52
|
] });
|
|
53
53
|
}
|
|
54
54
|
export {
|
|
55
|
-
|
|
55
|
+
U 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 t } 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
6
|
import u from "@ichaingo/better-link";
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
7
|
+
import { useLocale as f } from "next-intl";
|
|
8
|
+
import g from "@ichaingo/avatar";
|
|
9
9
|
function v({
|
|
10
|
-
userInfo:
|
|
10
|
+
userInfo: r
|
|
11
11
|
}) {
|
|
12
|
-
const { gotoLogin: e } = u(), [i, n] = m(""),
|
|
13
|
-
return
|
|
12
|
+
const { gotoLogin: e } = u(), [i, n] = m(""), o = f(), a = c(() => r == null ? void 0 : r.id, [r]);
|
|
13
|
+
return p(() => {
|
|
14
14
|
n(e({
|
|
15
|
-
locale: o
|
|
15
|
+
locale: o,
|
|
16
16
|
redirect: window.location.href
|
|
17
17
|
}));
|
|
18
|
-
}, [o, e]),
|
|
18
|
+
}, [o, e]), a ? (
|
|
19
19
|
// userInfo?.profileUrl
|
|
20
20
|
// https://images.ichatgo.ai/user-profile/100000201.png
|
|
21
|
-
/* @__PURE__ */
|
|
22
|
-
) : /* @__PURE__ */
|
|
23
|
-
|
|
21
|
+
/* @__PURE__ */ t(g, { userInfo: r, className: "w-8 h-8 cursor-pointer" })
|
|
22
|
+
) : /* @__PURE__ */ t(
|
|
23
|
+
s,
|
|
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__ */ t(l, { value: "signIn", parentKey: "account" })
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"js-cookie": "3.0.5",
|
|
26
26
|
"lucide-react": "0.539.0",
|
|
27
|
+
"next-intl": "4.6.1",
|
|
27
28
|
"@ichaingo/next-themes": "0.5.0",
|
|
28
29
|
"rc-drawer": "7.3.0",
|
|
29
30
|
"react": "19.1.1",
|
|
@@ -31,19 +32,18 @@
|
|
|
31
32
|
"tailwind-merge": "3.3.1",
|
|
32
33
|
"next": "15.5.6",
|
|
33
34
|
"antd": "6.1.1",
|
|
34
|
-
"@ichaingo/image": "1.5.
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
46
|
-
"@ichaingo/tooltip": "1.5.
|
|
47
|
-
"@ichaingo/token": "1.5.7-beta"
|
|
35
|
+
"@ichaingo/image": "1.5.8",
|
|
36
|
+
"@ichaingo/auth": "1.5.8",
|
|
37
|
+
"@ichaingo/translation": "1.5.8",
|
|
38
|
+
"@ichaingo/ui": "1.5.8",
|
|
39
|
+
"@ichaingo/avatar": "1.5.8",
|
|
40
|
+
"@ichaingo/iconfont": "1.5.8",
|
|
41
|
+
"@ichaingo/request": "1.5.8",
|
|
42
|
+
"@ichaingo/link": "1.5.8",
|
|
43
|
+
"@ichaingo/theme-toggle": "1.5.8",
|
|
44
|
+
"@ichaingo/better-link": "1.5.8",
|
|
45
|
+
"@ichaingo/with-login": "1.5.8",
|
|
46
|
+
"@ichaingo/token": "1.5.8",
|
|
47
|
+
"@ichaingo/tooltip": "1.5.8"
|
|
48
48
|
}
|
|
49
49
|
}
|