@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 +22 -24
- package/dist/lib/User/SignIn.js +22 -27
- package/package.json +15 -15
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
|
|
4
|
-
import
|
|
5
|
-
import
|
|
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
|
|
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
|
|
12
|
-
import
|
|
13
|
-
import { fetchUserProfile as
|
|
14
|
-
import { onUserEvent as
|
|
15
|
-
import { usePathname as
|
|
16
|
-
|
|
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:
|
|
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:
|
|
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),
|
|
66
|
-
|
|
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
|
|
71
|
-
|
|
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:
|
|
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(
|
|
91
|
+
/* @__PURE__ */ r(v, { onClick: s }),
|
|
93
92
|
!m.includes("/login") && !f ? /* @__PURE__ */ o(E, { children: [
|
|
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(k, {}) }) : /* @__PURE__ */ r(
|
|
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
|
-
|
|
101
|
+
G as default
|
|
104
102
|
};
|
package/dist/lib/User/SignIn.js
CHANGED
|
@@ -1,30 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import { twMerge as
|
|
4
|
-
import { useLogin as
|
|
5
|
-
function
|
|
6
|
-
}, className:
|
|
7
|
-
const r =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
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.
|
|
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/
|
|
33
|
-
"@ichaingo/
|
|
34
|
-
"@ichaingo/
|
|
35
|
-
"@ichaingo/avatar": "1.4.
|
|
36
|
-
"@ichaingo/translation": "1.4.
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/link": "1.4.
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
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"
|