@0xchain/header 1.1.0-beta.17 → 1.1.0-beta.19
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/LICENSE +21 -0
- package/dist/index.js +43 -39
- package/dist/lib/Drawer.js +29 -25
- package/dist/lib/Explorer.js +56 -50
- package/dist/lib/Logo.js +53 -49
- package/dist/lib/Nav.js +159 -122
- package/dist/lib/Right.js +20 -15
- package/dist/lib/Setting/SettingBody.js +44 -36
- package/dist/lib/Setting/index.js +36 -32
- package/dist/lib/User/Logout.js +13 -13
- package/dist/lib/User/MainTrigger.js +32 -23
- package/dist/lib/User/Mobile.js +22 -22
- package/dist/lib/User/Pc.js +24 -22
- package/dist/lib/User/SignIn.js +16 -15
- package/dist/lib/User/index.js +22 -20
- package/dist/lib/context.js +15 -15
- package/dist/lib/events.js +16 -14
- package/package.json +36 -22
package/dist/lib/Nav.js
CHANGED
|
@@ -1,167 +1,204 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { twMerge
|
|
8
|
-
import
|
|
9
|
-
import { useLocale
|
|
10
|
-
import
|
|
11
|
-
import { useState
|
|
12
|
-
import
|
|
13
|
-
import { fetchUserProfile
|
|
14
|
-
import { onUserEvent
|
|
15
|
-
import { usePathname
|
|
16
|
-
import
|
|
17
|
-
import { useIsChaindigg
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
const
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import LinkBar from "@0xchain/link";
|
|
4
|
+
import UserControl from "./User/index.js";
|
|
5
|
+
import Setting from "./Setting/index.js";
|
|
6
|
+
import Translation from "@0xchain/translation";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
8
|
+
import BetterLink from "@0xchain/better-link";
|
|
9
|
+
import { useLocale } from "next-intl";
|
|
10
|
+
import Logout from "./User/Logout.js";
|
|
11
|
+
import { useState, useCallback, useEffect } from "react";
|
|
12
|
+
import SignIn from "./User/SignIn.js";
|
|
13
|
+
import { fetchUserProfile } from "@0xchain/auth";
|
|
14
|
+
import { onUserEvent, USER_EVENTS, cleanUserEvent } from "./events.js";
|
|
15
|
+
import { usePathname } from "next/navigation";
|
|
16
|
+
import Explorer from "./Explorer.js";
|
|
17
|
+
import { useIsChaindigg } from "./context.js";
|
|
18
|
+
function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user }) {
|
|
19
|
+
const isChaindigg = useIsChaindigg();
|
|
20
|
+
const { gotoAISQL, gotoChat } = BetterLink();
|
|
21
|
+
const locale = useLocale();
|
|
22
|
+
const pathname = usePathname();
|
|
23
|
+
const [userKey, setUserKey] = useState("");
|
|
24
|
+
const [userInfo, setUserInfo] = useState(user);
|
|
25
|
+
const [explorerExpanded, setExplorerExpanded] = useState(false);
|
|
26
|
+
const ichaingoNavList = [
|
|
21
27
|
{
|
|
22
28
|
baseUrl: process.env.NEXT_PUBLIC_CHAT_URL,
|
|
23
|
-
href:
|
|
24
|
-
key: `/${
|
|
25
|
-
label: /* @__PURE__ */
|
|
26
|
-
show: (
|
|
29
|
+
href: gotoChat({ locale }),
|
|
30
|
+
key: `/${locale}`,
|
|
31
|
+
label: /* @__PURE__ */ jsx("span", { children: "iSearch" }),
|
|
32
|
+
show: (pathname2) => {
|
|
33
|
+
return pathname2 === `/${locale}` || pathname2.includes(`/${locale}/conversation`);
|
|
34
|
+
}
|
|
27
35
|
},
|
|
28
36
|
{
|
|
29
37
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
30
|
-
href:
|
|
38
|
+
href: gotoAISQL({ locale }),
|
|
31
39
|
key: "/sql",
|
|
32
40
|
label: "iSQL",
|
|
33
|
-
show: (
|
|
41
|
+
show: (pathname2) => {
|
|
42
|
+
return pathname2.includes(`/${locale}/sql`);
|
|
43
|
+
}
|
|
34
44
|
},
|
|
35
45
|
{
|
|
36
46
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
37
|
-
href:
|
|
47
|
+
href: `/explorer`,
|
|
38
48
|
key: "/explorer",
|
|
39
|
-
label: /* @__PURE__ */
|
|
40
|
-
show: (
|
|
49
|
+
label: /* @__PURE__ */ jsx(Explorer, { onClick, onExpandChange: setExplorerExpanded }),
|
|
50
|
+
show: (pathname2) => {
|
|
51
|
+
return pathname2.includes(`/explorer`);
|
|
52
|
+
}
|
|
41
53
|
},
|
|
42
54
|
{
|
|
43
55
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
44
|
-
href:
|
|
56
|
+
href: `/news`,
|
|
45
57
|
key: "/news",
|
|
46
|
-
label: /* @__PURE__ */
|
|
47
|
-
show: (
|
|
58
|
+
label: /* @__PURE__ */ jsx(Translation, { value: "news", parentKey: "menu" }),
|
|
59
|
+
show: (pathname2) => {
|
|
60
|
+
return pathname2.includes(`/news`);
|
|
61
|
+
}
|
|
48
62
|
},
|
|
49
63
|
{
|
|
50
64
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
51
|
-
href:
|
|
65
|
+
href: `/ranking/token`,
|
|
52
66
|
key: "/ranking",
|
|
53
|
-
label: /* @__PURE__ */
|
|
54
|
-
show: (
|
|
67
|
+
label: /* @__PURE__ */ jsx(Translation, { value: "ranking", parentKey: "menu" }),
|
|
68
|
+
show: (pathname2) => {
|
|
69
|
+
return pathname2.includes(`/ranking`);
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
|
-
]
|
|
72
|
+
]?.filter((item) => {
|
|
73
|
+
if (hideNews) {
|
|
74
|
+
return !["/explorer", "/chat", "/sql"].includes(item.key);
|
|
75
|
+
}
|
|
76
|
+
return true;
|
|
77
|
+
});
|
|
78
|
+
const chaindiggNavList = [
|
|
57
79
|
{
|
|
58
80
|
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
59
|
-
href:
|
|
81
|
+
href: `/explorer`,
|
|
60
82
|
key: "/explorer",
|
|
61
|
-
label: /* @__PURE__ */
|
|
62
|
-
show: (
|
|
83
|
+
label: /* @__PURE__ */ jsx(Explorer, {}),
|
|
84
|
+
show: (pathname2) => {
|
|
85
|
+
return pathname2.includes(`/explorer`);
|
|
86
|
+
}
|
|
63
87
|
}
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
];
|
|
89
|
+
const NavList = isChaindigg ? chaindiggNavList : ichaingoNavList;
|
|
90
|
+
const updateUserInfo = useCallback(() => {
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
fetchUserProfile().then((res) => {
|
|
93
|
+
setUserInfo(res);
|
|
94
|
+
setUserKey((/* @__PURE__ */ new Date()).getTime().toString());
|
|
95
|
+
resolve(res);
|
|
96
|
+
});
|
|
67
97
|
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
}
|
|
98
|
+
}, []);
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
if (isChaindigg) return;
|
|
101
|
+
onUserEvent(USER_EVENTS.PROFILE_UPDATED, updateUserInfo);
|
|
102
|
+
return () => {
|
|
103
|
+
cleanUserEvent(USER_EVENTS.PROFILE_UPDATED, updateUserInfo);
|
|
104
|
+
};
|
|
105
|
+
}, [isChaindigg]);
|
|
106
|
+
if (isChaindigg) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(
|
|
108
|
+
"nav",
|
|
109
|
+
{
|
|
110
|
+
className: twMerge(
|
|
111
|
+
"flex flex-col justify-start items-start md:px-3",
|
|
112
|
+
"md:flex-row md:justify-end md:items-start md:px-0",
|
|
113
|
+
"md:gap-6"
|
|
113
114
|
),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
"ul",
|
|
118
|
+
{
|
|
119
|
+
className: twMerge(
|
|
120
|
+
"flex flex-col justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-foreground",
|
|
121
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-6",
|
|
122
|
+
"order-2 md:order-0"
|
|
123
|
+
),
|
|
124
|
+
children: NavList.map((item, index) => /* @__PURE__ */ jsx(
|
|
125
|
+
"li",
|
|
126
|
+
{
|
|
127
|
+
className: twMerge(
|
|
128
|
+
"w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary",
|
|
129
|
+
item.show(pathname) && "border-b-2 border-primary text-primary"
|
|
130
|
+
),
|
|
131
|
+
children: item.href === pathname ? item.label : /* @__PURE__ */ jsx(
|
|
132
|
+
LinkBar,
|
|
133
|
+
{
|
|
134
|
+
href: item.href,
|
|
135
|
+
onClick,
|
|
136
|
+
className: "h-full flex items-center justify-start",
|
|
137
|
+
baseUrl: item.baseUrl,
|
|
138
|
+
suppressHydrationWarning: true,
|
|
139
|
+
children: item.label
|
|
140
|
+
}
|
|
141
|
+
)
|
|
142
|
+
},
|
|
143
|
+
index
|
|
144
|
+
))
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ jsx(Setting, { onClick })
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
return /* @__PURE__ */ jsxs(
|
|
118
153
|
"nav",
|
|
119
154
|
{
|
|
120
|
-
className:
|
|
155
|
+
className: twMerge(
|
|
121
156
|
"flex flex-col justify-start items-start md:px-3",
|
|
122
157
|
"md:flex-row md:justify-end md:items-center md:px-0",
|
|
123
158
|
"md:gap-4"
|
|
124
159
|
),
|
|
125
160
|
children: [
|
|
126
|
-
/* @__PURE__ */
|
|
161
|
+
/* @__PURE__ */ jsx(
|
|
127
162
|
"ul",
|
|
128
163
|
{
|
|
129
|
-
className:
|
|
164
|
+
className: twMerge(
|
|
130
165
|
"flex flex-col justify-start items-start w-full h-full text-sm z-1001 text-foreground",
|
|
131
166
|
"md:flex-row md:items-center md:w-auto md:h-[34px] md:gap-6",
|
|
132
167
|
"order-2 md:order-0"
|
|
133
168
|
),
|
|
134
|
-
children:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
169
|
+
children: NavList.map((item, index) => {
|
|
170
|
+
return /* @__PURE__ */ jsx(
|
|
171
|
+
"li",
|
|
172
|
+
{
|
|
173
|
+
className: twMerge(
|
|
174
|
+
"w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full",
|
|
175
|
+
item.key === "/explorer" ? "h-auto" : "h-11",
|
|
176
|
+
item.show(pathname) ? "md:text-primary md:bg-primary/20" : "md:hover:bg-border"
|
|
177
|
+
),
|
|
178
|
+
children: item.href === pathname ? item.label : /* @__PURE__ */ jsx(
|
|
179
|
+
LinkBar,
|
|
180
|
+
{
|
|
181
|
+
href: item.href,
|
|
182
|
+
onClick,
|
|
183
|
+
className: "h-full flex items-center justify-start",
|
|
184
|
+
baseUrl: item.baseUrl,
|
|
185
|
+
suppressHydrationWarning: true,
|
|
186
|
+
children: item.label
|
|
187
|
+
}
|
|
188
|
+
)
|
|
189
|
+
},
|
|
190
|
+
index
|
|
191
|
+
);
|
|
192
|
+
})
|
|
156
193
|
}
|
|
157
194
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
!
|
|
160
|
-
/* @__PURE__ */
|
|
161
|
-
|
|
162
|
-
|
|
195
|
+
/* @__PURE__ */ jsx(Setting, { onClick }),
|
|
196
|
+
!pathname.includes("/login") && !hideLogin ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
197
|
+
/* @__PURE__ */ jsx(UserControl, { onClick, userInfo }, userKey),
|
|
198
|
+
userInfo?.id ? /* @__PURE__ */ jsx("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__ */ jsx(Logout, {}) }) : /* @__PURE__ */ jsx(
|
|
199
|
+
SignIn,
|
|
163
200
|
{
|
|
164
|
-
onClick
|
|
201
|
+
onClick,
|
|
165
202
|
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
203
|
}
|
|
167
204
|
)
|
|
@@ -171,5 +208,5 @@ function le({ onClick: t = () => {
|
|
|
171
208
|
);
|
|
172
209
|
}
|
|
173
210
|
export {
|
|
174
|
-
|
|
211
|
+
Nav as default
|
|
175
212
|
};
|
package/dist/lib/Right.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
|
-
import { jsxs
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { twMerge
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import Nav from "./Nav.js";
|
|
3
|
+
import Drawer from "./Drawer.js";
|
|
4
|
+
import { twMerge } from "tailwind-merge";
|
|
5
|
+
var HeaderSource = /* @__PURE__ */ ((HeaderSource2) => {
|
|
6
|
+
HeaderSource2["EXPLORER"] = "explorer";
|
|
7
|
+
HeaderSource2["CHAT"] = "chat";
|
|
8
|
+
HeaderSource2["DEFAULT"] = "default";
|
|
9
|
+
return HeaderSource2;
|
|
10
|
+
})(HeaderSource || {});
|
|
11
|
+
function Right({
|
|
12
|
+
hideNews = false,
|
|
13
|
+
hideLogin = false,
|
|
14
|
+
user,
|
|
15
|
+
source = "default"
|
|
11
16
|
/* DEFAULT */
|
|
12
17
|
}) {
|
|
13
|
-
return /* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(source === "chat" ? "" : "flex justify-end items-center md:gap-10 z-1001"), children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Drawer, { hideLogin, hideNews, user }),
|
|
20
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(Nav, { hideNews, hideLogin, user }) })
|
|
16
21
|
] });
|
|
17
22
|
}
|
|
18
23
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
24
|
+
HeaderSource,
|
|
25
|
+
Right as default
|
|
21
26
|
};
|
|
@@ -1,56 +1,64 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs
|
|
3
|
-
import { useLocale
|
|
4
|
-
import { useSearchParams
|
|
5
|
-
import { Accordion
|
|
6
|
-
import { twMerge
|
|
7
|
-
import { useCallback
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useLocale, useTranslations } from "next-intl";
|
|
4
|
+
import { useSearchParams, usePathname } from "next/navigation";
|
|
5
|
+
import { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "@0xchain/ui/accordion";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { useCallback } from "react";
|
|
8
|
+
import LinkBar from "@0xchain/link";
|
|
9
|
+
import ThemeToggle from "@0xchain/theme-toggle";
|
|
10
|
+
function SettingBody({ onClick = () => void 0 }) {
|
|
11
|
+
const locale = useLocale();
|
|
12
|
+
const params = useSearchParams();
|
|
13
|
+
const t = useTranslations("lang");
|
|
14
|
+
const tSetting = useTranslations("setting");
|
|
15
|
+
const supportedLanguages = [
|
|
14
16
|
{ name: t("en"), lang: "en" },
|
|
15
17
|
{ name: t("ja"), lang: "ja" },
|
|
16
18
|
{ name: t("ko"), lang: "ko" },
|
|
17
19
|
{ name: t("zh-hant"), lang: "zh-hant" },
|
|
18
20
|
{ name: t("zh-hans"), lang: "zh-hans" }
|
|
19
|
-
]
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
];
|
|
22
|
+
const pathname = usePathname();
|
|
23
|
+
const generateLanguageUrl = useCallback(
|
|
24
|
+
(newLang) => {
|
|
25
|
+
const newUrl = pathname.replace(new RegExp(`/${locale}(/|$)`), `/${newLang}$1`);
|
|
26
|
+
const search = params.toString();
|
|
27
|
+
if (search) {
|
|
28
|
+
return `${newUrl}?${search}`;
|
|
29
|
+
}
|
|
30
|
+
return newUrl;
|
|
23
31
|
},
|
|
24
|
-
[
|
|
32
|
+
[pathname, locale, params]
|
|
25
33
|
);
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
/* @__PURE__ */
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsxs("div", { className: "text-sm gap-2 flex flex-col justify-start items-start md:py-2", children: [
|
|
35
|
+
/* @__PURE__ */ jsx("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ jsx(Accordion, { type: "single", className: "flex-1", collapsible: true, children: /* @__PURE__ */ jsxs(AccordionItem, { value: locale, className: "border-0", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(AccordionTrigger, { className: "p-2 bg-background rounded-lg h-11 md:h-auto text-gray-500 w-full flex py-2 justify-between items-center hover:no-underline focus-visible:ring-0 focus-visible:ring-offset-0", children: /* @__PURE__ */ jsxs("div", { className: "flex w-full justify-between items-center", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: tSetting("language") }),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "text-foreground", children: supportedLanguages.find((item) => item.lang === locale)?.name })
|
|
31
39
|
] }) }),
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
40
|
+
/* @__PURE__ */ jsx(AccordionContent, { className: "bg-background mt-3 rounded-lg flex flex-col gap-2", children: supportedLanguages.map((item) => /* @__PURE__ */ jsx(
|
|
41
|
+
LinkBar,
|
|
34
42
|
{
|
|
35
|
-
prefetch:
|
|
36
|
-
withLocale:
|
|
37
|
-
className:
|
|
43
|
+
prefetch: false,
|
|
44
|
+
withLocale: false,
|
|
45
|
+
className: twMerge(
|
|
38
46
|
"p-2 rounded-lg flex w-full justify-between items-center",
|
|
39
|
-
|
|
47
|
+
locale === item.lang ? "text-primary" : ""
|
|
40
48
|
),
|
|
41
|
-
href:
|
|
42
|
-
onClick
|
|
43
|
-
children:
|
|
49
|
+
href: generateLanguageUrl(item.lang),
|
|
50
|
+
onClick,
|
|
51
|
+
children: item.name
|
|
44
52
|
},
|
|
45
|
-
|
|
53
|
+
item.lang
|
|
46
54
|
)) })
|
|
47
55
|
] }) }) }),
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-background p-2 rounded-lg h-11 md:h-auto flex w-full justify-between items-center", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("div", { children: tSetting("theme") }),
|
|
58
|
+
/* @__PURE__ */ jsx(ThemeToggle, {})
|
|
51
59
|
] })
|
|
52
60
|
] });
|
|
53
61
|
}
|
|
54
62
|
export {
|
|
55
|
-
|
|
63
|
+
SettingBody as default
|
|
56
64
|
};
|
|
@@ -1,45 +1,49 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsxs
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { useIsChaindigg
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
document.querySelectorAll("iframe")
|
|
11
|
-
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import IconFont from "@0xchain/iconfont";
|
|
4
|
+
import Tooltip from "@0xchain/tooltip";
|
|
5
|
+
import SettingBody from "./SettingBody.js";
|
|
6
|
+
import { useIsChaindigg } from "../context.js";
|
|
7
|
+
function Setting({ onClick = () => void 0 }) {
|
|
8
|
+
const isChaindigg = useIsChaindigg();
|
|
9
|
+
const onChange = (open) => {
|
|
10
|
+
const iframes = document.querySelectorAll("iframe");
|
|
11
|
+
iframes.forEach((iframe) => {
|
|
12
|
+
iframe.style.pointerEvents = open ? "none" : "auto";
|
|
12
13
|
});
|
|
13
14
|
};
|
|
14
|
-
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
|
|
15
|
+
if (isChaindigg) {
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
17
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center bg-card rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
18
|
+
Tooltip,
|
|
19
|
+
{
|
|
20
|
+
side: "bottom",
|
|
21
|
+
needClick: true,
|
|
22
|
+
contentClassName: "w-70 rounded-lg bg-card shadow-lg text-foreground border-transparent outline-none",
|
|
23
|
+
trigger: /* @__PURE__ */ jsx(IconFont, { type: "icon-setting", className: "text-2xl border border-transparent hover:border-border" }),
|
|
24
|
+
arrowClassName: "fill-module",
|
|
25
|
+
children: /* @__PURE__ */ jsx(SettingBody, { onClick })
|
|
26
|
+
}
|
|
27
|
+
) }),
|
|
28
|
+
/* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx(SettingBody, {}) })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
return /* @__PURE__ */ jsxs("div", { className: "w-full md:w-auto order-3 md:order-0", children: [
|
|
32
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:flex items-center bg-card hover:bg-border rounded-lg p-1.5 cursor-pointer", children: /* @__PURE__ */ jsx(
|
|
33
|
+
Tooltip,
|
|
17
34
|
{
|
|
18
35
|
side: "bottom",
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
36
|
+
onChange,
|
|
37
|
+
needClick: true,
|
|
34
38
|
contentClassName: "bg-card w-70 rounded-lg bg-card text-foreground border border-border",
|
|
35
|
-
trigger: /* @__PURE__ */
|
|
39
|
+
trigger: /* @__PURE__ */ jsx(IconFont, { type: "icon-centersetup", className: "text-2xl" }),
|
|
36
40
|
arrowClassName: "fill-card",
|
|
37
|
-
children: /* @__PURE__ */
|
|
41
|
+
children: /* @__PURE__ */ jsx(SettingBody, { onClick })
|
|
38
42
|
}
|
|
39
43
|
) }),
|
|
40
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx(SettingBody, {}) })
|
|
41
45
|
] });
|
|
42
46
|
}
|
|
43
47
|
export {
|
|
44
|
-
|
|
48
|
+
Setting as default
|
|
45
49
|
};
|
package/dist/lib/User/Logout.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx
|
|
3
|
-
import { logout
|
|
4
|
-
import { useCallback
|
|
5
|
-
import { twMerge
|
|
6
|
-
import
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
await
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { logout } from "@0xchain/auth";
|
|
4
|
+
import { useCallback } from "react";
|
|
5
|
+
import { twMerge } from "tailwind-merge";
|
|
6
|
+
import Translation from "@0xchain/translation";
|
|
7
|
+
function Logout({ className }) {
|
|
8
|
+
const logoutHandler = useCallback(async () => {
|
|
9
|
+
await logout();
|
|
10
10
|
}, []);
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ jsx(
|
|
12
12
|
"button",
|
|
13
13
|
{
|
|
14
|
-
onClick:
|
|
15
|
-
className:
|
|
16
|
-
children: /* @__PURE__ */
|
|
14
|
+
onClick: logoutHandler,
|
|
15
|
+
className: twMerge("cursor-pointer relative", className),
|
|
16
|
+
children: /* @__PURE__ */ jsx(Translation, { value: "logout", parentKey: "account" })
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
21
|
+
Logout as default
|
|
22
22
|
};
|