@ichaingo/header 1.4.56 → 1.4.57

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