@0xchain/header 1.1.0-beta.9 → 1.1.0-beta.90
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 +45 -39
- package/dist/lib/Drawer.js +29 -25
- package/dist/lib/Explorer.js +61 -50
- package/dist/lib/Logo.js +61 -46
- package/dist/lib/Nav.js +178 -132
- package/dist/lib/PointsEntry.js +51 -0
- package/dist/lib/Products.js +102 -0
- package/dist/lib/Right.js +29 -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 +33 -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 +31 -20
- package/dist/lib/authProfile.js +34 -0
- package/dist/lib/context.js +15 -15
- package/dist/lib/events.js +13 -15
- package/dist/lib/headerPoints.js +19 -0
- package/dist/lib/useHeaderUser.js +44 -0
- package/package.json +38 -22
package/dist/lib/Nav.js
CHANGED
|
@@ -1,167 +1,213 @@
|
|
|
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 {
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { useIsChaindigg
|
|
18
|
-
|
|
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 "@0xchain/i18n/react";
|
|
10
|
+
import Logout from "./User/Logout.js";
|
|
11
|
+
import { useState } from "react";
|
|
12
|
+
import SignIn from "./User/SignIn.js";
|
|
13
|
+
import { usePathname } from "next/navigation";
|
|
14
|
+
import Explorer from "./Explorer.js";
|
|
15
|
+
import Products from "./Products.js";
|
|
16
|
+
import PointsEntry from "./PointsEntry.js";
|
|
17
|
+
import { useIsChaindigg } from "./context.js";
|
|
18
|
+
import { useHeaderUser } from "./useHeaderUser.js";
|
|
19
|
+
function Nav({ onClick = () => void 0, hideNews = false, hideLogin = false, user }) {
|
|
20
|
+
const isChaindigg = useIsChaindigg();
|
|
21
|
+
const { gotoAISQL, gotoChat } = BetterLink();
|
|
22
|
+
const locale = useLocale();
|
|
23
|
+
const pathname = usePathname();
|
|
24
|
+
const { userInfo, hasUserProfile, userKey } = useHeaderUser(user);
|
|
25
|
+
const [, 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
|
-
baseUrl: process.env.
|
|
30
|
-
href:
|
|
31
|
-
key: "/
|
|
32
|
-
label: "
|
|
33
|
-
show: (
|
|
37
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
38
|
+
href: gotoAISQL({ locale }),
|
|
39
|
+
key: "/query",
|
|
40
|
+
label: "iQuery",
|
|
41
|
+
show: (pathname2) => {
|
|
42
|
+
return pathname2.includes(`/${locale}/query`);
|
|
43
|
+
}
|
|
34
44
|
},
|
|
35
45
|
{
|
|
36
|
-
baseUrl: process.env.
|
|
37
|
-
href: "/explorer",
|
|
46
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
38
47
|
key: "/explorer",
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
href: "/explorer",
|
|
49
|
+
label: /* @__PURE__ */ jsx(Explorer, { onClick, onExpandChange: setExplorerExpanded }),
|
|
50
|
+
show: (pathname2) => {
|
|
51
|
+
return pathname2.includes(`/explorer`);
|
|
52
|
+
}
|
|
41
53
|
},
|
|
42
54
|
{
|
|
43
|
-
baseUrl: process.env.
|
|
44
|
-
href:
|
|
55
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
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
|
-
baseUrl: process.env.
|
|
51
|
-
href:
|
|
64
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
65
|
+
href: `/ranking`,
|
|
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
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
74
|
+
href: `/learn`,
|
|
75
|
+
key: "/learn",
|
|
76
|
+
label: /* @__PURE__ */ jsx(Translation, { value: "learn", parentKey: "menu" }),
|
|
77
|
+
show: (pathname2) => {
|
|
78
|
+
return pathname2.includes(`/learn`);
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
baseUrl: process.env.NEXT_PUBLIC_APP_URL,
|
|
83
|
+
key: "/products",
|
|
84
|
+
label: /* @__PURE__ */ jsx(Products, { onClick }),
|
|
85
|
+
show: (pathname2) => {
|
|
86
|
+
return pathname2.includes("/widget");
|
|
87
|
+
}
|
|
55
88
|
}
|
|
56
|
-
]
|
|
89
|
+
]?.filter((item) => {
|
|
90
|
+
if (hideNews) {
|
|
91
|
+
return !["/explorer", "/chat", "/query"].includes(item.key);
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
});
|
|
95
|
+
const chaindiggNavList = [
|
|
57
96
|
{
|
|
58
|
-
baseUrl: process.env.NEXT_PUBLIC_BASE_URL,
|
|
59
|
-
href: "/explorer",
|
|
60
97
|
key: "/explorer",
|
|
61
|
-
label: /* @__PURE__ */
|
|
62
|
-
show: (
|
|
98
|
+
label: /* @__PURE__ */ jsx(Explorer, {}),
|
|
99
|
+
show: (pathname2) => {
|
|
100
|
+
return pathname2.includes(`/explorer`);
|
|
101
|
+
}
|
|
63
102
|
}
|
|
64
|
-
]
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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
|
-
}
|
|
103
|
+
];
|
|
104
|
+
const NavList = isChaindigg ? chaindiggNavList : ichaingoNavList;
|
|
105
|
+
if (isChaindigg) {
|
|
106
|
+
return /* @__PURE__ */ jsxs(
|
|
107
|
+
"nav",
|
|
108
|
+
{
|
|
109
|
+
className: twMerge(
|
|
110
|
+
"flex flex-col justify-start items-start md:px-3",
|
|
111
|
+
"md:flex-row md:justify-start md:items-start md:px-0",
|
|
112
|
+
"md:gap-6"
|
|
113
113
|
),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"ul",
|
|
117
|
+
{
|
|
118
|
+
className: twMerge(
|
|
119
|
+
"flex flex-col flex-1 justify-start items-start w-full h-full text-sm leading-[44px] z-1001 text-foreground",
|
|
120
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:leading-[34px] md:gap-5",
|
|
121
|
+
"order-2 md:order-0"
|
|
122
|
+
),
|
|
123
|
+
children: NavList.map((item, index) => /* @__PURE__ */ jsx(
|
|
124
|
+
"li",
|
|
125
|
+
{
|
|
126
|
+
className: twMerge(
|
|
127
|
+
"w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary",
|
|
128
|
+
item.show(pathname) && "border-b-2 border-primary text-primary"
|
|
129
|
+
),
|
|
130
|
+
children: !item.href || item.href === pathname ? item.label : /* @__PURE__ */ jsx(
|
|
131
|
+
LinkBar,
|
|
132
|
+
{
|
|
133
|
+
href: item.href,
|
|
134
|
+
onClick,
|
|
135
|
+
className: twMerge(
|
|
136
|
+
"w-full md:w-auto h-11 md:h-auto cursor-pointer hover:text-primary",
|
|
137
|
+
item.show(pathname) && "border-b-2 border-primary text-primary",
|
|
138
|
+
"h-full flex items-center justify-start"
|
|
139
|
+
),
|
|
140
|
+
baseUrl: item.baseUrl,
|
|
141
|
+
suppressHydrationWarning: true,
|
|
142
|
+
children: item.label
|
|
143
|
+
}
|
|
144
|
+
)
|
|
145
|
+
},
|
|
146
|
+
index
|
|
147
|
+
))
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
/* @__PURE__ */ jsx(Setting, { onClick })
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
return /* @__PURE__ */ jsxs(
|
|
118
156
|
"nav",
|
|
119
157
|
{
|
|
120
|
-
className:
|
|
158
|
+
className: twMerge(
|
|
121
159
|
"flex flex-col justify-start items-start md:px-3",
|
|
122
|
-
"md:flex-row md:justify-end md:items-center md:px-0",
|
|
160
|
+
"md:flex-row md:justify-end md:items-center md:px-0 md:flex-1",
|
|
123
161
|
"md:gap-4"
|
|
124
162
|
),
|
|
125
163
|
children: [
|
|
126
|
-
/* @__PURE__ */
|
|
164
|
+
/* @__PURE__ */ jsx(
|
|
127
165
|
"ul",
|
|
128
166
|
{
|
|
129
|
-
className:
|
|
167
|
+
className: twMerge(
|
|
130
168
|
"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",
|
|
169
|
+
"md:flex-row md:items-center md:w-auto md:h-[34px] md:gap-6 md:flex-1",
|
|
132
170
|
"order-2 md:order-0"
|
|
133
171
|
),
|
|
134
|
-
children:
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
172
|
+
children: NavList.map((item, index) => {
|
|
173
|
+
return /* @__PURE__ */ jsx(
|
|
174
|
+
"li",
|
|
175
|
+
{
|
|
176
|
+
className: twMerge(
|
|
177
|
+
"w-full md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full",
|
|
178
|
+
item.key === "/explorer" || item.key === "/products" ? "h-auto" : "h-11",
|
|
179
|
+
item.show(pathname) ? "md:text-primary md:bg-primary/10" : "md:hover:bg-border"
|
|
180
|
+
),
|
|
181
|
+
children: !item.href || item.href === pathname ? item.label : /* @__PURE__ */ jsx(
|
|
182
|
+
LinkBar,
|
|
183
|
+
{
|
|
184
|
+
href: item.href,
|
|
185
|
+
onClick,
|
|
186
|
+
className: twMerge(
|
|
187
|
+
"w-full md:px-4 md:py-1 md:h-auto font-bold md:w-auto cursor-pointer md:rounded-full",
|
|
188
|
+
item.key === "/explorer" || item.key === "/products" ? "h-auto" : "h-11",
|
|
189
|
+
item.show(pathname) ? "md:text-primary md:bg-primary/10" : "md:hover:bg-border",
|
|
190
|
+
"h-full flex items-center justify-start"
|
|
191
|
+
),
|
|
192
|
+
baseUrl: item.baseUrl,
|
|
193
|
+
suppressHydrationWarning: true,
|
|
194
|
+
children: item.label
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
index
|
|
199
|
+
);
|
|
200
|
+
})
|
|
156
201
|
}
|
|
157
202
|
),
|
|
158
|
-
/* @__PURE__ */
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
203
|
+
!pathname.includes("/login") && !hideLogin ? /* @__PURE__ */ jsx(PointsEntry, { userInfo, className: "hidden md:inline-flex", onClick }) : null,
|
|
204
|
+
/* @__PURE__ */ jsx(Setting, { onClick }),
|
|
205
|
+
!pathname.includes("/login") && !hideLogin ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
206
|
+
/* @__PURE__ */ jsx(UserControl, { onClick, userInfo }, userKey),
|
|
207
|
+
hasUserProfile ? /* @__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(
|
|
208
|
+
SignIn,
|
|
163
209
|
{
|
|
164
|
-
onClick
|
|
210
|
+
onClick,
|
|
165
211
|
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
212
|
}
|
|
167
213
|
)
|
|
@@ -171,5 +217,5 @@ function le({ onClick: t = () => {
|
|
|
171
217
|
);
|
|
172
218
|
}
|
|
173
219
|
export {
|
|
174
|
-
|
|
220
|
+
Nav as default
|
|
175
221
|
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import LinkBar from "@0xchain/link";
|
|
4
|
+
import Translation from "@0xchain/translation";
|
|
5
|
+
import ImageBar from "@0xchain/image";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { hasProfileIdentity } from "./authProfile.js";
|
|
8
|
+
import { HEADER_POINTS_ICON, formatHeaderPoints } from "./headerPoints.js";
|
|
9
|
+
import { useIsChaindigg } from "./context.js";
|
|
10
|
+
function PointsEntry({
|
|
11
|
+
userInfo,
|
|
12
|
+
className,
|
|
13
|
+
onClick
|
|
14
|
+
}) {
|
|
15
|
+
const isChaindigg = useIsChaindigg();
|
|
16
|
+
if (isChaindigg || !hasProfileIdentity(userInfo)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
LinkBar,
|
|
21
|
+
{
|
|
22
|
+
href: "/user-center/points",
|
|
23
|
+
baseUrl: process.env.NEXT_PUBLIC_AUTH_URL,
|
|
24
|
+
onClick,
|
|
25
|
+
className: twMerge(
|
|
26
|
+
"inline-flex shrink-0 items-center gap-1 h-8 px-3 rounded-full border border-primary/30 bg-background hover:bg-primary/5 text-sm whitespace-nowrap",
|
|
27
|
+
className
|
|
28
|
+
),
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
ImageBar,
|
|
32
|
+
{
|
|
33
|
+
src: HEADER_POINTS_ICON,
|
|
34
|
+
width: 16,
|
|
35
|
+
height: 16,
|
|
36
|
+
alt: "",
|
|
37
|
+
className: "shrink-0"
|
|
38
|
+
}
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ jsxs("span", { className: "text-foreground", children: [
|
|
41
|
+
/* @__PURE__ */ jsx(Translation, { value: "points", parentKey: "account" }),
|
|
42
|
+
": "
|
|
43
|
+
] }),
|
|
44
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary font-medium", children: formatHeaderPoints(userInfo) })
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
PointsEntry as default
|
|
51
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import Translation from "@0xchain/translation";
|
|
4
|
+
import { useLocale } from "@0xchain/i18n/react";
|
|
5
|
+
import { Dropdown } from "antd";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import ImageBar from "@0xchain/image";
|
|
8
|
+
import { Accordion, AccordionItem, AccordionTrigger } from "@0xchain/ui/accordion";
|
|
9
|
+
const PRODUCT_ITEMS = [
|
|
10
|
+
{
|
|
11
|
+
key: "widget",
|
|
12
|
+
href: "/widget",
|
|
13
|
+
iconUrl: `${process.env.NEXT_PUBLIC_CDN_URL}/uploads/2026/09/03/6a98d602a1c18.png`,
|
|
14
|
+
label: /* @__PURE__ */ jsx(Translation, { value: "products.widget", parentKey: "menu" })
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
function Products({
|
|
18
|
+
onClick,
|
|
19
|
+
onExpandChange
|
|
20
|
+
}) {
|
|
21
|
+
const locale = useLocale();
|
|
22
|
+
const [accordionValue, setAccordionValue] = useState("");
|
|
23
|
+
const handleClick = (e, href) => {
|
|
24
|
+
e?.preventDefault();
|
|
25
|
+
e?.stopPropagation();
|
|
26
|
+
onClick?.();
|
|
27
|
+
setAccordionValue("");
|
|
28
|
+
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || "";
|
|
29
|
+
window.location.href = `${baseUrl}/${locale}${href}`;
|
|
30
|
+
};
|
|
31
|
+
const renderItemContent = (item) => /* @__PURE__ */ jsxs("div", { className: "w-full h-full flex items-center gap-2 py-2 cursor-pointer font-medium", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
ImageBar,
|
|
34
|
+
{
|
|
35
|
+
src: item.iconUrl,
|
|
36
|
+
className: "w-6 h-6 shrink-0",
|
|
37
|
+
objectFit: "contain",
|
|
38
|
+
alt: ""
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1", children: item.label })
|
|
42
|
+
] });
|
|
43
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
44
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(
|
|
45
|
+
Dropdown,
|
|
46
|
+
{
|
|
47
|
+
getPopupContainer: () => document.body,
|
|
48
|
+
classNames: {
|
|
49
|
+
root: "w-50"
|
|
50
|
+
},
|
|
51
|
+
arrow: { pointAtCenter: true },
|
|
52
|
+
placement: "bottom",
|
|
53
|
+
menu: {
|
|
54
|
+
items: PRODUCT_ITEMS.map((item) => ({
|
|
55
|
+
label: renderItemContent(item),
|
|
56
|
+
key: item.key,
|
|
57
|
+
onClick: (info) => handleClick(info.domEvent, item.href)
|
|
58
|
+
}))
|
|
59
|
+
},
|
|
60
|
+
children: /* @__PURE__ */ jsx("div", { className: "whitespace-nowrap flex items-center gap-1 rounded-lg md:px-4 md:py-1 ", children: /* @__PURE__ */ jsx(Translation, { value: "products.product", parentKey: "menu" }) })
|
|
61
|
+
}
|
|
62
|
+
) }),
|
|
63
|
+
/* @__PURE__ */ jsx("div", { className: "md:hidden w-full", children: /* @__PURE__ */ jsxs("div", { onClick: (e) => {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
e.stopPropagation();
|
|
66
|
+
}, children: [
|
|
67
|
+
/* @__PURE__ */ jsx(
|
|
68
|
+
Accordion,
|
|
69
|
+
{
|
|
70
|
+
type: "single",
|
|
71
|
+
collapsible: true,
|
|
72
|
+
className: "w-full",
|
|
73
|
+
value: accordionValue,
|
|
74
|
+
onValueChange: (value) => {
|
|
75
|
+
setAccordionValue(value);
|
|
76
|
+
onExpandChange?.(!!value);
|
|
77
|
+
},
|
|
78
|
+
children: /* @__PURE__ */ jsx(AccordionItem, { value: "products", className: "border-0", children: /* @__PURE__ */ jsx(AccordionTrigger, { 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__ */ jsx("div", { className: "flex w-full justify-between items-center", children: /* @__PURE__ */ jsx("span", { className: "text-foreground", children: /* @__PURE__ */ jsx(Translation, { value: "products.product", parentKey: "menu" }) }) }) }) })
|
|
79
|
+
}
|
|
80
|
+
),
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: "grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
85
|
+
style: { gridTemplateRows: accordionValue ? "1fr" : "0fr" },
|
|
86
|
+
children: /* @__PURE__ */ jsx("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "mt-3 rounded-lg flex flex-col gap-2 max-h-[60vh] overflow-auto", children: PRODUCT_ITEMS.map((item) => /* @__PURE__ */ jsx(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
className: "w-full",
|
|
90
|
+
onClick: (e) => handleClick(e, item.href),
|
|
91
|
+
children: renderItemContent(item)
|
|
92
|
+
},
|
|
93
|
+
item.key
|
|
94
|
+
)) }) })
|
|
95
|
+
}
|
|
96
|
+
)
|
|
97
|
+
] }) })
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
export {
|
|
101
|
+
Products as default
|
|
102
|
+
};
|
package/dist/lib/Right.js
CHANGED
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import Nav from "./Nav.js";
|
|
4
|
+
import Drawer from "./Drawer.js";
|
|
5
|
+
import PointsEntry from "./PointsEntry.js";
|
|
6
|
+
import { twMerge } from "tailwind-merge";
|
|
7
|
+
import { useHeaderUser } from "./useHeaderUser.js";
|
|
8
|
+
var HeaderSource = /* @__PURE__ */ ((HeaderSource2) => {
|
|
9
|
+
HeaderSource2["EXPLORER"] = "explorer";
|
|
10
|
+
HeaderSource2["CHAT"] = "chat";
|
|
11
|
+
HeaderSource2["DEFAULT"] = "default";
|
|
12
|
+
return HeaderSource2;
|
|
13
|
+
})(HeaderSource || {});
|
|
14
|
+
function Right({
|
|
15
|
+
hideNews = false,
|
|
16
|
+
hideLogin = false,
|
|
17
|
+
user,
|
|
18
|
+
source = "default"
|
|
11
19
|
/* DEFAULT */
|
|
12
20
|
}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
const { userInfo } = useHeaderUser(user);
|
|
22
|
+
const showPoints = !hideLogin;
|
|
23
|
+
return /* @__PURE__ */ jsxs("div", { className: twMerge(
|
|
24
|
+
"flex items-center gap-2 z-1001",
|
|
25
|
+
source === "chat" ? "" : "md:flex-1 md:justify-start md:gap-10"
|
|
26
|
+
), children: [
|
|
27
|
+
showPoints ? /* @__PURE__ */ jsx(PointsEntry, { userInfo, className: "md:hidden" }) : null,
|
|
28
|
+
/* @__PURE__ */ jsx(Drawer, { hideLogin, hideNews, user: userInfo }),
|
|
29
|
+
/* @__PURE__ */ jsx("div", { className: "hidden md:block flex-1", children: /* @__PURE__ */ jsx(Nav, { hideNews, hideLogin, user: userInfo }) })
|
|
16
30
|
] });
|
|
17
31
|
}
|
|
18
32
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
33
|
+
HeaderSource,
|
|
34
|
+
Right as default
|
|
21
35
|
};
|