@0xchain/header 1.1.0-beta.1 → 1.1.0-beta.11
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/index.d.ts +10 -1
- package/dist/index.js +41 -31
- package/dist/lib/Drawer.js +35 -14
- package/dist/lib/Explorer.js +37 -38
- package/dist/lib/Logo.js +58 -16
- package/dist/lib/Nav.js +125 -52
- package/dist/lib/Right.js +12 -12
- package/dist/lib/Setting/index.js +38 -11
- package/dist/lib/context.js +24 -0
- package/package.json +16 -16
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { JSX } from 'react/jsx-runtime';
|
|
|
3
3
|
|
|
4
4
|
export declare function emitUserEvent(eventName: string, data?: any): void;
|
|
5
5
|
|
|
6
|
-
declare function HeaderBar({ extra, children, className, hideNews, hideLogin, source }: HeaderBarProps): Promise<JSX.Element>;
|
|
6
|
+
declare function HeaderBar({ extra, children, className, hideNews, hideLogin, source, brand }: HeaderBarProps): Promise<JSX.Element>;
|
|
7
7
|
export default HeaderBar;
|
|
8
8
|
|
|
9
9
|
export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDivElement> {
|
|
@@ -12,8 +12,17 @@ export declare interface HeaderBarProps extends default_2.HTMLAttributes<HTMLDiv
|
|
|
12
12
|
hideNews?: boolean;
|
|
13
13
|
hideLogin?: boolean;
|
|
14
14
|
source?: HeaderSource;
|
|
15
|
+
/** 品牌标识:iChatGo(默认)或 CHAINDIGG */
|
|
16
|
+
brand?: HeaderBrand;
|
|
15
17
|
}
|
|
16
18
|
|
|
19
|
+
/**
|
|
20
|
+
* 品牌标识
|
|
21
|
+
* - "iChatGo": iChatGo 品牌(默认)
|
|
22
|
+
* - "CHAINDIGG": CHAINDIGG 品牌
|
|
23
|
+
*/
|
|
24
|
+
export declare type HeaderBrand = "iChatGo" | "CHAINDIGG";
|
|
25
|
+
|
|
17
26
|
export declare enum HeaderSource {
|
|
18
27
|
EXPLORER = "explorer",
|
|
19
28
|
CHAT = "chat",
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,56 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as t, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { twMerge as i } from "tailwind-merge";
|
|
3
3
|
import k from "@0xchain/request";
|
|
4
|
-
import
|
|
4
|
+
import l, { HeaderSource as a } from "./lib/Right.js";
|
|
5
5
|
import g from "./lib/Logo.js";
|
|
6
|
-
import { cookies as
|
|
7
|
-
import {
|
|
8
|
-
|
|
6
|
+
import { cookies as v } from "next/headers";
|
|
7
|
+
import { HeaderProvider as E } from "./lib/context.js";
|
|
8
|
+
import { USER_EVENTS as w, emitUserEvent as j, onUserEvent as G } from "./lib/events.js";
|
|
9
|
+
async function R({
|
|
10
|
+
extra: f,
|
|
11
|
+
children: p,
|
|
12
|
+
className: h,
|
|
13
|
+
hideNews: d = !1,
|
|
14
|
+
hideLogin: c = !1,
|
|
15
|
+
source: r = a.DEFAULT,
|
|
16
|
+
brand: s = "iChatGo"
|
|
17
|
+
}) {
|
|
9
18
|
var n;
|
|
10
19
|
let e = {
|
|
11
20
|
data: {}
|
|
12
21
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
if (s !== "CHAINDIGG")
|
|
23
|
+
try {
|
|
24
|
+
const m = (n = (await v()).get("refresh_token")) == null ? void 0 : n.value;
|
|
25
|
+
if (typeof m < "u" && m !== "")
|
|
26
|
+
try {
|
|
27
|
+
e = await k.get("/v2/users/profile", {
|
|
28
|
+
baseURL: process.env.AUTH_INNER_API_URL
|
|
29
|
+
});
|
|
30
|
+
} catch (x) {
|
|
31
|
+
console.error(x), e = { data: {} };
|
|
32
|
+
}
|
|
33
|
+
} catch {
|
|
34
|
+
e = { data: {} };
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ t(E, { brand: s, children: [
|
|
37
|
+
/* @__PURE__ */ t("div", { className: i("sticky left-0 right-0 top-0 bg-background h-16 z-999", r === a.CHAT ? "hidden md:block" : "block", h), children: [
|
|
38
|
+
/* @__PURE__ */ t("div", { className: "md:bg-card h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
|
|
39
|
+
/* @__PURE__ */ t("div", { className: i("items-center flex-1 gap-6", r === a.CHAT ? "hidden md:flex" : "flex"), children: [
|
|
40
|
+
/* @__PURE__ */ o(g, {}),
|
|
31
41
|
p
|
|
32
42
|
] }),
|
|
33
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ o(l, { hideNews: d, hideLogin: c, user: (e == null ? void 0 : e.data) || {} })
|
|
34
44
|
] }),
|
|
35
|
-
|
|
45
|
+
f
|
|
36
46
|
] }),
|
|
37
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ o("div", { className: i(r === a.CHAT ? "block md:hidden" : "hidden"), children: /* @__PURE__ */ o(l, { hideNews: d, source: r, hideLogin: c, user: (e == null ? void 0 : e.data) || {} }) })
|
|
38
48
|
] });
|
|
39
49
|
}
|
|
40
50
|
export {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
a as HeaderSource,
|
|
52
|
+
w as USER_EVENTS,
|
|
53
|
+
R as default,
|
|
54
|
+
j as emitUserEvent,
|
|
55
|
+
G as onUserEvent
|
|
46
56
|
};
|
package/dist/lib/Drawer.js
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as
|
|
3
|
-
import
|
|
4
|
-
import { Menu as
|
|
5
|
-
import
|
|
6
|
-
import { useState as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
3
|
+
import d from "rc-drawer";
|
|
4
|
+
import { Menu as f, X as m } from "lucide-react";
|
|
5
|
+
import p from "./Nav.js";
|
|
6
|
+
import { useState as u } from "react";
|
|
7
|
+
import { useIsChaindigg as g } from "./context.js";
|
|
8
|
+
function N({
|
|
9
|
+
hideLogin: s = !1,
|
|
10
|
+
hideNews: n = !1,
|
|
11
|
+
user: i
|
|
12
|
+
}) {
|
|
13
|
+
const e = g(), [a, t] = u(!1);
|
|
14
|
+
if (!a)
|
|
15
|
+
return /* @__PURE__ */ o(
|
|
16
|
+
f,
|
|
17
|
+
{
|
|
18
|
+
onClick: () => t(!0),
|
|
19
|
+
size: 32,
|
|
20
|
+
style: { color: "var(--foreground)" },
|
|
21
|
+
className: "md:hidden bg-card rounded-lg p-[4px]"
|
|
22
|
+
}
|
|
23
|
+
);
|
|
11
24
|
const l = (r) => {
|
|
12
25
|
r == null || r.preventDefault(), r == null || r.stopPropagation(), t(!1);
|
|
13
26
|
};
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
27
|
+
return /* @__PURE__ */ o(
|
|
28
|
+
d,
|
|
29
|
+
{
|
|
30
|
+
open: a,
|
|
31
|
+
placement: "right",
|
|
32
|
+
className: `block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 p-2 ${e ? "bg-background" : "bg-background/70 h-screen"}`,
|
|
33
|
+
children: /* @__PURE__ */ c("div", { className: `w-full overflow-y-auto p-3 bg-card rounded-lg ${e ? "max-h-full" : "max-h-[calc(100svh-16px)]"}`, children: [
|
|
34
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(m, { size: 24, style: { color: "var(--foreground)" }, onClick: (r) => l(r) }) }),
|
|
35
|
+
/* @__PURE__ */ o(p, { onClick: (r) => l(r), hideLogin: s, hideNews: n, user: i })
|
|
36
|
+
] })
|
|
37
|
+
}
|
|
38
|
+
);
|
|
18
39
|
}
|
|
19
40
|
export {
|
|
20
|
-
|
|
41
|
+
N as default
|
|
21
42
|
};
|
package/dist/lib/Explorer.js
CHANGED
|
@@ -1,40 +1,38 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import
|
|
4
|
-
import { Dropdown as
|
|
5
|
-
import { useState as
|
|
2
|
+
import { jsxs as t, Fragment as w, jsx as r } from "react/jsx-runtime";
|
|
3
|
+
import m from "@0xchain/translation";
|
|
4
|
+
import { Dropdown as b } from "antd";
|
|
5
|
+
import { useState as f, useEffect as y } from "react";
|
|
6
6
|
import N from "@0xchain/request";
|
|
7
|
-
import y from "@0xchain/link";
|
|
8
7
|
import x from "@0xchain/better-link";
|
|
9
|
-
import
|
|
10
|
-
import { usePathname as A } from "next/navigation";
|
|
11
|
-
import { Accordion as
|
|
12
|
-
function
|
|
13
|
-
}, onExpandChange:
|
|
8
|
+
import j from "@0xchain/image";
|
|
9
|
+
import { usePathname as A, useRouter as I } from "next/navigation";
|
|
10
|
+
import { Accordion as S, AccordionItem as L, AccordionTrigger as P } from "@0xchain/ui/accordion";
|
|
11
|
+
function q({ onClick: a = () => {
|
|
12
|
+
}, onExpandChange: n }) {
|
|
14
13
|
A();
|
|
15
|
-
const { gotoExplorer:
|
|
14
|
+
const p = I(), { gotoExplorer: h } = x(), [s, v] = f([]), [c, i] = f(""), g = async () => {
|
|
16
15
|
const e = await N.get("/api/v2/chains/all-chain-list/basic");
|
|
17
|
-
|
|
16
|
+
v(e.data);
|
|
17
|
+
}, d = (e, o) => {
|
|
18
|
+
e == null || e.preventDefault(), e == null || e.stopPropagation(), a == null || a(), i("");
|
|
19
|
+
const l = h({ chain: o.chainSymbol });
|
|
20
|
+
p.push(l);
|
|
18
21
|
};
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
y(() => {
|
|
23
|
+
g();
|
|
21
24
|
}, []);
|
|
22
|
-
const
|
|
23
|
-
var
|
|
24
|
-
return /* @__PURE__ */
|
|
25
|
-
|
|
25
|
+
const u = (e) => {
|
|
26
|
+
var o, l;
|
|
27
|
+
return /* @__PURE__ */ t(
|
|
28
|
+
"div",
|
|
26
29
|
{
|
|
27
|
-
href: p({ chain: e.chainSymbol }),
|
|
28
30
|
className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium",
|
|
29
|
-
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
30
|
-
onClick: (m) => {
|
|
31
|
-
m.preventDefault(), m.stopPropagation(), o == null || o(), t("");
|
|
32
|
-
},
|
|
33
31
|
children: [
|
|
34
32
|
/* @__PURE__ */ r(
|
|
35
|
-
|
|
33
|
+
j,
|
|
36
34
|
{
|
|
37
|
-
src: e != null && e.chainIconUrl ? e == null ? void 0 : e.chainIconUrl : `//cdn.ichaingo.com/module/cryptos/${(
|
|
35
|
+
src: e != null && e.chainIconUrl ? e == null ? void 0 : e.chainIconUrl : `//cdn.ichaingo.com/module/cryptos/${(l = (o = e == null ? void 0 : e.chain) == null ? void 0 : o.toLowerCase()) == null ? void 0 : l.replace(" ", "-")}.png?format=auto&width=20&height=20`,
|
|
38
36
|
className: "w-5 h-5",
|
|
39
37
|
objectFit: "contain"
|
|
40
38
|
}
|
|
@@ -44,9 +42,9 @@ function R({ onClick: o = () => {
|
|
|
44
42
|
}
|
|
45
43
|
);
|
|
46
44
|
};
|
|
47
|
-
return /* @__PURE__ */
|
|
45
|
+
return /* @__PURE__ */ t(w, { children: [
|
|
48
46
|
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
|
|
49
|
-
|
|
47
|
+
b,
|
|
50
48
|
{
|
|
51
49
|
getPopupContainer: () => document.body,
|
|
52
50
|
classNames: {
|
|
@@ -56,40 +54,41 @@ function R({ onClick: o = () => {
|
|
|
56
54
|
placement: "bottom",
|
|
57
55
|
menu: {
|
|
58
56
|
items: s.map((e) => ({
|
|
59
|
-
label:
|
|
60
|
-
key: e.chainSymbol
|
|
57
|
+
label: u(e),
|
|
58
|
+
key: e.chainSymbol,
|
|
59
|
+
onClick: (o) => d(o.domEvent, e)
|
|
61
60
|
}))
|
|
62
61
|
},
|
|
63
|
-
children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(
|
|
62
|
+
children: /* @__PURE__ */ r("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg", children: /* @__PURE__ */ r(m, { value: "title", parentKey: "browser" }) })
|
|
64
63
|
}
|
|
65
64
|
) }),
|
|
66
|
-
/* @__PURE__ */ r("div", { className: "md:hidden w-full", children: /* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ r("div", { className: "md:hidden w-full", children: /* @__PURE__ */ t("div", { onClick: (e) => {
|
|
67
66
|
e.preventDefault(), e.stopPropagation();
|
|
68
67
|
}, children: [
|
|
69
68
|
/* @__PURE__ */ r(
|
|
70
|
-
|
|
69
|
+
S,
|
|
71
70
|
{
|
|
72
71
|
type: "single",
|
|
73
72
|
collapsible: !0,
|
|
74
73
|
className: "w-full",
|
|
75
|
-
value:
|
|
74
|
+
value: c,
|
|
76
75
|
onValueChange: (e) => {
|
|
77
|
-
|
|
76
|
+
i(e), n == null || n(!!e);
|
|
78
77
|
},
|
|
79
|
-
children: /* @__PURE__ */ r(
|
|
78
|
+
children: /* @__PURE__ */ r(L, { value: "explorer", className: "border-0", children: /* @__PURE__ */ r(P, { className: "rounded-lg font-medium h-11 w-full flex py-2 justify-between items-center hover:no-underline focus-visible:ring-0 focus-visible:ring-offset-0", children: /* @__PURE__ */ r("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ r("span", { className: "text-foreground", children: /* @__PURE__ */ r(m, { value: "title", parentKey: "browser" }) }) }) }) })
|
|
80
79
|
}
|
|
81
80
|
),
|
|
82
81
|
/* @__PURE__ */ r(
|
|
83
82
|
"div",
|
|
84
83
|
{
|
|
85
84
|
className: "grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
86
|
-
style: { gridTemplateRows:
|
|
87
|
-
children: /* @__PURE__ */ r("div", { className: "overflow-hidden", children: /* @__PURE__ */ r("div", { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: s.map((e) => /* @__PURE__ */ r("div", { className: "w-full", children:
|
|
85
|
+
style: { gridTemplateRows: c ? "1fr" : "0fr" },
|
|
86
|
+
children: /* @__PURE__ */ r("div", { className: "overflow-hidden", children: /* @__PURE__ */ r("div", { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: s.map((e) => /* @__PURE__ */ r("div", { className: "w-full", onClick: (o) => d(o, e), children: u(e) }, e.chainSymbol)) }) })
|
|
88
87
|
}
|
|
89
88
|
)
|
|
90
89
|
] }) })
|
|
91
90
|
] });
|
|
92
91
|
}
|
|
93
92
|
export {
|
|
94
|
-
|
|
93
|
+
q as default
|
|
95
94
|
};
|
package/dist/lib/Logo.js
CHANGED
|
@@ -1,23 +1,65 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import o from "@0xchain/image";
|
|
4
|
-
import
|
|
5
|
-
import { twMerge as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
o,
|
|
4
|
+
import e from "@0xchain/link";
|
|
5
|
+
import { twMerge as i } from "tailwind-merge";
|
|
6
|
+
import { useIsChaindigg as s } from "./context.js";
|
|
7
|
+
function g() {
|
|
8
|
+
return s() ? /* @__PURE__ */ t(
|
|
9
|
+
e,
|
|
11
10
|
{
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
suppressHydrationWarning: !0,
|
|
12
|
+
href: "/explorer",
|
|
13
|
+
baseUrl: "",
|
|
14
|
+
className: i("w-auto shrink-0 block cursor-pointer"),
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ r(
|
|
17
|
+
o,
|
|
18
|
+
{
|
|
19
|
+
className: "block dark:hidden",
|
|
20
|
+
src: `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/2026/01/07/695dcb36c177e.png`,
|
|
21
|
+
width: 154,
|
|
22
|
+
height: 32,
|
|
23
|
+
alt: "logo",
|
|
24
|
+
objectFit: "contain",
|
|
25
|
+
priority: !0
|
|
26
|
+
}
|
|
27
|
+
),
|
|
28
|
+
/* @__PURE__ */ r(
|
|
29
|
+
o,
|
|
30
|
+
{
|
|
31
|
+
className: "hidden dark:block",
|
|
32
|
+
src: `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/2026/01/07/695dcf43c95d8.png`,
|
|
33
|
+
width: 154,
|
|
34
|
+
height: 32,
|
|
35
|
+
alt: "logo",
|
|
36
|
+
objectFit: "contain",
|
|
37
|
+
priority: !0
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
]
|
|
18
41
|
}
|
|
19
|
-
)
|
|
42
|
+
) : /* @__PURE__ */ r(
|
|
43
|
+
e,
|
|
44
|
+
{
|
|
45
|
+
suppressHydrationWarning: !0,
|
|
46
|
+
href: "/",
|
|
47
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
48
|
+
className: i("w-auto shrink-0 block cursor-pointer"),
|
|
49
|
+
children: /* @__PURE__ */ r(
|
|
50
|
+
o,
|
|
51
|
+
{
|
|
52
|
+
src: `${process.env.NEXT_PUBLIC_CDN_URL}/logo.png`,
|
|
53
|
+
width: 154,
|
|
54
|
+
height: 32,
|
|
55
|
+
alt: "logo",
|
|
56
|
+
objectFit: "contain",
|
|
57
|
+
priority: !0
|
|
58
|
+
}
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
);
|
|
20
62
|
}
|
|
21
63
|
export {
|
|
22
|
-
|
|
64
|
+
g as default
|
|
23
65
|
};
|
package/dist/lib/Nav.js
CHANGED
|
@@ -1,102 +1,175 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as r, jsxs as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { twMerge as
|
|
8
|
-
import
|
|
9
|
-
import { useLocale as
|
|
10
|
-
import
|
|
11
|
-
import { useState as m, useCallback as
|
|
12
|
-
import
|
|
13
|
-
import { fetchUserProfile as
|
|
14
|
-
import { onUserEvent as
|
|
15
|
-
import { usePathname as
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
2
|
+
import { jsx as r, jsxs as i, Fragment as P } from "react/jsx-runtime";
|
|
3
|
+
import p from "@0xchain/link";
|
|
4
|
+
import j from "./User/index.js";
|
|
5
|
+
import c from "./Setting/index.js";
|
|
6
|
+
import h from "@0xchain/translation";
|
|
7
|
+
import { twMerge as l } from "tailwind-merge";
|
|
8
|
+
import I from "@0xchain/better-link";
|
|
9
|
+
import { useLocale as T } from "next-intl";
|
|
10
|
+
import k from "./User/Logout.js";
|
|
11
|
+
import { useState as m, useCallback as A, useEffect as R } from "react";
|
|
12
|
+
import C from "./User/SignIn.js";
|
|
13
|
+
import { fetchUserProfile as X } from "@0xchain/auth";
|
|
14
|
+
import { onUserEvent as D, cleanUserEvent as K, USER_EVENTS as x } from "./events.js";
|
|
15
|
+
import { usePathname as $ } from "next/navigation";
|
|
16
|
+
import g from "./Explorer.js";
|
|
17
|
+
import { useIsChaindigg as q } from "./context.js";
|
|
18
|
+
function le({ onClick: t = () => {
|
|
19
|
+
}, hideNews: w = !1, hideLogin: U = !1, user: b }) {
|
|
20
|
+
const a = q(), { gotoAISQL: y, gotoChat: E } = I(), s = T(), n = $(), [L, v] = m(""), [d, N] = m(b), [F, _] = m(!1), S = [
|
|
20
21
|
{
|
|
21
22
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
22
|
-
href:
|
|
23
|
-
key: `/${
|
|
23
|
+
href: E({ locale: s }),
|
|
24
|
+
key: `/${s}`,
|
|
24
25
|
label: /* @__PURE__ */ r("span", { children: "iSearch" }),
|
|
25
|
-
show: (e) => e === `/${
|
|
26
|
+
show: (e) => e === `/${s}` || e.includes(`/${s}/conversation`)
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
29
|
-
href:
|
|
30
|
+
href: y({ locale: s }),
|
|
30
31
|
key: "/sql",
|
|
31
32
|
label: "iSQL",
|
|
32
|
-
show: (e) => e.includes(`/${
|
|
33
|
+
show: (e) => e.includes(`/${s}/sql`)
|
|
33
34
|
},
|
|
34
35
|
{
|
|
35
36
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
36
37
|
href: "/explorer",
|
|
37
38
|
key: "/explorer",
|
|
38
|
-
label: /* @__PURE__ */ r(
|
|
39
|
+
label: /* @__PURE__ */ r(g, { onClick: t, onExpandChange: _ }),
|
|
39
40
|
show: (e) => e.includes("/explorer")
|
|
40
41
|
},
|
|
41
|
-
// {
|
|
42
|
-
// baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
43
|
-
// href: `/etf/btc-us`,
|
|
44
|
-
// key: '/etf',
|
|
45
|
-
// label: <Translation value="etf" parentKey="menu" />,
|
|
46
|
-
// show: (pathname: string) => {
|
|
47
|
-
// return pathname.includes(`/etf`)
|
|
48
|
-
// }
|
|
49
|
-
// },
|
|
50
42
|
{
|
|
51
43
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
52
44
|
href: "/news",
|
|
53
45
|
key: "/news",
|
|
54
|
-
label: /* @__PURE__ */ r(
|
|
46
|
+
label: /* @__PURE__ */ r(h, { value: "news", parentKey: "menu" }),
|
|
55
47
|
show: (e) => e.includes("/news")
|
|
56
48
|
},
|
|
57
49
|
{
|
|
58
50
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
59
51
|
href: "/ranking/token",
|
|
60
52
|
key: "/ranking",
|
|
61
|
-
label: /* @__PURE__ */ r(
|
|
53
|
+
label: /* @__PURE__ */ r(h, { value: "ranking", parentKey: "menu" }),
|
|
62
54
|
show: (e) => e.includes("/ranking")
|
|
63
55
|
}
|
|
64
|
-
].filter((e) =>
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
].filter((e) => w ? !["/explorer", "/chat", "/sql"].includes(e.key) : !0), B = [
|
|
57
|
+
{
|
|
58
|
+
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
59
|
+
href: "/explorer",
|
|
60
|
+
key: "/explorer",
|
|
61
|
+
label: /* @__PURE__ */ r(g, {}),
|
|
62
|
+
show: (e) => e.includes("/explorer")
|
|
63
|
+
}
|
|
64
|
+
], u = a ? B : S, f = A(() => new Promise((e) => {
|
|
65
|
+
X().then((o) => {
|
|
66
|
+
N(o), v((/* @__PURE__ */ new Date()).getTime().toString()), e(o);
|
|
67
67
|
});
|
|
68
68
|
}), []);
|
|
69
|
-
return
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
return R(() => {
|
|
70
|
+
if (!a)
|
|
71
|
+
return D(x.PROFILE_UPDATED, f), () => {
|
|
72
|
+
K(x.PROFILE_UPDATED, f);
|
|
73
|
+
};
|
|
74
|
+
}, [a]), a ? /* @__PURE__ */ i(
|
|
75
|
+
"nav",
|
|
76
|
+
{
|
|
77
|
+
className: l(
|
|
78
|
+
"flex flex-col justify-start items-start md:px-3",
|
|
79
|
+
"md:flex-row md:justify-end md:items-start md:px-0",
|
|
80
|
+
"md:gap-6"
|
|
81
|
+
),
|
|
82
|
+
children: [
|
|
83
|
+
/* @__PURE__ */ r(
|
|
84
|
+
"ul",
|
|
85
|
+
{
|
|
86
|
+
className: l(
|
|
87
|
+
"flex flex-col justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-foreground",
|
|
88
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
|
|
89
|
+
"order-2 md:order-0"
|
|
90
|
+
),
|
|
91
|
+
children: u.map((e, o) => /* @__PURE__ */ r(
|
|
92
|
+
"li",
|
|
93
|
+
{
|
|
94
|
+
className: l(
|
|
95
|
+
"w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary",
|
|
96
|
+
e.show(n) && "border-b-2 border-primary text-primary"
|
|
97
|
+
),
|
|
98
|
+
children: e.href === n ? e.label : /* @__PURE__ */ r(
|
|
99
|
+
p,
|
|
100
|
+
{
|
|
101
|
+
href: e.href,
|
|
102
|
+
onClick: t,
|
|
103
|
+
className: "h-full flex items-center justify-start",
|
|
104
|
+
baseUrl: e.baseUrl,
|
|
105
|
+
suppressHydrationWarning: !0,
|
|
106
|
+
children: e.label
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
},
|
|
110
|
+
o
|
|
111
|
+
))
|
|
112
|
+
}
|
|
113
|
+
),
|
|
114
|
+
/* @__PURE__ */ r(c, { onClick: t })
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
) : /* @__PURE__ */ i(
|
|
72
118
|
"nav",
|
|
73
119
|
{
|
|
74
|
-
className:
|
|
120
|
+
className: l(
|
|
75
121
|
"flex flex-col justify-start items-start md:px-3",
|
|
76
|
-
"md:flex-row md:justify-end md:items-center
|
|
122
|
+
"md:flex-row md:justify-end md:items-center md:px-0",
|
|
77
123
|
"md:gap-4"
|
|
78
124
|
),
|
|
79
125
|
children: [
|
|
80
126
|
/* @__PURE__ */ r(
|
|
81
127
|
"ul",
|
|
82
128
|
{
|
|
83
|
-
className:
|
|
84
|
-
"flex flex-col justify-start items-start w-full
|
|
85
|
-
"md:flex-row md:items-center md:w-auto md:h-[34px]
|
|
129
|
+
className: l(
|
|
130
|
+
"flex flex-col justify-start items-start w-full h-full text-sm z-1001 text-foreground",
|
|
131
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:gap-6",
|
|
86
132
|
"order-2 md:order-0"
|
|
87
133
|
),
|
|
88
|
-
children:
|
|
134
|
+
children: u.map((e, o) => /* @__PURE__ */ r(
|
|
135
|
+
"li",
|
|
136
|
+
{
|
|
137
|
+
className: l(
|
|
138
|
+
"w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full",
|
|
139
|
+
e.key === "/explorer" ? "h-auto" : "h-11",
|
|
140
|
+
e.show(n) ? "md:text-primary md:bg-primary/20" : "md:hover:bg-border"
|
|
141
|
+
),
|
|
142
|
+
children: e.href === n ? e.label : /* @__PURE__ */ r(
|
|
143
|
+
p,
|
|
144
|
+
{
|
|
145
|
+
href: e.href,
|
|
146
|
+
onClick: t,
|
|
147
|
+
className: "h-full flex items-center justify-start",
|
|
148
|
+
baseUrl: e.baseUrl,
|
|
149
|
+
suppressHydrationWarning: !0,
|
|
150
|
+
children: e.label
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
},
|
|
154
|
+
o
|
|
155
|
+
))
|
|
89
156
|
}
|
|
90
157
|
),
|
|
91
|
-
/* @__PURE__ */ r(
|
|
92
|
-
!
|
|
93
|
-
/* @__PURE__ */ r(
|
|
94
|
-
|
|
158
|
+
/* @__PURE__ */ r(c, { onClick: t }),
|
|
159
|
+
!n.includes("/login") && !U ? /* @__PURE__ */ i(P, { children: [
|
|
160
|
+
/* @__PURE__ */ r(j, { onClick: t, userInfo: d }, L),
|
|
161
|
+
d != null && d.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-muted-foreground", children: /* @__PURE__ */ r(k, {}) }) : /* @__PURE__ */ r(
|
|
162
|
+
C,
|
|
163
|
+
{
|
|
164
|
+
onClick: t,
|
|
165
|
+
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"
|
|
166
|
+
}
|
|
167
|
+
)
|
|
95
168
|
] }) : null
|
|
96
169
|
]
|
|
97
170
|
}
|
|
98
171
|
);
|
|
99
172
|
}
|
|
100
173
|
export {
|
|
101
|
-
|
|
174
|
+
le as default
|
|
102
175
|
};
|
package/dist/lib/Right.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { twMerge as
|
|
5
|
-
var
|
|
2
|
+
import l from "./Nav.js";
|
|
3
|
+
import i from "./Drawer.js";
|
|
4
|
+
import { twMerge as s } from "tailwind-merge";
|
|
5
|
+
var o = /* @__PURE__ */ ((t) => (t.EXPLORER = "explorer", t.CHAT = "chat", t.DEFAULT = "default", t))(o || {});
|
|
6
6
|
function x({
|
|
7
|
-
hideNews: t,
|
|
8
|
-
hideLogin:
|
|
9
|
-
user:
|
|
10
|
-
source:
|
|
7
|
+
hideNews: t = !1,
|
|
8
|
+
hideLogin: a = !1,
|
|
9
|
+
user: e,
|
|
10
|
+
source: m = "default"
|
|
11
11
|
/* DEFAULT */
|
|
12
12
|
}) {
|
|
13
|
-
return /* @__PURE__ */ f("div", { className:
|
|
14
|
-
/* @__PURE__ */ r(
|
|
15
|
-
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(
|
|
13
|
+
return /* @__PURE__ */ f("div", { className: s(m === "chat" ? "" : "flex justify-end items-center md:gap-10 z-1001"), children: [
|
|
14
|
+
/* @__PURE__ */ r(i, { hideLogin: a, hideNews: t, user: e }),
|
|
15
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(l, { hideNews: t, hideLogin: a, user: e }) })
|
|
16
16
|
] });
|
|
17
17
|
}
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
o as HeaderSource,
|
|
20
20
|
x as default
|
|
21
21
|
};
|
|
@@ -1,18 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import t from "@0xchain/iconfont";
|
|
4
|
+
import n from "@0xchain/tooltip";
|
|
4
5
|
import r from "./SettingBody.js";
|
|
5
|
-
|
|
6
|
+
import { useIsChaindigg as c } from "../context.js";
|
|
7
|
+
function p({ onClick: d = () => {
|
|
6
8
|
} }) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const i = c(), a = (s) => {
|
|
10
|
+
document.querySelectorAll("iframe").forEach((l) => {
|
|
11
|
+
l.style.pointerEvents = s ? "none" : "auto";
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
return i ? /* @__PURE__ */ o("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
15
|
+
/* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-card rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ e(
|
|
16
|
+
n,
|
|
17
|
+
{
|
|
18
|
+
side: "bottom",
|
|
19
|
+
needClick: !0,
|
|
20
|
+
contentClassName: "w-70 rounded-lg bg-card shadow-lg text-foreground border-transparent outline-none",
|
|
21
|
+
trigger: /* @__PURE__ */ e(t, { type: "icon-setting", className: "text-2xl border border-transparent hover:border-border" }),
|
|
22
|
+
arrowClassName: "fill-module",
|
|
23
|
+
children: /* @__PURE__ */ e(r, { onClick: d })
|
|
24
|
+
}
|
|
25
|
+
) }),
|
|
26
|
+
/* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(r, {}) })
|
|
27
|
+
] }) : /* @__PURE__ */ o("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
28
|
+
/* @__PURE__ */ e("div", { className: "hidden md:flex items-center bg-card hover:bg-border rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ e(
|
|
29
|
+
n,
|
|
30
|
+
{
|
|
31
|
+
side: "bottom",
|
|
32
|
+
onChange: a,
|
|
33
|
+
needClick: !0,
|
|
34
|
+
contentClassName: "bg-card w-70 rounded-lg bg-card text-foreground border border-border",
|
|
35
|
+
trigger: /* @__PURE__ */ e(t, { type: "icon-centersetup", className: "text-2xl" }),
|
|
36
|
+
arrowClassName: "fill-card",
|
|
37
|
+
children: /* @__PURE__ */ e(r, { onClick: d })
|
|
38
|
+
}
|
|
39
|
+
) }),
|
|
13
40
|
/* @__PURE__ */ e("div", { className: "md:hidden", children: /* @__PURE__ */ e(r, {}) })
|
|
14
41
|
] });
|
|
15
42
|
}
|
|
16
43
|
export {
|
|
17
|
-
|
|
44
|
+
p as default
|
|
18
45
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { createContext as o, useContext as i } from "react";
|
|
4
|
+
const t = o({
|
|
5
|
+
brand: "iChatGo"
|
|
6
|
+
});
|
|
7
|
+
function C({
|
|
8
|
+
children: e,
|
|
9
|
+
brand: r = "iChatGo"
|
|
10
|
+
}) {
|
|
11
|
+
return /* @__PURE__ */ n(t.Provider, { value: { brand: r }, children: e });
|
|
12
|
+
}
|
|
13
|
+
function a() {
|
|
14
|
+
return i(t);
|
|
15
|
+
}
|
|
16
|
+
function s() {
|
|
17
|
+
const { brand: e } = a();
|
|
18
|
+
return e === "CHAINDIGG";
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
C as HeaderProvider,
|
|
22
|
+
a as useHeaderContext,
|
|
23
|
+
s as useIsChaindigg
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xchain/header",
|
|
3
|
-
"version": "1.1.0-beta.
|
|
3
|
+
"version": "1.1.0-beta.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -24,27 +24,27 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"js-cookie": "3.0.5",
|
|
26
26
|
"lucide-react": "0.539.0",
|
|
27
|
-
"next-intl": "4.
|
|
27
|
+
"next-intl": "4.8.2",
|
|
28
28
|
"@0xchain/next-themes": "1.0.0",
|
|
29
29
|
"rc-drawer": "7.3.0",
|
|
30
30
|
"react": "19.1.1",
|
|
31
31
|
"react-dom": "19.1.1",
|
|
32
32
|
"tailwind-merge": "3.3.1",
|
|
33
|
-
"next": "
|
|
33
|
+
"next": "16.1.6",
|
|
34
34
|
"antd": "6.1.1",
|
|
35
|
-
"@0xchain/avatar": "1.1.0-beta.
|
|
36
|
-
"@0xchain/
|
|
37
|
-
"@0xchain/
|
|
38
|
-
"@0xchain/better-link": "1.1.0-beta.
|
|
39
|
-
"@0xchain/
|
|
40
|
-
"@0xchain/
|
|
41
|
-
"@0xchain/ui": "1.1.0-beta.
|
|
42
|
-
"@0xchain/
|
|
43
|
-
"@0xchain/
|
|
44
|
-
"@0xchain/
|
|
45
|
-
"@0xchain/
|
|
46
|
-
"@0xchain/
|
|
47
|
-
"@0xchain/
|
|
35
|
+
"@0xchain/avatar": "1.1.0-beta.11",
|
|
36
|
+
"@0xchain/image": "1.1.0-beta.11",
|
|
37
|
+
"@0xchain/auth": "1.1.0-beta.11",
|
|
38
|
+
"@0xchain/better-link": "1.1.0-beta.11",
|
|
39
|
+
"@0xchain/link": "1.1.0-beta.11",
|
|
40
|
+
"@0xchain/translation": "1.1.0-beta.11",
|
|
41
|
+
"@0xchain/ui": "1.1.0-beta.11",
|
|
42
|
+
"@0xchain/theme-toggle": "1.1.0-beta.11",
|
|
43
|
+
"@0xchain/iconfont": "1.1.0-beta.11",
|
|
44
|
+
"@0xchain/tooltip": "1.1.0-beta.11",
|
|
45
|
+
"@0xchain/request": "1.1.0-beta.11",
|
|
46
|
+
"@0xchain/token": "1.1.0-beta.11",
|
|
47
|
+
"@0xchain/with-login": "1.1.0-beta.11"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|