@ichaingo/header 1.5.7-beta → 1.5.7

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 CHANGED
@@ -1,25 +1,25 @@
1
1
  'use client';
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";
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 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";
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 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 = () => {
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: g, gotoChat: U } = S(), { getLanguage: w } = k(), t = w(), o = C(), [x, b] = d(""), [n, y] = d(h), E = [
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: U({ locale: t }),
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: g({ locale: t }),
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(X, {}),
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 = P(() => new Promise((e) => {
66
- A().then((l) => {
67
- y(l), b((/* @__PURE__ */ new Date()).getTime().toString()), e(l);
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 T(() => (R(c.PROFILE_UPDATED, u), () => {
71
- j(c.PROFILE_UPDATED, u);
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: 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))
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(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" })
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
- Z as default
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 { 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 = () => {
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 { getLanguage: u } = p(), a = u(), r = x(), { t } = d(), s = d(), o = [
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 = b(), h = k(
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(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: [
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(j, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: o.map((n) => /* @__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: v(
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: h(n.lang),
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(L, {})
50
+ /* @__PURE__ */ e($, {})
51
51
  ] })
52
52
  ] });
53
53
  }
54
54
  export {
55
- E as default
55
+ U as default
56
56
  };
@@ -1,31 +1,31 @@
1
1
  'use client';
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";
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 { useTolgee as f } from "@ichaingo/tolgee/client";
8
- import d from "@ichaingo/avatar";
7
+ import { useLocale as f } from "next-intl";
8
+ import g from "@ichaingo/avatar";
9
9
  function v({
10
- userInfo: t
10
+ userInfo: r
11
11
  }) {
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(() => {
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]), c ? (
18
+ }, [o, e]), a ? (
19
19
  // userInfo?.profileUrl
20
20
  // https://images.ichatgo.ai/user-profile/100000201.png
21
- /* @__PURE__ */ r(d, { userInfo: t, className: "w-8 h-8 cursor-pointer" })
22
- ) : /* @__PURE__ */ r(
23
- p,
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__ */ r(g, { value: "signIn", parentKey: "account" })
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.7-beta",
3
+ "version": "1.5.7",
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.7-beta",
35
- "@ichaingo/better-link": "1.5.7-beta",
36
- "@ichaingo/ui": "1.5.7-beta",
37
- "@ichaingo/link": "1.5.7-beta",
38
- "@ichaingo/auth": "1.5.7-beta",
39
- "@ichaingo/avatar": "1.5.7-beta",
40
- "@ichaingo/translation": "1.5.7-beta",
41
- "@ichaingo/iconfont": "1.5.7-beta",
42
- "@ichaingo/tolgee": "1.5.7-beta",
43
- "@ichaingo/request": "1.5.7-beta",
44
- "@ichaingo/theme-toggle": "1.5.7-beta",
45
- "@ichaingo/with-login": "1.5.7-beta",
46
- "@ichaingo/tooltip": "1.5.7-beta",
47
- "@ichaingo/token": "1.5.7-beta"
35
+ "@ichaingo/image": "1.5.7",
36
+ "@ichaingo/better-link": "1.5.7",
37
+ "@ichaingo/ui": "1.5.7",
38
+ "@ichaingo/link": "1.5.7",
39
+ "@ichaingo/iconfont": "1.5.7",
40
+ "@ichaingo/request": "1.5.7",
41
+ "@ichaingo/auth": "1.5.7",
42
+ "@ichaingo/translation": "1.5.7",
43
+ "@ichaingo/avatar": "1.5.7",
44
+ "@ichaingo/theme-toggle": "1.5.7",
45
+ "@ichaingo/with-login": "1.5.7",
46
+ "@ichaingo/token": "1.5.7",
47
+ "@ichaingo/tooltip": "1.5.7"
48
48
  }
49
49
  }