@ichaingo/header 1.4.39 → 1.4.41
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 +54 -48
- package/dist/lib/Setting/index.js +7 -21
- package/package.json +15 -14
package/dist/lib/Nav.js
CHANGED
|
@@ -1,91 +1,97 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import
|
|
11
|
-
import { useState as
|
|
12
|
-
import
|
|
13
|
-
import { fetchUserProfile as
|
|
14
|
-
import { onUserEvent as
|
|
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";
|
|
6
|
+
import a from "@ichaingo/translation";
|
|
7
|
+
import { twMerge as i } from "tailwind-merge";
|
|
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 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
15
|
import { usePathname as j } from "next/navigation";
|
|
16
|
-
function G({ onClick:
|
|
17
|
-
}, hideNews: p = !1, hideLogin:
|
|
18
|
-
const { gotoAISQL:
|
|
16
|
+
function G({ onClick: s = () => {
|
|
17
|
+
}, 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
19
|
{
|
|
20
|
-
baseUrl: process.env.
|
|
21
|
-
href:
|
|
22
|
-
key:
|
|
23
|
-
label: /* @__PURE__ */
|
|
20
|
+
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
21
|
+
href: U({ locale: t }),
|
|
22
|
+
key: `/${t}`,
|
|
23
|
+
label: /* @__PURE__ */ o("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: [
|
|
24
|
+
/* @__PURE__ */ r("span", { role: "img", "aria-label": "hot", children: "🔥" }),
|
|
25
|
+
/* @__PURE__ */ r("span", { children: "Search" })
|
|
26
|
+
] }),
|
|
27
|
+
show: (e) => e === `/${t}` || e.includes(`/${t}/conversation`)
|
|
24
28
|
},
|
|
25
|
-
// {
|
|
26
|
-
// baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
27
|
-
// href: gotoChat({ locale: locale }),
|
|
28
|
-
// key: '/chat',
|
|
29
|
-
// label: <span className="whitespace-nowrap leading-11 md:leading-[34px]">
|
|
30
|
-
// <span role="img" aria-label="hot">🔥</span>
|
|
31
|
-
// <span>iGoChat</span>
|
|
32
|
-
// </span>,
|
|
33
|
-
// },
|
|
34
29
|
{
|
|
35
30
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
36
|
-
href:
|
|
31
|
+
href: w({ locale: t }),
|
|
37
32
|
key: "/sql",
|
|
38
|
-
label: "AISQL"
|
|
33
|
+
label: "AISQL",
|
|
34
|
+
show: (e) => e.includes(`/${t}/sql`)
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
38
|
+
href: "/explorer",
|
|
39
|
+
key: "/explorer",
|
|
40
|
+
label: /* @__PURE__ */ r("span", { className: "whitespace-nowrap leading-11 md:leading-[34px]", children: /* @__PURE__ */ r(a, { value: "title", parentKey: "browser" }) }),
|
|
41
|
+
show: (e) => e.includes("/explorer")
|
|
39
42
|
},
|
|
40
43
|
{
|
|
41
44
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
42
45
|
href: "/etf/btc-us",
|
|
43
46
|
key: "/etf",
|
|
44
|
-
label: /* @__PURE__ */
|
|
47
|
+
label: /* @__PURE__ */ r(a, { value: "etf", parentKey: "menu" }),
|
|
48
|
+
show: (e) => e.includes("/etf")
|
|
45
49
|
},
|
|
46
50
|
{
|
|
47
51
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
48
52
|
href: "/news",
|
|
49
53
|
key: "/news",
|
|
50
|
-
label: /* @__PURE__ */
|
|
54
|
+
label: /* @__PURE__ */ r(a, { value: "news", parentKey: "menu" }),
|
|
55
|
+
show: (e) => e.includes("/news")
|
|
51
56
|
},
|
|
52
57
|
{
|
|
53
58
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
54
59
|
href: "/ranking/token",
|
|
55
60
|
key: "/ranking",
|
|
56
|
-
label: /* @__PURE__ */
|
|
61
|
+
label: /* @__PURE__ */ r(a, { value: "ranking", parentKey: "menu" }),
|
|
62
|
+
show: (e) => e.includes("/ranking")
|
|
57
63
|
}
|
|
58
|
-
].filter((
|
|
59
|
-
|
|
60
|
-
b(
|
|
64
|
+
].filter((e) => p ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), d = B(() => new Promise((e) => {
|
|
65
|
+
T().then((l) => {
|
|
66
|
+
b(l), x((/* @__PURE__ */ new Date()).getTime().toString()), e(l);
|
|
61
67
|
});
|
|
62
68
|
}), []);
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
}), []), /* @__PURE__ */
|
|
69
|
+
return P(() => (A(c.PROFILE_UPDATED, d), () => {
|
|
70
|
+
R(c.PROFILE_UPDATED, d);
|
|
71
|
+
}), []), /* @__PURE__ */ o(
|
|
66
72
|
"nav",
|
|
67
73
|
{
|
|
68
|
-
className:
|
|
74
|
+
className: i(
|
|
69
75
|
"flex flex-col justify-start items-start md:px-3",
|
|
70
76
|
"md:flex-row md:justify-end md:items-start md:px-0",
|
|
71
77
|
"md:gap-6"
|
|
72
78
|
),
|
|
73
79
|
children: [
|
|
74
|
-
/* @__PURE__ */
|
|
80
|
+
/* @__PURE__ */ r(
|
|
75
81
|
"ul",
|
|
76
82
|
{
|
|
77
|
-
className:
|
|
83
|
+
className: i(
|
|
78
84
|
"flex flex-col justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-title",
|
|
79
85
|
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
|
|
80
86
|
"order-2 md:order-0"
|
|
81
87
|
),
|
|
82
|
-
children: y.map((
|
|
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))
|
|
83
89
|
}
|
|
84
90
|
),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
!
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
91
|
+
/* @__PURE__ */ r(v, { onClick: s }),
|
|
92
|
+
!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" })
|
|
89
95
|
] }) : null
|
|
90
96
|
]
|
|
91
97
|
}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { PopoverArrow as n } from "@radix-ui/react-popover";
|
|
1
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import r from "@ichaingo/iconfont";
|
|
3
|
+
import i from "@ichaingo/tooltip";
|
|
5
4
|
import o from "./SettingBody.js";
|
|
6
|
-
function
|
|
5
|
+
function a({ onClick: t = () => {
|
|
7
6
|
} }) {
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
/* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */ e(l, { asChild: !0, children: /* @__PURE__ */ e(t, { type: "icon-setting", className: "text-2xl" }) }),
|
|
11
|
-
/* @__PURE__ */ r(
|
|
12
|
-
m,
|
|
13
|
-
{
|
|
14
|
-
side: "bottom",
|
|
15
|
-
className: "relative top-[10px] rounded-xl border border-stroke bg-module p-2 w-72 z-1000",
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ e(n, { className: "fill-module" }),
|
|
18
|
-
/* @__PURE__ */ e(o, { onClick: d })
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
)
|
|
22
|
-
] }) }),
|
|
7
|
+
return /* @__PURE__ */ d("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
8
|
+
/* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-module rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ e(i, { side: "bottom", contentClassName: "bg-module w-70 rounded-lg bg-module text-title", trigger: /* @__PURE__ */ e(r, { type: "icon-setting", className: "text-2xl" }), arrowClassName: "fill-module", children: /* @__PURE__ */ e(o, { onClick: t }) }) }),
|
|
23
9
|
/* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(o, {}) })
|
|
24
10
|
] });
|
|
25
11
|
}
|
|
26
12
|
export {
|
|
27
|
-
|
|
13
|
+
a as default
|
|
28
14
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,19 +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/better-link": "1.4.
|
|
35
|
-
"@ichaingo/
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/with-login": "1.4.
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
32
|
+
"@ichaingo/auth": "1.4.41",
|
|
33
|
+
"@ichaingo/avatar": "1.4.41",
|
|
34
|
+
"@ichaingo/better-link": "1.4.41",
|
|
35
|
+
"@ichaingo/translation": "1.4.41",
|
|
36
|
+
"@ichaingo/image": "1.4.41",
|
|
37
|
+
"@ichaingo/link": "1.4.41",
|
|
38
|
+
"@ichaingo/theme-toggle": "1.4.41",
|
|
39
|
+
"@ichaingo/providers": "1.4.41",
|
|
40
|
+
"@ichaingo/ui": "1.4.41",
|
|
41
|
+
"@ichaingo/with-login": "1.4.41",
|
|
42
|
+
"@ichaingo/iconfont": "1.4.41",
|
|
43
|
+
"@ichaingo/request": "1.4.41",
|
|
44
|
+
"@ichaingo/i18n": "1.4.41",
|
|
45
|
+
"@ichaingo/tooltip": "1.4.41"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/js-cookie": "^3.0.6"
|