@ichaingo/header 1.4.53 → 1.4.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/index.js +28 -35
- package/dist/lib/Drawer.js +9 -9
- package/dist/lib/Right.js +16 -7
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,53 +1,46 @@
|
|
|
1
|
-
import { jsxs as r, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { twMerge as
|
|
3
|
-
import
|
|
4
|
-
import { cookies as
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as r, Fragment as x, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { twMerge as i } from "tailwind-merge";
|
|
3
|
+
import k from "@ichaingo/request";
|
|
4
|
+
import { cookies as g } from "next/headers";
|
|
5
|
+
import m, { HeaderSource as a } from "./lib/Right.js";
|
|
6
6
|
import E from "./lib/Logo.js";
|
|
7
|
-
import { USER_EVENTS as _, emitUserEvent as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
children: c,
|
|
12
|
-
className: d,
|
|
13
|
-
hideNews: l,
|
|
14
|
-
hideLogin: m,
|
|
15
|
-
source: i = "default"
|
|
16
|
-
/* DEFAULT */
|
|
17
|
-
}) {
|
|
18
|
-
var s;
|
|
19
|
-
let t = {
|
|
7
|
+
import { USER_EVENTS as _, emitUserEvent as w, onUserEvent as j } from "./lib/events.js";
|
|
8
|
+
async function N({ extra: l, children: p, className: f, hideNews: d, hideLogin: c, source: t = a.DEFAULT }) {
|
|
9
|
+
var n;
|
|
10
|
+
let e = {
|
|
20
11
|
data: {}
|
|
21
12
|
};
|
|
22
13
|
try {
|
|
23
|
-
const
|
|
24
|
-
if (typeof
|
|
14
|
+
const s = (n = (await g()).get("refresh_token")) == null ? void 0 : n.value;
|
|
15
|
+
if (typeof s < "u" && s !== "")
|
|
25
16
|
try {
|
|
26
|
-
|
|
17
|
+
e = await k.get("/v2/users/profile", {
|
|
27
18
|
baseURL: process.env.AUTH_INNER_API_URL
|
|
28
19
|
});
|
|
29
|
-
} catch (
|
|
30
|
-
console.error(
|
|
20
|
+
} catch (h) {
|
|
21
|
+
console.error(h), e = { data: {} };
|
|
31
22
|
}
|
|
32
23
|
} catch {
|
|
33
|
-
|
|
24
|
+
e = { data: {} };
|
|
34
25
|
}
|
|
35
|
-
return /* @__PURE__ */ r(
|
|
36
|
-
/* @__PURE__ */ r("div", { className: "
|
|
37
|
-
/* @__PURE__ */ r("div", { className:
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
|
|
26
|
+
return /* @__PURE__ */ r(x, { children: [
|
|
27
|
+
/* @__PURE__ */ r("div", { className: i("sticky left-0 right-0 top-0 bg-background h-16 z-999", t === a.CHAT ? "hidden md:block" : "block", f), children: [
|
|
28
|
+
/* @__PURE__ */ r("div", { className: "md:bg-module h-13 text-center flex flex-wrap justify-between items-center gap-2 px-4", children: [
|
|
29
|
+
/* @__PURE__ */ r("div", { className: i("items-center flex-1 gap-6", t === a.CHAT ? "hidden md:flex" : "flex"), children: [
|
|
30
|
+
/* @__PURE__ */ o(E, {}),
|
|
31
|
+
p
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ o(m, { hideNews: d, hideLogin: c, user: (e == null ? void 0 : e.data) || {} })
|
|
40
34
|
] }),
|
|
41
|
-
|
|
42
|
-
/* @__PURE__ */ o(x, { hideNews: l, hideLogin: m, user: (t == null ? void 0 : t.data) || {} })
|
|
35
|
+
l
|
|
43
36
|
] }),
|
|
44
|
-
e
|
|
37
|
+
/* @__PURE__ */ o("div", { className: i(t === a.CHAT ? "block md:hidden" : "hidden"), children: /* @__PURE__ */ o(m, { hideNews: d, source: t, hideLogin: c, user: (e == null ? void 0 : e.data) || {} }) })
|
|
45
38
|
] });
|
|
46
39
|
}
|
|
47
40
|
export {
|
|
48
|
-
|
|
41
|
+
a as HeaderSource,
|
|
49
42
|
_ as USER_EVENTS,
|
|
50
|
-
|
|
51
|
-
|
|
43
|
+
N as default,
|
|
44
|
+
w as emitUserEvent,
|
|
52
45
|
j as onUserEvent
|
|
53
46
|
};
|
package/dist/lib/Drawer.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
3
|
-
import
|
|
4
|
-
import { Menu as
|
|
3
|
+
import d from "rc-drawer";
|
|
4
|
+
import { Menu as m, X as c } from "lucide-react";
|
|
5
5
|
import f from "./Nav.js";
|
|
6
6
|
import { useState as p } from "react";
|
|
7
7
|
function b({ hideLogin: i, hideNews: a, user: n }) {
|
|
8
|
-
const [t,
|
|
8
|
+
const [t, r] = p(!1);
|
|
9
9
|
if (!t)
|
|
10
|
-
return /* @__PURE__ */ o(
|
|
11
|
-
const
|
|
12
|
-
e == null || e.preventDefault(), e == null || e.stopPropagation(),
|
|
10
|
+
return /* @__PURE__ */ o(m, { onClick: () => r(!0), size: 32, style: { color: "var(--title)" }, className: "md:hidden bg-module rounded-lg p-[4px] " });
|
|
11
|
+
const l = (e) => {
|
|
12
|
+
e == null || e.preventDefault(), e == null || e.stopPropagation(), r(!1);
|
|
13
13
|
};
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
15
|
-
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(c, { size: 24, style: { color: "var(--title)" }, onClick: (e) =>
|
|
16
|
-
/* @__PURE__ */ o(f, { onClick: (e) =>
|
|
14
|
+
return /* @__PURE__ */ o(d, { open: t, placement: "right", className: "block md:hidden fixed top-0 bottom-0 left-0 right-0 z-1001 bg-background p-2", children: /* @__PURE__ */ s("div", { className: "w-full max-h-full overflow-y-auto p-3 bg-module rounded-lg", children: [
|
|
15
|
+
/* @__PURE__ */ o("div", { className: "flex justify-end items-center p-2", children: /* @__PURE__ */ o(c, { size: 24, style: { color: "var(--title)" }, onClick: (e) => l(e) }) }),
|
|
16
|
+
/* @__PURE__ */ o(f, { onClick: (e) => l(e), hideLogin: i, hideNews: a, user: n })
|
|
17
17
|
] }) });
|
|
18
18
|
}
|
|
19
19
|
export {
|
package/dist/lib/Right.js
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import i from "./Nav.js";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import l from "./Drawer.js";
|
|
4
|
+
import { twMerge as o } from "tailwind-merge";
|
|
5
|
+
var d = /* @__PURE__ */ ((t) => (t.EXPLORER = "explorer", t.CHAT = "chat", t.DEFAULT = "default", t))(d || {});
|
|
6
|
+
function x({
|
|
7
|
+
hideNews: t,
|
|
8
|
+
hideLogin: m,
|
|
9
|
+
user: a,
|
|
10
|
+
source: e = "default"
|
|
11
|
+
/* DEFAULT */
|
|
12
|
+
}) {
|
|
13
|
+
return /* @__PURE__ */ f("div", { className: o(e === "chat" ? "" : "flex justify-end items-center md:gap-10 z-1001"), children: [
|
|
14
|
+
/* @__PURE__ */ r(l, { hideLogin: m, hideNews: t, user: a }),
|
|
15
|
+
/* @__PURE__ */ r("div", { className: "hidden md:block", children: /* @__PURE__ */ r(i, { hideNews: t, hideLogin: m, user: a }) })
|
|
8
16
|
] });
|
|
9
17
|
}
|
|
10
18
|
export {
|
|
11
|
-
|
|
19
|
+
d as HeaderSource,
|
|
20
|
+
x as default
|
|
12
21
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/header",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"rollup-plugin-preserve-use-client": "^1.0.0",
|
|
30
30
|
"tailwind-merge": "^2.5.5",
|
|
31
31
|
"next": "15.1.6",
|
|
32
|
-
"@ichaingo/
|
|
33
|
-
"@ichaingo/
|
|
34
|
-
"@ichaingo/
|
|
35
|
-
"@ichaingo/link": "1.4.
|
|
36
|
-
"@ichaingo/
|
|
37
|
-
"@ichaingo/
|
|
38
|
-
"@ichaingo/i18n": "1.4.
|
|
39
|
-
"@ichaingo/
|
|
40
|
-
"@ichaingo/
|
|
41
|
-
"@ichaingo/
|
|
42
|
-
"@ichaingo/
|
|
43
|
-
"@ichaingo/
|
|
44
|
-
"@ichaingo/
|
|
45
|
-
"@ichaingo/
|
|
32
|
+
"@ichaingo/avatar": "1.4.54",
|
|
33
|
+
"@ichaingo/auth": "1.4.54",
|
|
34
|
+
"@ichaingo/image": "1.4.54",
|
|
35
|
+
"@ichaingo/better-link": "1.4.54",
|
|
36
|
+
"@ichaingo/link": "1.4.54",
|
|
37
|
+
"@ichaingo/translation": "1.4.54",
|
|
38
|
+
"@ichaingo/i18n": "1.4.54",
|
|
39
|
+
"@ichaingo/providers": "1.4.54",
|
|
40
|
+
"@ichaingo/request": "1.4.54",
|
|
41
|
+
"@ichaingo/with-login": "1.4.54",
|
|
42
|
+
"@ichaingo/tooltip": "1.4.54",
|
|
43
|
+
"@ichaingo/theme-toggle": "1.4.54",
|
|
44
|
+
"@ichaingo/iconfont": "1.4.54",
|
|
45
|
+
"@ichaingo/ui": "1.4.54"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/js-cookie": "^3.0.6"
|