@0xchain/header 1.1.0-beta.52 → 1.1.0-beta.54
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/Explorer.js +1 -1
- package/dist/lib/Logo.js +1 -1
- package/dist/lib/Nav.js +28 -13
- package/dist/lib/Products.js +1 -1
- package/package.json +14 -14
package/dist/lib/Explorer.js
CHANGED
|
@@ -26,7 +26,7 @@ function Explorer({ onClick = () => void 0, onExpandChange }) {
|
|
|
26
26
|
onClick?.();
|
|
27
27
|
setAccordionValue("");
|
|
28
28
|
const url = gotoExplorer({ chain: item.chainSymbol });
|
|
29
|
-
const baseUrl = process.env.
|
|
29
|
+
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "";
|
|
30
30
|
window.location.href = `${baseUrl}${url}`;
|
|
31
31
|
};
|
|
32
32
|
useEffect(() => {
|
package/dist/lib/Logo.js
CHANGED
|
@@ -48,7 +48,7 @@ function Logo() {
|
|
|
48
48
|
{
|
|
49
49
|
suppressHydrationWarning: true,
|
|
50
50
|
href: `/`,
|
|
51
|
-
baseUrl: process.env.
|
|
51
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
52
52
|
className: twMerge("w-auto shrink-0 block cursor-pointer"),
|
|
53
53
|
children: [
|
|
54
54
|
/* @__PURE__ */ jsx(
|
package/dist/lib/Nav.js
CHANGED
|
@@ -16,7 +16,6 @@ import { usePathname } from "next/navigation";
|
|
|
16
16
|
import Explorer from "./Explorer.js";
|
|
17
17
|
import Products from "./Products.js";
|
|
18
18
|
import { useIsChaindigg } from "./context.js";
|
|
19
|
-
import request from "@0xchain/request";
|
|
20
19
|
function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user }) {
|
|
21
20
|
const isChaindigg = useIsChaindigg();
|
|
22
21
|
const { gotoAISQL, gotoChat } = BetterLink();
|
|
@@ -36,7 +35,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
36
35
|
}
|
|
37
36
|
},
|
|
38
37
|
{
|
|
39
|
-
baseUrl: process.env.
|
|
38
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
40
39
|
href: gotoAISQL({ locale }),
|
|
41
40
|
key: "/query",
|
|
42
41
|
label: "iQuery",
|
|
@@ -45,7 +44,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
45
44
|
}
|
|
46
45
|
},
|
|
47
46
|
{
|
|
48
|
-
baseUrl: process.env.
|
|
47
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
49
48
|
key: "/explorer",
|
|
50
49
|
href: "/explorer",
|
|
51
50
|
label: /* @__PURE__ */ jsx(Explorer, { onClick, onExpandChange: setExplorerExpanded }),
|
|
@@ -54,7 +53,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
54
53
|
}
|
|
55
54
|
},
|
|
56
55
|
{
|
|
57
|
-
baseUrl: process.env.
|
|
56
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
58
57
|
key: "/products",
|
|
59
58
|
label: /* @__PURE__ */ jsx(Products, { onClick }),
|
|
60
59
|
show: (pathname2) => {
|
|
@@ -62,7 +61,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
62
61
|
}
|
|
63
62
|
},
|
|
64
63
|
{
|
|
65
|
-
baseUrl: process.env.
|
|
64
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
66
65
|
href: `/learn`,
|
|
67
66
|
key: "/learn",
|
|
68
67
|
label: /* @__PURE__ */ jsx(Translation, { value: "learn", parentKey: "menu" }),
|
|
@@ -71,7 +70,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
71
70
|
}
|
|
72
71
|
},
|
|
73
72
|
{
|
|
74
|
-
baseUrl: process.env.
|
|
73
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
75
74
|
href: `/news`,
|
|
76
75
|
key: "/news",
|
|
77
76
|
label: /* @__PURE__ */ jsx(Translation, { value: "news", parentKey: "menu" }),
|
|
@@ -80,7 +79,7 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
80
79
|
}
|
|
81
80
|
},
|
|
82
81
|
{
|
|
83
|
-
baseUrl: process.env.
|
|
82
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
84
83
|
href: `/ranking`,
|
|
85
84
|
key: "/ranking",
|
|
86
85
|
label: /* @__PURE__ */ jsx(Translation, { value: "ranking", parentKey: "menu" }),
|
|
@@ -106,12 +105,19 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
106
105
|
const NavList = isChaindigg ? chaindiggNavList : ichaingoNavList;
|
|
107
106
|
const updateUserInfo = useCallback(async () => {
|
|
108
107
|
try {
|
|
109
|
-
const
|
|
110
|
-
|
|
108
|
+
const appUrl = (process.env.NEXT_PUBLIC_APP_URL || "").replace(/\/$/, "");
|
|
109
|
+
const profileUrl = appUrl ? `${appUrl}/api/auth/profile` : "/api/auth/profile";
|
|
110
|
+
const response = await fetch(profileUrl, {
|
|
111
|
+
credentials: "include",
|
|
112
|
+
cache: "no-store"
|
|
111
113
|
});
|
|
112
|
-
|
|
114
|
+
if (!response.ok) {
|
|
115
|
+
throw new Error(`Failed to load profile: ${response.status}`);
|
|
116
|
+
}
|
|
117
|
+
const profile = await response.json();
|
|
118
|
+
setUserInfo(profile || {});
|
|
113
119
|
setUserKey((/* @__PURE__ */ new Date()).getTime().toString());
|
|
114
|
-
return
|
|
120
|
+
return profile;
|
|
115
121
|
} catch (error) {
|
|
116
122
|
console.error(error);
|
|
117
123
|
setUserInfo({});
|
|
@@ -160,7 +166,11 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
160
166
|
{
|
|
161
167
|
href: item.href,
|
|
162
168
|
onClick,
|
|
163
|
-
className:
|
|
169
|
+
className: twMerge(
|
|
170
|
+
"w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary",
|
|
171
|
+
item.show(pathname) && "border-b-2 border-primary text-primary",
|
|
172
|
+
"h-full flex items-center justify-start"
|
|
173
|
+
),
|
|
164
174
|
baseUrl: item.baseUrl,
|
|
165
175
|
suppressHydrationWarning: true,
|
|
166
176
|
children: item.label
|
|
@@ -207,7 +217,12 @@ function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user
|
|
|
207
217
|
{
|
|
208
218
|
href: item.href,
|
|
209
219
|
onClick,
|
|
210
|
-
className:
|
|
220
|
+
className: twMerge(
|
|
221
|
+
"w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full",
|
|
222
|
+
item.key === "/explorer" || item.key === "/products" ? "h-auto" : "h-11",
|
|
223
|
+
item.show(pathname) ? "md:text-primary md:bg-primary/10" : "md:hover:bg-border",
|
|
224
|
+
"h-full flex items-center justify-start"
|
|
225
|
+
),
|
|
211
226
|
baseUrl: item.baseUrl,
|
|
212
227
|
suppressHydrationWarning: true,
|
|
213
228
|
children: item.label
|
package/dist/lib/Products.js
CHANGED
|
@@ -23,7 +23,7 @@ function Products({
|
|
|
23
23
|
e?.stopPropagation();
|
|
24
24
|
onClick?.();
|
|
25
25
|
setAccordionValue("");
|
|
26
|
-
const baseUrl = process.env.
|
|
26
|
+
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "";
|
|
27
27
|
window.location.href = `${baseUrl}/${locale}${href}`;
|
|
28
28
|
};
|
|
29
29
|
const renderItemContent = (item) => /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium", children: item.label });
|
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.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -42,19 +42,19 @@
|
|
|
42
42
|
"tailwind-merge": "3.3.1"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@0xchain/
|
|
46
|
-
"@0xchain/
|
|
47
|
-
"@0xchain/
|
|
48
|
-
"@0xchain/
|
|
49
|
-
"@0xchain/
|
|
50
|
-
"@0xchain/
|
|
51
|
-
"@0xchain/
|
|
52
|
-
"@0xchain/
|
|
53
|
-
"@0xchain/
|
|
54
|
-
"@0xchain/
|
|
55
|
-
"@0xchain/
|
|
56
|
-
"@0xchain/
|
|
57
|
-
"@0xchain/tooltip": "1.1.0-beta.
|
|
45
|
+
"@0xchain/auth": "1.1.0-beta.53",
|
|
46
|
+
"@0xchain/better-link": "1.1.0-beta.53",
|
|
47
|
+
"@0xchain/with-login": "1.1.0-beta.53",
|
|
48
|
+
"@0xchain/image": "1.1.0-beta.54",
|
|
49
|
+
"@0xchain/i18n": "1.1.0-beta.54",
|
|
50
|
+
"@0xchain/request": "1.1.0-beta.54",
|
|
51
|
+
"@0xchain/link": "1.1.0-beta.54",
|
|
52
|
+
"@0xchain/avatar": "1.1.0-beta.54",
|
|
53
|
+
"@0xchain/iconfont": "1.1.0-beta.54",
|
|
54
|
+
"@0xchain/translation": "1.1.0-beta.54",
|
|
55
|
+
"@0xchain/theme-toggle": "1.1.0-beta.54",
|
|
56
|
+
"@0xchain/ui": "1.1.0-beta.54",
|
|
57
|
+
"@0xchain/tooltip": "1.1.0-beta.54"
|
|
58
58
|
},
|
|
59
59
|
"nx": {
|
|
60
60
|
"tags": [
|