@ichaingo/header 1.4.54 → 1.4.56

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.
Files changed (2) hide show
  1. package/dist/lib/Nav.js +24 -22
  2. package/package.json +15 -15
package/dist/lib/Nav.js CHANGED
@@ -1,24 +1,25 @@
1
1
  'use client';
2
2
  import { jsxs as o, 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";
3
+ import _ from "@ichaingo/link";
4
+ import v from "./User/index.js";
5
+ import N from "./Setting/index.js";
6
6
  import a from "@ichaingo/translation";
7
7
  import { twMerge as i } from "tailwind-merge";
8
- import N from "@ichaingo/better-link";
8
+ import P from "@ichaingo/better-link";
9
9
  import { useLocale as S } from "next-intl";
10
10
  import k from "./User/Logout.js";
11
- import { useState as u, useCallback as B, useEffect as P } from "react";
12
- import I from "./User/SignIn.js";
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
- function G({ onClick: s = () => {
11
+ import { useState as d, useCallback as B, useEffect as I } from "react";
12
+ import T from "./User/SignIn.js";
13
+ import { fetchUserProfile as A } from "@ichaingo/auth";
14
+ import { onUserEvent as R, cleanUserEvent as j, USER_EVENTS as u } from "./events.js";
15
+ import { usePathname as C } from "next/navigation";
16
+ import { useLogin as K } from "@ichaingo/with-login";
17
+ function Z({ onClick: s = () => {
17
18
  }, hideNews: p = !1, hideLogin: f = !1, user: h }) {
18
- const { gotoAISQL: w, gotoChat: U } = N(), t = S(), m = j(), [g, x] = u(""), [n, b] = u(h), y = [
19
+ const { gotoAISQL: w, gotoChat: g } = P(), t = S(), m = C(), [U, x] = d(""), [n, b] = d(h), { Prefetch: y } = K({}), L = [
19
20
  {
20
21
  baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
21
- href: U({ locale: t }),
22
+ href: g({ locale: t }),
22
23
  key: `/${t}`,
23
24
  label: /* @__PURE__ */ o("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
24
25
  /* @__PURE__ */ r("span", { role: "img", "aria-label": "hot", children: "🔥" }),
@@ -61,13 +62,13 @@ function G({ onClick: s = () => {
61
62
  label: /* @__PURE__ */ r(a, { value: "ranking", parentKey: "menu" }),
62
63
  show: (e) => e.includes("/ranking")
63
64
  }
64
- ].filter((e) => p ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), d = B(() => new Promise((e) => {
65
- T().then((l) => {
65
+ ].filter((e) => p ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), c = B(() => new Promise((e) => {
66
+ A().then((l) => {
66
67
  b(l), x((/* @__PURE__ */ new Date()).getTime().toString()), e(l);
67
68
  });
68
69
  }), []);
69
- return P(() => (A(c.PROFILE_UPDATED, d), () => {
70
- R(c.PROFILE_UPDATED, d);
70
+ return I(() => (R(u.PROFILE_UPDATED, c), () => {
71
+ j(u.PROFILE_UPDATED, c);
71
72
  }), []), /* @__PURE__ */ o(
72
73
  "nav",
73
74
  {
@@ -85,18 +86,19 @@ function G({ onClick: s = () => {
85
86
  "md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
86
87
  "order-2 md:order-0"
87
88
  ),
88
- children: y.map((e, l) => /* @__PURE__ */ r("li", { className: i("w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary", e.show(m) && "border-b-2 border-primary text-primary "), children: /* @__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))
89
+ children: L.map((e, l) => /* @__PURE__ */ r("li", { className: i("w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary", e.show(m) && "border-b-2 border-primary text-primary "), children: /* @__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
90
  }
90
91
  ),
91
- /* @__PURE__ */ r(v, { onClick: s }),
92
+ /* @__PURE__ */ r(N, { onClick: s }),
92
93
  !m.includes("/login") && !f ? /* @__PURE__ */ o(E, { children: [
93
- /* @__PURE__ */ r(_, { onClick: s, userInfo: n }, g),
94
- 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" })
95
- ] }) : null
94
+ /* @__PURE__ */ r(v, { onClick: s, userInfo: n }, U),
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(T, { 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
+ ] }) : null,
97
+ /* @__PURE__ */ r(y, {})
96
98
  ]
97
99
  }
98
100
  );
99
101
  }
100
102
  export {
101
- G as default
103
+ Z as default
102
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ichaingo/header",
3
- "version": "1.4.54",
3
+ "version": "1.4.56",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -29,20 +29,20 @@
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/avatar": "1.4.54",
33
- "@ichaingo/auth": "1.4.54",
34
- "@ichaingo/image": "1.4.54",
35
- "@ichaingo/better-link": "1.4.54",
36
- "@ichaingo/link": "1.4.54",
37
- "@ichaingo/translation": "1.4.54",
38
- "@ichaingo/i18n": "1.4.54",
39
- "@ichaingo/providers": "1.4.54",
40
- "@ichaingo/request": "1.4.54",
41
- "@ichaingo/with-login": "1.4.54",
42
- "@ichaingo/tooltip": "1.4.54",
43
- "@ichaingo/theme-toggle": "1.4.54",
44
- "@ichaingo/iconfont": "1.4.54",
45
- "@ichaingo/ui": "1.4.54"
32
+ "@ichaingo/image": "1.4.56",
33
+ "@ichaingo/auth": "1.4.56",
34
+ "@ichaingo/better-link": "1.4.56",
35
+ "@ichaingo/avatar": "1.4.56",
36
+ "@ichaingo/translation": "1.4.56",
37
+ "@ichaingo/theme-toggle": "1.4.56",
38
+ "@ichaingo/link": "1.4.56",
39
+ "@ichaingo/i18n": "1.4.56",
40
+ "@ichaingo/providers": "1.4.56",
41
+ "@ichaingo/ui": "1.4.56",
42
+ "@ichaingo/with-login": "1.4.56",
43
+ "@ichaingo/tooltip": "1.4.56",
44
+ "@ichaingo/iconfont": "1.4.56",
45
+ "@ichaingo/request": "1.4.56"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/js-cookie": "^3.0.6"