@0xchain/header 1.1.0-beta.91 → 1.1.0-beta.93
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.js +3 -3
- package/dist/lib/PointsEntry.js +8 -8
- package/dist/lib/Right.js +2 -2
- package/dist/lib/headerPoints.js +4 -0
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -41,8 +41,8 @@ async function HeaderBar({
|
|
|
41
41
|
}
|
|
42
42
|
return /* @__PURE__ */ jsxs(HeaderProvider, { brand, children: [
|
|
43
43
|
/* @__PURE__ */ jsxs("div", { className: twMerge("sticky left-0 right-0 top-0 bg-background h-16 z-999", source === HeaderSource.CHAT ? "hidden md:block flex-1" : "block", className), children: [
|
|
44
|
-
/* @__PURE__ */ jsxs("div", { className: "md:bg-card h-13 text-center flex flex-
|
|
45
|
-
/* @__PURE__ */ jsxs("div", { className: twMerge("items-center gap-6", source === HeaderSource.CHAT ? "hidden md:flex" : "flex"), children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", { className: "md:bg-card h-13 w-full text-center flex flex-nowrap justify-between items-center gap-2 md:gap-10 px-4", children: [
|
|
45
|
+
/* @__PURE__ */ jsxs("div", { className: twMerge("items-center gap-6 shrink-0", source === HeaderSource.CHAT ? "hidden md:flex" : "flex"), children: [
|
|
46
46
|
/* @__PURE__ */ jsx(Logo, {}),
|
|
47
47
|
children
|
|
48
48
|
] }),
|
|
@@ -50,7 +50,7 @@ async function HeaderBar({
|
|
|
50
50
|
] }),
|
|
51
51
|
extra
|
|
52
52
|
] }),
|
|
53
|
-
/* @__PURE__ */ jsx("div", { className: twMerge(source === HeaderSource.CHAT ? "
|
|
53
|
+
/* @__PURE__ */ jsx("div", { className: twMerge(source === HeaderSource.CHAT ? "flex justify-end md:hidden" : "hidden"), children: /* @__PURE__ */ jsx(Right, { hideNews, source, hideLogin, user: userInfo?.data || {} }) })
|
|
54
54
|
] });
|
|
55
55
|
}
|
|
56
56
|
export {
|
package/dist/lib/PointsEntry.js
CHANGED
|
@@ -6,8 +6,7 @@ import Translation from "@0xchain/translation";
|
|
|
6
6
|
import ImageBar from "@0xchain/image";
|
|
7
7
|
import request from "@0xchain/request";
|
|
8
8
|
import { twMerge } from "tailwind-merge";
|
|
9
|
-
import {
|
|
10
|
-
import { hasTrustedHeaderPoints, formatHeaderPoints, HEADER_POINTS_ICON, HEADER_POINTS_OVERVIEW_PATH, pointsTextFromOverview } from "./headerPoints.js";
|
|
9
|
+
import { headerPointsShowAmount, hasTrustedHeaderPoints, formatHeaderPoints, HEADER_POINTS_ICON, HEADER_POINTS_OVERVIEW_PATH, pointsTextFromOverview } from "./headerPoints.js";
|
|
11
10
|
import { useIsChaindigg } from "./context.js";
|
|
12
11
|
function PointsEntry({
|
|
13
12
|
userInfo,
|
|
@@ -15,11 +14,12 @@ function PointsEntry({
|
|
|
15
14
|
onClick
|
|
16
15
|
}) {
|
|
17
16
|
const isChaindigg = useIsChaindigg();
|
|
17
|
+
const showAmount = headerPointsShowAmount(userInfo);
|
|
18
18
|
const [pointsText, setPointsText] = useState(
|
|
19
|
-
() => hasTrustedHeaderPoints(userInfo) ? formatHeaderPoints(userInfo) : ""
|
|
19
|
+
() => showAmount && hasTrustedHeaderPoints(userInfo) ? formatHeaderPoints(userInfo) : ""
|
|
20
20
|
);
|
|
21
21
|
useEffect(() => {
|
|
22
|
-
if (isChaindigg || !
|
|
22
|
+
if (isChaindigg || !showAmount) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
25
25
|
let cancelled = false;
|
|
@@ -43,8 +43,8 @@ function PointsEntry({
|
|
|
43
43
|
window.removeEventListener("xchain-response-toast", onRefresh);
|
|
44
44
|
window.removeEventListener("focus", onRefresh);
|
|
45
45
|
};
|
|
46
|
-
}, [isChaindigg, userInfo?.id, userInfo?.userId]);
|
|
47
|
-
if (isChaindigg
|
|
46
|
+
}, [isChaindigg, showAmount, userInfo?.id, userInfo?.userId]);
|
|
47
|
+
if (isChaindigg) {
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
return /* @__PURE__ */ jsxs(
|
|
@@ -70,9 +70,9 @@ function PointsEntry({
|
|
|
70
70
|
),
|
|
71
71
|
/* @__PURE__ */ jsxs("span", { className: "text-foreground", children: [
|
|
72
72
|
/* @__PURE__ */ jsx(Translation, { value: "points", parentKey: "account" }),
|
|
73
|
-
": "
|
|
73
|
+
showAmount ? ": " : null
|
|
74
74
|
] }),
|
|
75
|
-
/* @__PURE__ */ jsx("span", { className: "text-primary font-medium", children: pointsText })
|
|
75
|
+
showAmount ? /* @__PURE__ */ jsx("span", { className: "text-primary font-medium", children: pointsText }) : null
|
|
76
76
|
]
|
|
77
77
|
}
|
|
78
78
|
);
|
package/dist/lib/Right.js
CHANGED
|
@@ -21,8 +21,8 @@ function Right({
|
|
|
21
21
|
const { userInfo } = useHeaderUser(user);
|
|
22
22
|
const showPoints = !hideLogin;
|
|
23
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"
|
|
24
|
+
"flex items-center justify-end gap-2 z-1001 ml-auto shrink-0",
|
|
25
|
+
source === "chat" ? "" : "md:flex-1 md:ml-0 md:justify-start md:gap-10"
|
|
26
26
|
), children: [
|
|
27
27
|
showPoints ? /* @__PURE__ */ jsx(PointsEntry, { userInfo, className: "md:hidden" }) : null,
|
|
28
28
|
/* @__PURE__ */ jsx(Drawer, { hideLogin, hideNews, user: userInfo }),
|
package/dist/lib/headerPoints.js
CHANGED
|
@@ -14,6 +14,9 @@ function formatHeaderPoints(userInfo) {
|
|
|
14
14
|
}
|
|
15
15
|
return String(Math.trunc(points));
|
|
16
16
|
}
|
|
17
|
+
function headerPointsShowAmount(userInfo) {
|
|
18
|
+
return Boolean(userInfo?.id || userInfo?.userId);
|
|
19
|
+
}
|
|
17
20
|
function hasTrustedHeaderPoints(userInfo) {
|
|
18
21
|
if (typeof userInfo?.displayBalance === "string" && userInfo.displayBalance.trim() && userInfo.displayBalance !== "0") {
|
|
19
22
|
return true;
|
|
@@ -48,5 +51,6 @@ export {
|
|
|
48
51
|
HEADER_POINTS_OVERVIEW_PATH,
|
|
49
52
|
formatHeaderPoints,
|
|
50
53
|
hasTrustedHeaderPoints,
|
|
54
|
+
headerPointsShowAmount,
|
|
51
55
|
pointsTextFromOverview
|
|
52
56
|
};
|
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.93",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react": "19.1.1",
|
|
27
27
|
"react-dom": "19.1.1",
|
|
28
28
|
"tailwind-merge": "3.3.1",
|
|
29
|
-
"@0xchain/with-login": "1.1.0-beta.
|
|
29
|
+
"@0xchain/with-login": "1.1.0-beta.93"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@0xchain/next-themes": "1.0.0",
|
|
@@ -41,21 +41,21 @@
|
|
|
41
41
|
"react-dom": "19.1.1",
|
|
42
42
|
"rollup-plugin-preserve-use-client": "3.0.1",
|
|
43
43
|
"tailwind-merge": "3.3.1",
|
|
44
|
-
"@0xchain/with-login": "1.1.0-beta.
|
|
44
|
+
"@0xchain/with-login": "1.1.0-beta.93"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@0xchain/
|
|
48
|
-
"@0xchain/
|
|
49
|
-
"@0xchain/
|
|
50
|
-
"@0xchain/
|
|
51
|
-
"@0xchain/
|
|
52
|
-
"@0xchain/
|
|
53
|
-
"@0xchain/
|
|
54
|
-
"@0xchain/
|
|
55
|
-
"@0xchain/tooltip": "1.1.0-beta.
|
|
56
|
-
"@0xchain/
|
|
57
|
-
"@0xchain/translation": "1.1.0-beta.
|
|
58
|
-
"@0xchain/ui": "1.1.0-beta.
|
|
47
|
+
"@0xchain/better-link": "1.1.0-beta.93",
|
|
48
|
+
"@0xchain/avatar": "1.1.0-beta.93",
|
|
49
|
+
"@0xchain/iconfont": "1.1.0-beta.93",
|
|
50
|
+
"@0xchain/image": "1.1.0-beta.93",
|
|
51
|
+
"@0xchain/i18n": "1.1.0-beta.93",
|
|
52
|
+
"@0xchain/theme-toggle": "1.1.0-beta.93",
|
|
53
|
+
"@0xchain/link": "1.1.0-beta.93",
|
|
54
|
+
"@0xchain/request": "1.1.0-beta.93",
|
|
55
|
+
"@0xchain/tooltip": "1.1.0-beta.93",
|
|
56
|
+
"@0xchain/auth": "1.1.0-beta.93",
|
|
57
|
+
"@0xchain/translation": "1.1.0-beta.93",
|
|
58
|
+
"@0xchain/ui": "1.1.0-beta.93"
|
|
59
59
|
},
|
|
60
60
|
"nx": {
|
|
61
61
|
"tags": [
|