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