@biza-gov/layout 0.0.0-stage → 1.3.13
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/README.md +717 -2
- package/dist/index.d.mts +279 -0
- package/dist/index.d.ts +279 -0
- package/dist/index.js +2773 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2722 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +44 -4
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2722 @@
|
|
|
1
|
+
import { createContext, useState, useEffect, useRef, useCallback, useContext, useId } from 'react';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/sidebar/StaffSidebar.tsx
|
|
5
|
+
function useDarkMode() {
|
|
6
|
+
const [isDark, setIsDark] = useState(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const root = document.documentElement;
|
|
9
|
+
const check = () => setIsDark(root.classList.contains("dark"));
|
|
10
|
+
check();
|
|
11
|
+
const observer = new MutationObserver(check);
|
|
12
|
+
observer.observe(root, { attributes: true, attributeFilter: ["class"] });
|
|
13
|
+
return () => observer.disconnect();
|
|
14
|
+
}, []);
|
|
15
|
+
return isDark;
|
|
16
|
+
}
|
|
17
|
+
function SidebarHeader({ orgLogo, orgName, orgSubtitle, collapsed }) {
|
|
18
|
+
const isDark = useDarkMode();
|
|
19
|
+
if (collapsed) {
|
|
20
|
+
return /* @__PURE__ */ jsx("div", { style: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
padding: "20px 8px"
|
|
25
|
+
}, children: orgLogo ? /* @__PURE__ */ jsx(
|
|
26
|
+
"img",
|
|
27
|
+
{
|
|
28
|
+
src: orgLogo,
|
|
29
|
+
alt: orgName,
|
|
30
|
+
style: {
|
|
31
|
+
width: "36px",
|
|
32
|
+
height: "36px",
|
|
33
|
+
borderRadius: "50%",
|
|
34
|
+
objectFit: "cover"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
) : /* @__PURE__ */ jsx("div", { style: {
|
|
38
|
+
width: "36px",
|
|
39
|
+
height: "36px",
|
|
40
|
+
borderRadius: "50%",
|
|
41
|
+
background: "var(--color-alias-color-brand-primary, #1e7d55)",
|
|
42
|
+
display: "flex",
|
|
43
|
+
alignItems: "center",
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
color: "#fff",
|
|
46
|
+
fontWeight: 700,
|
|
47
|
+
fontSize: "14px"
|
|
48
|
+
}, children: orgName.charAt(0) }) });
|
|
49
|
+
}
|
|
50
|
+
return /* @__PURE__ */ jsxs("div", { style: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
alignItems: "center",
|
|
53
|
+
gap: "12px",
|
|
54
|
+
padding: "24px 20px"
|
|
55
|
+
}, children: [
|
|
56
|
+
orgLogo && /* @__PURE__ */ jsx(
|
|
57
|
+
"img",
|
|
58
|
+
{
|
|
59
|
+
src: orgLogo,
|
|
60
|
+
alt: orgName,
|
|
61
|
+
style: {
|
|
62
|
+
width: "48px",
|
|
63
|
+
height: "48px",
|
|
64
|
+
borderRadius: "50%",
|
|
65
|
+
objectFit: "cover",
|
|
66
|
+
flexShrink: 0
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
71
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
72
|
+
fontWeight: 700,
|
|
73
|
+
fontSize: "16px",
|
|
74
|
+
lineHeight: "22px",
|
|
75
|
+
color: isDark ? "#ffffff" : "var(--color-alias-color-brand-text-dark, #05010e)",
|
|
76
|
+
margin: 0,
|
|
77
|
+
overflow: "hidden",
|
|
78
|
+
textOverflow: "ellipsis",
|
|
79
|
+
whiteSpace: "nowrap"
|
|
80
|
+
}, children: orgName }),
|
|
81
|
+
orgSubtitle && /* @__PURE__ */ jsx("p", { style: {
|
|
82
|
+
fontSize: "14px",
|
|
83
|
+
lineHeight: "20px",
|
|
84
|
+
color: isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
85
|
+
margin: 0,
|
|
86
|
+
overflow: "hidden",
|
|
87
|
+
textOverflow: "ellipsis",
|
|
88
|
+
whiteSpace: "nowrap"
|
|
89
|
+
}, children: orgSubtitle })
|
|
90
|
+
] })
|
|
91
|
+
] });
|
|
92
|
+
}
|
|
93
|
+
var defaultProps = (size = 20) => ({
|
|
94
|
+
width: size,
|
|
95
|
+
height: size,
|
|
96
|
+
viewBox: "0 0 24 24",
|
|
97
|
+
fill: "none",
|
|
98
|
+
stroke: "currentColor",
|
|
99
|
+
strokeWidth: 2,
|
|
100
|
+
strokeLinecap: "round",
|
|
101
|
+
strokeLinejoin: "round"
|
|
102
|
+
});
|
|
103
|
+
function HomeIcon({ size = 20, className, style } = {}) {
|
|
104
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
105
|
+
/* @__PURE__ */ jsx("path", { d: "M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z" }),
|
|
106
|
+
/* @__PURE__ */ jsx("polyline", { points: "9 22 9 12 15 12 15 22" })
|
|
107
|
+
] });
|
|
108
|
+
}
|
|
109
|
+
function SearchIcon({ size = 20, className, style } = {}) {
|
|
110
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
111
|
+
/* @__PURE__ */ jsx("circle", { cx: "11", cy: "11", r: "8" }),
|
|
112
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
function BellIcon({ size = 20, className, style } = {}) {
|
|
116
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), viewBox: "0 0 22 24", stroke: "none", fill: "none", className, style, children: /* @__PURE__ */ jsx("path", { d: "M21.2321 13.4463L19.3618 6.71712C18.8136 4.74574 17.6222 3.01418 15.9769 1.79767C14.3316 0.581165 12.3269 -0.0504751 10.2814 0.00315377C8.23593 0.0567826 6.26708 0.792603 4.6878 2.09365C3.10852 3.3947 2.00945 5.18632 1.5653 7.18371L0.11728 13.6954C-0.0426654 14.4149 -0.0389674 15.1611 0.128101 15.879C0.29517 16.5969 0.621344 17.2681 1.08254 17.8431C1.54374 18.418 2.12818 18.8821 2.79272 19.2009C3.45727 19.5198 4.18494 19.6853 4.92202 19.6853H6.01861C6.24454 20.7979 6.84817 21.7982 7.72723 22.5167C8.60629 23.2352 9.70671 23.6277 10.842 23.6277C11.9774 23.6277 13.0778 23.2352 13.9569 22.5167C14.8359 21.7982 15.4396 20.7979 15.6655 19.6853H16.4904C17.2492 19.6853 17.9977 19.5099 18.6774 19.1728C19.3572 18.8357 19.9498 18.346 20.409 17.742C20.8682 17.1379 21.1815 16.4359 21.3245 15.6907C21.4674 14.9455 21.4352 14.1774 21.2321 13.4463ZM10.842 21.654C10.2334 21.6515 9.64049 21.461 9.1443 21.1086C8.6481 20.7562 8.27291 20.2591 8.07005 19.6853H13.614C13.4112 20.2591 13.036 20.7562 12.5398 21.1086C12.0436 21.461 11.4506 21.6515 10.842 21.654ZM18.8411 16.55C18.5668 16.9139 18.2114 17.2088 17.8032 17.4113C17.3949 17.6138 16.9451 17.7183 16.4894 17.7165H4.92202C4.47982 17.7164 4.04328 17.6171 3.64463 17.4257C3.24598 17.2344 2.89539 16.9559 2.61874 16.611C2.34208 16.266 2.14643 15.8633 2.04622 15.4326C1.94602 15.0019 1.94381 14.5542 2.03977 14.1226L3.4868 7.60994C3.83561 6.04105 4.69886 4.63379 5.93932 3.61186C7.17978 2.58992 8.72625 2.01197 10.3329 1.96988C11.9395 1.92779 13.5142 2.42398 14.8064 3.37956C16.0987 4.33515 17.0344 5.69528 17.4649 7.24376L19.3352 13.9729C19.4588 14.4114 19.4785 14.8725 19.3927 15.3199C19.3069 15.7672 19.1181 16.1884 18.8411 16.55Z", fill: "currentColor" }) });
|
|
117
|
+
}
|
|
118
|
+
function FolderIcon({ size = 20, className, style } = {}) {
|
|
119
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("path", { d: "M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z" }) });
|
|
120
|
+
}
|
|
121
|
+
function ClipboardIcon({ size = 20, className, style } = {}) {
|
|
122
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
123
|
+
/* @__PURE__ */ jsx("path", { d: "M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2" }),
|
|
124
|
+
/* @__PURE__ */ jsx("rect", { x: "8", y: "2", width: "8", height: "4", rx: "1", ry: "1" })
|
|
125
|
+
] });
|
|
126
|
+
}
|
|
127
|
+
function FileTextIcon({ size = 20, className, style } = {}) {
|
|
128
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
129
|
+
/* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
130
|
+
/* @__PURE__ */ jsx("polyline", { points: "14 2 14 8 20 8" }),
|
|
131
|
+
/* @__PURE__ */ jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
132
|
+
/* @__PURE__ */ jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
|
|
133
|
+
/* @__PURE__ */ jsx("polyline", { points: "10 9 9 9 8 9" })
|
|
134
|
+
] });
|
|
135
|
+
}
|
|
136
|
+
function CalendarIcon({ size = 20, className, style } = {}) {
|
|
137
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
138
|
+
/* @__PURE__ */ jsx("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
|
|
139
|
+
/* @__PURE__ */ jsx("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
|
|
140
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
|
|
141
|
+
/* @__PURE__ */ jsx("line", { x1: "3", y1: "10", x2: "21", y2: "10" })
|
|
142
|
+
] });
|
|
143
|
+
}
|
|
144
|
+
function UserIcon({ size = 20, className, style } = {}) {
|
|
145
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
146
|
+
/* @__PURE__ */ jsx("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
147
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "7", r: "4" })
|
|
148
|
+
] });
|
|
149
|
+
}
|
|
150
|
+
function UsersIcon({ size = 20, className, style } = {}) {
|
|
151
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
152
|
+
/* @__PURE__ */ jsx("path", { d: "M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2" }),
|
|
153
|
+
/* @__PURE__ */ jsx("circle", { cx: "9", cy: "7", r: "4" }),
|
|
154
|
+
/* @__PURE__ */ jsx("path", { d: "M23 21v-2a4 4 0 0 0-3-3.87" }),
|
|
155
|
+
/* @__PURE__ */ jsx("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
|
|
156
|
+
] });
|
|
157
|
+
}
|
|
158
|
+
function GearIcon({ size = 20, className, style } = {}) {
|
|
159
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
160
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
161
|
+
/* @__PURE__ */ jsx("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
function WrenchIcon({ size = 20, className, style } = {}) {
|
|
165
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" }) });
|
|
166
|
+
}
|
|
167
|
+
function ShieldIcon({ size = 20, className, style } = {}) {
|
|
168
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }) });
|
|
169
|
+
}
|
|
170
|
+
function HelpCircleIcon({ size = 20, className, style } = {}) {
|
|
171
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
172
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
173
|
+
/* @__PURE__ */ jsx("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
174
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
175
|
+
] });
|
|
176
|
+
}
|
|
177
|
+
function BarChartIcon({ size = 20, className, style } = {}) {
|
|
178
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
179
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "20", x2: "12", y2: "10" }),
|
|
180
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "20", x2: "18", y2: "4" }),
|
|
181
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "20", x2: "6", y2: "16" })
|
|
182
|
+
] });
|
|
183
|
+
}
|
|
184
|
+
function HistoryIcon({ size = 20, className, style } = {}) {
|
|
185
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
186
|
+
/* @__PURE__ */ jsx("polyline", { points: "1 4 1 10 7 10" }),
|
|
187
|
+
/* @__PURE__ */ jsx("path", { d: "M3.51 15a9 9 0 1 0 2.13-9.36L1 10" })
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
function DatabaseIcon({ size = 20, className, style } = {}) {
|
|
191
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
192
|
+
/* @__PURE__ */ jsx("ellipse", { cx: "12", cy: "5", rx: "9", ry: "3" }),
|
|
193
|
+
/* @__PURE__ */ jsx("path", { d: "M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" }),
|
|
194
|
+
/* @__PURE__ */ jsx("path", { d: "M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function BuildingIcon({ size = 20, className, style } = {}) {
|
|
198
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
199
|
+
/* @__PURE__ */ jsx("rect", { x: "4", y: "2", width: "16", height: "20", rx: "2", ry: "2" }),
|
|
200
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "22", x2: "9", y2: "18" }),
|
|
201
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "22", x2: "15", y2: "18" }),
|
|
202
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "6", x2: "9.01", y2: "6" }),
|
|
203
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "6", x2: "15.01", y2: "6" }),
|
|
204
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "10", x2: "9.01", y2: "10" }),
|
|
205
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "10", x2: "15.01", y2: "10" }),
|
|
206
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "14", x2: "9.01", y2: "14" }),
|
|
207
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "14", x2: "15.01", y2: "14" })
|
|
208
|
+
] });
|
|
209
|
+
}
|
|
210
|
+
function MapPinIcon({ size = 20, className, style } = {}) {
|
|
211
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
212
|
+
/* @__PURE__ */ jsx("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" }),
|
|
213
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "10", r: "3" })
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
function PhoneIcon({ size = 20, className, style } = {}) {
|
|
217
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("path", { d: "M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z" }) });
|
|
218
|
+
}
|
|
219
|
+
function MailIcon({ size = 20, className, style } = {}) {
|
|
220
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
221
|
+
/* @__PURE__ */ jsx("path", { d: "M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z" }),
|
|
222
|
+
/* @__PURE__ */ jsx("polyline", { points: "22,6 12,13 2,6" })
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
function CheckCircleIcon({ size = 20, className, style } = {}) {
|
|
226
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
227
|
+
/* @__PURE__ */ jsx("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
228
|
+
/* @__PURE__ */ jsx("polyline", { points: "22 4 12 14.01 9 11.01" })
|
|
229
|
+
] });
|
|
230
|
+
}
|
|
231
|
+
function AlertTriangleIcon({ size = 20, className, style } = {}) {
|
|
232
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
233
|
+
/* @__PURE__ */ jsx("path", { d: "M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" }),
|
|
234
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "9", x2: "12", y2: "13" }),
|
|
235
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
236
|
+
] });
|
|
237
|
+
}
|
|
238
|
+
function XCircleIcon({ size = 20, className, style } = {}) {
|
|
239
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
240
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
241
|
+
/* @__PURE__ */ jsx("line", { x1: "15", y1: "9", x2: "9", y2: "15" }),
|
|
242
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "9", x2: "15", y2: "15" })
|
|
243
|
+
] });
|
|
244
|
+
}
|
|
245
|
+
function PlusCircleIcon({ size = 20, className, style } = {}) {
|
|
246
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
247
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
248
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "8", x2: "12", y2: "16" }),
|
|
249
|
+
/* @__PURE__ */ jsx("line", { x1: "8", y1: "12", x2: "16", y2: "12" })
|
|
250
|
+
] });
|
|
251
|
+
}
|
|
252
|
+
function LogOutIcon({ size = 20, className, style } = {}) {
|
|
253
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
254
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
255
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
|
|
256
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
|
|
257
|
+
] });
|
|
258
|
+
}
|
|
259
|
+
function DownloadIcon({ size = 20, className, style } = {}) {
|
|
260
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
261
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
262
|
+
/* @__PURE__ */ jsx("polyline", { points: "7 10 12 15 17 10" }),
|
|
263
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
264
|
+
] });
|
|
265
|
+
}
|
|
266
|
+
function UploadIcon({ size = 20, className, style } = {}) {
|
|
267
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
268
|
+
/* @__PURE__ */ jsx("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
269
|
+
/* @__PURE__ */ jsx("polyline", { points: "17 8 12 3 7 8" }),
|
|
270
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "3", x2: "12", y2: "15" })
|
|
271
|
+
] });
|
|
272
|
+
}
|
|
273
|
+
function PrinterIcon({ size = 20, className, style } = {}) {
|
|
274
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
275
|
+
/* @__PURE__ */ jsx("polyline", { points: "6 9 6 2 18 2 18 9" }),
|
|
276
|
+
/* @__PURE__ */ jsx("path", { d: "M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2" }),
|
|
277
|
+
/* @__PURE__ */ jsx("rect", { x: "6", y: "14", width: "12", height: "8" })
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
function StarIcon({ size = 20, className, style } = {}) {
|
|
281
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("polygon", { points: "12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2" }) });
|
|
282
|
+
}
|
|
283
|
+
function HeartIcon({ size = 20, className, style } = {}) {
|
|
284
|
+
return /* @__PURE__ */ jsx("svg", { ...defaultProps(size), className, style, children: /* @__PURE__ */ jsx("path", { d: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" }) });
|
|
285
|
+
}
|
|
286
|
+
function EyeIcon({ size = 20, className, style } = {}) {
|
|
287
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
288
|
+
/* @__PURE__ */ jsx("path", { d: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z" }),
|
|
289
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" })
|
|
290
|
+
] });
|
|
291
|
+
}
|
|
292
|
+
function EditIcon({ size = 20, className, style } = {}) {
|
|
293
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
294
|
+
/* @__PURE__ */ jsx("path", { d: "M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" }),
|
|
295
|
+
/* @__PURE__ */ jsx("path", { d: "M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" })
|
|
296
|
+
] });
|
|
297
|
+
}
|
|
298
|
+
function TrashIcon({ size = 20, className, style } = {}) {
|
|
299
|
+
return /* @__PURE__ */ jsxs("svg", { ...defaultProps(size), className, style, children: [
|
|
300
|
+
/* @__PURE__ */ jsx("polyline", { points: "3 6 5 6 21 6" }),
|
|
301
|
+
/* @__PURE__ */ jsx("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" }),
|
|
302
|
+
/* @__PURE__ */ jsx("line", { x1: "10", y1: "11", x2: "10", y2: "17" }),
|
|
303
|
+
/* @__PURE__ */ jsx("line", { x1: "14", y1: "11", x2: "14", y2: "17" })
|
|
304
|
+
] });
|
|
305
|
+
}
|
|
306
|
+
var ICON_MAP = {
|
|
307
|
+
home: HomeIcon,
|
|
308
|
+
dashboard: HomeIcon,
|
|
309
|
+
services: FolderIcon,
|
|
310
|
+
service: FolderIcon,
|
|
311
|
+
folder: FolderIcon,
|
|
312
|
+
category: FolderIcon,
|
|
313
|
+
users: UsersIcon,
|
|
314
|
+
members: UsersIcon,
|
|
315
|
+
user: UserIcon,
|
|
316
|
+
profile: UserIcon,
|
|
317
|
+
staff: UserIcon,
|
|
318
|
+
settings: GearIcon,
|
|
319
|
+
setting: GearIcon,
|
|
320
|
+
config: GearIcon,
|
|
321
|
+
help: HelpCircleIcon,
|
|
322
|
+
support: HelpCircleIcon,
|
|
323
|
+
faq: HelpCircleIcon,
|
|
324
|
+
reports: BarChartIcon,
|
|
325
|
+
report: BarChartIcon,
|
|
326
|
+
stats: BarChartIcon,
|
|
327
|
+
chart: BarChartIcon,
|
|
328
|
+
analytics: BarChartIcon,
|
|
329
|
+
roles: ShieldIcon,
|
|
330
|
+
permissions: ShieldIcon,
|
|
331
|
+
security: ShieldIcon,
|
|
332
|
+
logs: HistoryIcon,
|
|
333
|
+
history: HistoryIcon,
|
|
334
|
+
activity: HistoryIcon,
|
|
335
|
+
audit: HistoryIcon,
|
|
336
|
+
backup: DatabaseIcon,
|
|
337
|
+
database: DatabaseIcon,
|
|
338
|
+
data: DatabaseIcon,
|
|
339
|
+
documents: FileTextIcon,
|
|
340
|
+
document: FileTextIcon,
|
|
341
|
+
docs: FileTextIcon,
|
|
342
|
+
files: FileTextIcon,
|
|
343
|
+
file: FileTextIcon,
|
|
344
|
+
forms: ClipboardIcon,
|
|
345
|
+
form: ClipboardIcon,
|
|
346
|
+
request: ClipboardIcon,
|
|
347
|
+
requests: ClipboardIcon,
|
|
348
|
+
calendar: CalendarIcon,
|
|
349
|
+
schedule: CalendarIcon,
|
|
350
|
+
appointment: CalendarIcon,
|
|
351
|
+
notifications: BellIcon,
|
|
352
|
+
notification: BellIcon,
|
|
353
|
+
alerts: BellIcon,
|
|
354
|
+
search: SearchIcon,
|
|
355
|
+
organization: BuildingIcon,
|
|
356
|
+
org: BuildingIcon,
|
|
357
|
+
department: BuildingIcon,
|
|
358
|
+
agency: BuildingIcon,
|
|
359
|
+
location: MapPinIcon,
|
|
360
|
+
map: MapPinIcon,
|
|
361
|
+
address: MapPinIcon,
|
|
362
|
+
phone: PhoneIcon,
|
|
363
|
+
contact: PhoneIcon,
|
|
364
|
+
call: PhoneIcon,
|
|
365
|
+
email: MailIcon,
|
|
366
|
+
mail: MailIcon,
|
|
367
|
+
message: MailIcon,
|
|
368
|
+
messages: MailIcon,
|
|
369
|
+
tools: WrenchIcon,
|
|
370
|
+
maintenance: WrenchIcon,
|
|
371
|
+
favorites: StarIcon,
|
|
372
|
+
bookmark: StarIcon,
|
|
373
|
+
edit: EditIcon,
|
|
374
|
+
manage: EditIcon,
|
|
375
|
+
delete: TrashIcon,
|
|
376
|
+
trash: TrashIcon,
|
|
377
|
+
view: EyeIcon,
|
|
378
|
+
preview: EyeIcon,
|
|
379
|
+
detail: EyeIcon,
|
|
380
|
+
download: DownloadIcon,
|
|
381
|
+
export: DownloadIcon,
|
|
382
|
+
upload: UploadIcon,
|
|
383
|
+
import: UploadIcon,
|
|
384
|
+
print: PrinterIcon,
|
|
385
|
+
printer: PrinterIcon,
|
|
386
|
+
logout: LogOutIcon,
|
|
387
|
+
signout: LogOutIcon,
|
|
388
|
+
approve: CheckCircleIcon,
|
|
389
|
+
approved: CheckCircleIcon,
|
|
390
|
+
add: PlusCircleIcon,
|
|
391
|
+
create: PlusCircleIcon,
|
|
392
|
+
new: PlusCircleIcon
|
|
393
|
+
};
|
|
394
|
+
function DefaultIcon() {
|
|
395
|
+
return /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "4" }) });
|
|
396
|
+
}
|
|
397
|
+
function getAutoIcon(id) {
|
|
398
|
+
const IconComp = ICON_MAP[id.toLowerCase()];
|
|
399
|
+
if (IconComp) return /* @__PURE__ */ jsx(IconComp, {});
|
|
400
|
+
return /* @__PURE__ */ jsx(DefaultIcon, {});
|
|
401
|
+
}
|
|
402
|
+
function ChevronDownIcon({ isOpen }) {
|
|
403
|
+
return /* @__PURE__ */ jsx(
|
|
404
|
+
"svg",
|
|
405
|
+
{
|
|
406
|
+
width: "16",
|
|
407
|
+
height: "16",
|
|
408
|
+
viewBox: "0 0 20 20",
|
|
409
|
+
fill: "none",
|
|
410
|
+
stroke: "currentColor",
|
|
411
|
+
strokeWidth: "2",
|
|
412
|
+
strokeLinecap: "round",
|
|
413
|
+
strokeLinejoin: "round",
|
|
414
|
+
style: {
|
|
415
|
+
transition: "transform 0.2s ease",
|
|
416
|
+
transform: isOpen ? "rotate(180deg)" : "rotate(0deg)",
|
|
417
|
+
flexShrink: 0
|
|
418
|
+
},
|
|
419
|
+
children: /* @__PURE__ */ jsx("path", { d: "M5 7.5L10 12.5L15 7.5" })
|
|
420
|
+
}
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
function MenuItemComponent({
|
|
424
|
+
item,
|
|
425
|
+
onItemClick,
|
|
426
|
+
currentPath,
|
|
427
|
+
depth = 0,
|
|
428
|
+
collapsed = false,
|
|
429
|
+
onExpandRequest
|
|
430
|
+
}) {
|
|
431
|
+
const isDark = useDarkMode();
|
|
432
|
+
const hasChildren = item.children && item.children.length > 0;
|
|
433
|
+
const isActive = item.path ? currentPath === item.path : false;
|
|
434
|
+
const resolvedIcon = item.icon || getAutoIcon(item.id);
|
|
435
|
+
const isChildActive = hasChildren ? item.children.some((child) => child.path === currentPath) : false;
|
|
436
|
+
const [userToggled, setUserToggled] = useState(false);
|
|
437
|
+
const [isOpen, setIsOpen] = useState(isChildActive);
|
|
438
|
+
const expanded = userToggled ? isOpen : isOpen || isChildActive;
|
|
439
|
+
const btnId = useId();
|
|
440
|
+
const btnClass = `sidebar-btn-${btnId.replace(/[^a-zA-Z0-9_-]/g, "_")}`;
|
|
441
|
+
const handleClick = () => {
|
|
442
|
+
if (hasChildren) {
|
|
443
|
+
if (collapsed) {
|
|
444
|
+
setUserToggled(true);
|
|
445
|
+
setIsOpen(true);
|
|
446
|
+
onExpandRequest?.();
|
|
447
|
+
} else {
|
|
448
|
+
setUserToggled(true);
|
|
449
|
+
setIsOpen(!expanded);
|
|
450
|
+
}
|
|
451
|
+
} else if (item.path) {
|
|
452
|
+
onItemClick(item.path);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
const activeColor = "var(--color-alias-color-brand-primary, #1e7d55)";
|
|
456
|
+
const hoverBg = isDark ? "#334155" : "var(--color-foundations-fuji-pallet-light, #ebedf5)";
|
|
457
|
+
if (collapsed && depth === 0) {
|
|
458
|
+
return /* @__PURE__ */ jsxs("li", { children: [
|
|
459
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.${btnClass}:not([data-active='true']):hover{background-color:${hoverBg}!important}.${btnClass}:focus-visible{outline:2px solid ${activeColor};outline-offset:-2px}}` }),
|
|
460
|
+
/* @__PURE__ */ jsx(
|
|
461
|
+
"button",
|
|
462
|
+
{
|
|
463
|
+
className: btnClass,
|
|
464
|
+
"data-active": isActive || isChildActive,
|
|
465
|
+
"aria-current": isActive ? "page" : void 0,
|
|
466
|
+
"aria-label": item.title,
|
|
467
|
+
onClick: handleClick,
|
|
468
|
+
title: item.title,
|
|
469
|
+
style: {
|
|
470
|
+
width: "100%",
|
|
471
|
+
display: "flex",
|
|
472
|
+
alignItems: "center",
|
|
473
|
+
justifyContent: "center",
|
|
474
|
+
padding: "12px 0",
|
|
475
|
+
borderRadius: "8px",
|
|
476
|
+
border: "none",
|
|
477
|
+
background: isActive || isChildActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
478
|
+
color: isActive || isChildActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
479
|
+
cursor: "pointer",
|
|
480
|
+
transition: "background-color 0.15s ease",
|
|
481
|
+
WebkitTapHighlightColor: "transparent"
|
|
482
|
+
},
|
|
483
|
+
children: /* @__PURE__ */ jsx("span", { style: {
|
|
484
|
+
width: "24px",
|
|
485
|
+
height: "24px",
|
|
486
|
+
display: "flex",
|
|
487
|
+
alignItems: "center",
|
|
488
|
+
justifyContent: "center"
|
|
489
|
+
}, children: resolvedIcon })
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
item.dividerAfter && /* @__PURE__ */ jsx("hr", { style: {
|
|
493
|
+
border: "none",
|
|
494
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
495
|
+
margin: "8px 4px"
|
|
496
|
+
} })
|
|
497
|
+
] });
|
|
498
|
+
}
|
|
499
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
500
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
501
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.${btnClass}:not([data-active='true']):hover{background-color:${hoverBg}!important}.${btnClass}:focus-visible{outline:2px solid ${activeColor};outline-offset:-2px}}` }),
|
|
502
|
+
/* @__PURE__ */ jsxs(
|
|
503
|
+
"button",
|
|
504
|
+
{
|
|
505
|
+
className: btnClass,
|
|
506
|
+
"data-active": isActive,
|
|
507
|
+
"aria-current": isActive ? "page" : void 0,
|
|
508
|
+
"aria-expanded": hasChildren ? expanded : void 0,
|
|
509
|
+
onClick: handleClick,
|
|
510
|
+
style: {
|
|
511
|
+
width: "100%",
|
|
512
|
+
display: "flex",
|
|
513
|
+
alignItems: "center",
|
|
514
|
+
gap: "12px",
|
|
515
|
+
padding: depth > 0 ? "10px 16px 10px 52px" : "12px 16px",
|
|
516
|
+
borderRadius: "8px",
|
|
517
|
+
border: "none",
|
|
518
|
+
background: isActive ? `color-mix(in srgb, ${activeColor} 10%, transparent)` : "transparent",
|
|
519
|
+
color: isActive ? activeColor : isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
520
|
+
cursor: "pointer",
|
|
521
|
+
transition: "background-color 0.15s ease",
|
|
522
|
+
textAlign: "left",
|
|
523
|
+
fontSize: "15px",
|
|
524
|
+
fontWeight: isActive ? 600 : 400,
|
|
525
|
+
lineHeight: "22px",
|
|
526
|
+
WebkitTapHighlightColor: "transparent"
|
|
527
|
+
},
|
|
528
|
+
children: [
|
|
529
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
530
|
+
width: "24px",
|
|
531
|
+
height: "24px",
|
|
532
|
+
display: "flex",
|
|
533
|
+
alignItems: "center",
|
|
534
|
+
justifyContent: "center",
|
|
535
|
+
flexShrink: 0,
|
|
536
|
+
color: isActive ? activeColor : isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)"
|
|
537
|
+
}, children: resolvedIcon }),
|
|
538
|
+
/* @__PURE__ */ jsx("span", { style: { flex: 1 }, children: item.title }),
|
|
539
|
+
hasChildren && /* @__PURE__ */ jsx(ChevronDownIcon, { isOpen: expanded })
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
] }),
|
|
544
|
+
hasChildren && expanded && /* @__PURE__ */ jsx("ul", { style: { listStyle: "none", margin: 0, padding: 0 }, children: item.children.map((child) => /* @__PURE__ */ jsx(
|
|
545
|
+
MenuItemComponent,
|
|
546
|
+
{
|
|
547
|
+
item: child,
|
|
548
|
+
onItemClick,
|
|
549
|
+
currentPath,
|
|
550
|
+
depth: depth + 1
|
|
551
|
+
},
|
|
552
|
+
child.id
|
|
553
|
+
)) }),
|
|
554
|
+
item.dividerAfter && /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("hr", { style: {
|
|
555
|
+
border: "none",
|
|
556
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
557
|
+
margin: "8px 0"
|
|
558
|
+
} }) })
|
|
559
|
+
] });
|
|
560
|
+
}
|
|
561
|
+
function SidebarMenu({ menuItems, onItemClick, currentPath, collapsed, onExpandRequest }) {
|
|
562
|
+
return /* @__PURE__ */ jsx("nav", { style: {
|
|
563
|
+
padding: collapsed ? "8px 8px" : "8px 12px"
|
|
564
|
+
}, children: /* @__PURE__ */ jsx("ul", { style: {
|
|
565
|
+
listStyle: "none",
|
|
566
|
+
margin: 0,
|
|
567
|
+
padding: 0,
|
|
568
|
+
display: "flex",
|
|
569
|
+
flexDirection: "column",
|
|
570
|
+
gap: "2px"
|
|
571
|
+
}, children: menuItems.map((item) => /* @__PURE__ */ jsx(
|
|
572
|
+
MenuItemComponent,
|
|
573
|
+
{
|
|
574
|
+
item,
|
|
575
|
+
onItemClick,
|
|
576
|
+
currentPath,
|
|
577
|
+
collapsed,
|
|
578
|
+
onExpandRequest
|
|
579
|
+
},
|
|
580
|
+
item.id
|
|
581
|
+
)) }) });
|
|
582
|
+
}
|
|
583
|
+
function LogoutIcon() {
|
|
584
|
+
return /* @__PURE__ */ jsxs(
|
|
585
|
+
"svg",
|
|
586
|
+
{
|
|
587
|
+
width: "20",
|
|
588
|
+
height: "20",
|
|
589
|
+
viewBox: "0 0 24 24",
|
|
590
|
+
fill: "none",
|
|
591
|
+
stroke: "currentColor",
|
|
592
|
+
strokeWidth: "2",
|
|
593
|
+
strokeLinecap: "round",
|
|
594
|
+
strokeLinejoin: "round",
|
|
595
|
+
children: [
|
|
596
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
597
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
|
|
598
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
|
|
599
|
+
]
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
603
|
+
function AvatarPlaceholder({ size = 40 }) {
|
|
604
|
+
return /* @__PURE__ */ jsx(
|
|
605
|
+
"div",
|
|
606
|
+
{
|
|
607
|
+
style: {
|
|
608
|
+
width: `${size}px`,
|
|
609
|
+
height: `${size}px`,
|
|
610
|
+
borderRadius: "50%",
|
|
611
|
+
backgroundColor: "#f1f5f9",
|
|
612
|
+
display: "flex",
|
|
613
|
+
alignItems: "center",
|
|
614
|
+
justifyContent: "center",
|
|
615
|
+
flexShrink: 0,
|
|
616
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.05)"
|
|
617
|
+
},
|
|
618
|
+
children: /* @__PURE__ */ jsx("svg", { width: size * 0.6, height: size * 0.6, viewBox: "0 0 24 24", fill: "#94a3b8", children: /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) })
|
|
619
|
+
}
|
|
620
|
+
);
|
|
621
|
+
}
|
|
622
|
+
function SidebarUserProfile({
|
|
623
|
+
user,
|
|
624
|
+
roleLabel,
|
|
625
|
+
onLogout,
|
|
626
|
+
collapsed
|
|
627
|
+
}) {
|
|
628
|
+
const isDark = useDarkMode();
|
|
629
|
+
const [imgError, setImgError] = useState(false);
|
|
630
|
+
useEffect(() => {
|
|
631
|
+
setImgError(false);
|
|
632
|
+
}, [user?.pictureUrl]);
|
|
633
|
+
if (!user) return null;
|
|
634
|
+
const getFullName = () => {
|
|
635
|
+
if (user.firstName && user.lastName) {
|
|
636
|
+
return `${user.firstName} ${user.lastName}`;
|
|
637
|
+
}
|
|
638
|
+
return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
|
|
639
|
+
};
|
|
640
|
+
if (collapsed) {
|
|
641
|
+
return /* @__PURE__ */ jsxs("div", { style: {
|
|
642
|
+
padding: "12px 8px",
|
|
643
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
644
|
+
display: "flex",
|
|
645
|
+
flexDirection: "column",
|
|
646
|
+
alignItems: "center",
|
|
647
|
+
gap: "12px"
|
|
648
|
+
}, children: [
|
|
649
|
+
/* @__PURE__ */ jsx(
|
|
650
|
+
"div",
|
|
651
|
+
{
|
|
652
|
+
title: getFullName(),
|
|
653
|
+
children: user.pictureUrl && !imgError ? /* @__PURE__ */ jsx(
|
|
654
|
+
"img",
|
|
655
|
+
{
|
|
656
|
+
src: user.pictureUrl,
|
|
657
|
+
alt: getFullName(),
|
|
658
|
+
onError: () => setImgError(true),
|
|
659
|
+
style: {
|
|
660
|
+
width: "36px",
|
|
661
|
+
height: "36px",
|
|
662
|
+
borderRadius: "50%",
|
|
663
|
+
objectFit: "cover",
|
|
664
|
+
flexShrink: 0
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
) : /* @__PURE__ */ jsx(AvatarPlaceholder, { size: 36 })
|
|
668
|
+
}
|
|
669
|
+
),
|
|
670
|
+
/* @__PURE__ */ jsx(
|
|
671
|
+
"button",
|
|
672
|
+
{
|
|
673
|
+
onClick: onLogout,
|
|
674
|
+
title: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
|
|
675
|
+
"aria-label": "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
|
|
676
|
+
onMouseEnter: (e) => {
|
|
677
|
+
e.currentTarget.style.backgroundColor = "var(--color-foundations-fuan-pallet-light, #ffd2d2)";
|
|
678
|
+
},
|
|
679
|
+
onMouseLeave: (e) => {
|
|
680
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
681
|
+
},
|
|
682
|
+
style: {
|
|
683
|
+
width: "36px",
|
|
684
|
+
height: "36px",
|
|
685
|
+
borderRadius: "8px",
|
|
686
|
+
border: "none",
|
|
687
|
+
background: "transparent",
|
|
688
|
+
color: "var(--color-alias-semantic-critical, #f21515)",
|
|
689
|
+
cursor: "pointer",
|
|
690
|
+
display: "flex",
|
|
691
|
+
alignItems: "center",
|
|
692
|
+
justifyContent: "center",
|
|
693
|
+
transition: "background-color 0.15s ease"
|
|
694
|
+
},
|
|
695
|
+
children: /* @__PURE__ */ jsx(LogoutIcon, {})
|
|
696
|
+
}
|
|
697
|
+
)
|
|
698
|
+
] });
|
|
699
|
+
}
|
|
700
|
+
return /* @__PURE__ */ jsxs(
|
|
701
|
+
"div",
|
|
702
|
+
{
|
|
703
|
+
style: {
|
|
704
|
+
padding: "16px 20px",
|
|
705
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
706
|
+
display: "flex",
|
|
707
|
+
alignItems: "center",
|
|
708
|
+
gap: "12px"
|
|
709
|
+
},
|
|
710
|
+
children: [
|
|
711
|
+
/* @__PURE__ */ jsxs(
|
|
712
|
+
"div",
|
|
713
|
+
{
|
|
714
|
+
style: {
|
|
715
|
+
display: "flex",
|
|
716
|
+
alignItems: "center",
|
|
717
|
+
gap: "12px",
|
|
718
|
+
flex: 1,
|
|
719
|
+
minWidth: 0,
|
|
720
|
+
cursor: "default",
|
|
721
|
+
transition: "opacity 0.15s ease"
|
|
722
|
+
},
|
|
723
|
+
children: [
|
|
724
|
+
user.pictureUrl && !imgError ? /* @__PURE__ */ jsx(
|
|
725
|
+
"img",
|
|
726
|
+
{
|
|
727
|
+
src: user.pictureUrl,
|
|
728
|
+
alt: getFullName(),
|
|
729
|
+
onError: () => setImgError(true),
|
|
730
|
+
style: {
|
|
731
|
+
width: "40px",
|
|
732
|
+
height: "40px",
|
|
733
|
+
borderRadius: "50%",
|
|
734
|
+
objectFit: "cover",
|
|
735
|
+
flexShrink: 0
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
) : /* @__PURE__ */ jsx(AvatarPlaceholder, { size: 40 }),
|
|
739
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
740
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
741
|
+
fontWeight: 600,
|
|
742
|
+
fontSize: "14px",
|
|
743
|
+
lineHeight: "20px",
|
|
744
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
745
|
+
margin: 0,
|
|
746
|
+
overflow: "hidden",
|
|
747
|
+
textOverflow: "ellipsis",
|
|
748
|
+
whiteSpace: "nowrap"
|
|
749
|
+
}, children: getFullName() }),
|
|
750
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
751
|
+
fontSize: "12px",
|
|
752
|
+
lineHeight: "16px",
|
|
753
|
+
color: isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
754
|
+
margin: 0
|
|
755
|
+
}, children: roleLabel })
|
|
756
|
+
] })
|
|
757
|
+
]
|
|
758
|
+
}
|
|
759
|
+
),
|
|
760
|
+
/* @__PURE__ */ jsx(
|
|
761
|
+
"button",
|
|
762
|
+
{
|
|
763
|
+
onClick: onLogout,
|
|
764
|
+
title: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
|
|
765
|
+
"aria-label": "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A",
|
|
766
|
+
onMouseEnter: (e) => {
|
|
767
|
+
e.currentTarget.style.backgroundColor = "var(--color-foundations-fuan-pallet-light, #ffd2d2)";
|
|
768
|
+
e.currentTarget.style.color = "var(--color-alias-semantic-critical, #f21515)";
|
|
769
|
+
},
|
|
770
|
+
onMouseLeave: (e) => {
|
|
771
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
772
|
+
e.currentTarget.style.color = "var(--color-alias-semantic-critical, #f21515)";
|
|
773
|
+
},
|
|
774
|
+
style: {
|
|
775
|
+
width: "36px",
|
|
776
|
+
height: "36px",
|
|
777
|
+
borderRadius: "8px",
|
|
778
|
+
border: "none",
|
|
779
|
+
background: "transparent",
|
|
780
|
+
color: "var(--color-alias-semantic-critical, #f21515)",
|
|
781
|
+
cursor: "pointer",
|
|
782
|
+
display: "flex",
|
|
783
|
+
alignItems: "center",
|
|
784
|
+
justifyContent: "center",
|
|
785
|
+
transition: "background-color 0.15s ease",
|
|
786
|
+
flexShrink: 0
|
|
787
|
+
},
|
|
788
|
+
children: /* @__PURE__ */ jsx(LogoutIcon, {})
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
]
|
|
792
|
+
}
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
var FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])';
|
|
796
|
+
function useFocusTrap(ref, active) {
|
|
797
|
+
useEffect(() => {
|
|
798
|
+
if (!active) return;
|
|
799
|
+
const container = ref.current;
|
|
800
|
+
if (!container) return;
|
|
801
|
+
const previouslyFocused = document.activeElement;
|
|
802
|
+
const getItems = () => Array.from(container.querySelectorAll(FOCUSABLE)).filter(
|
|
803
|
+
(el) => el.offsetParent !== null || el === document.activeElement
|
|
804
|
+
);
|
|
805
|
+
const t = window.setTimeout(() => {
|
|
806
|
+
const items = getItems();
|
|
807
|
+
(items[0] ?? container).focus?.();
|
|
808
|
+
}, 50);
|
|
809
|
+
const onKeyDown = (e) => {
|
|
810
|
+
if (e.key !== "Tab") return;
|
|
811
|
+
const items = getItems();
|
|
812
|
+
if (items.length === 0) {
|
|
813
|
+
e.preventDefault();
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
const first = items[0];
|
|
817
|
+
const last = items[items.length - 1];
|
|
818
|
+
const current = document.activeElement;
|
|
819
|
+
if (e.shiftKey && (current === first || !container.contains(current))) {
|
|
820
|
+
e.preventDefault();
|
|
821
|
+
last.focus();
|
|
822
|
+
} else if (!e.shiftKey && (current === last || !container.contains(current))) {
|
|
823
|
+
e.preventDefault();
|
|
824
|
+
first.focus();
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
document.addEventListener("keydown", onKeyDown);
|
|
828
|
+
return () => {
|
|
829
|
+
window.clearTimeout(t);
|
|
830
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
831
|
+
previouslyFocused?.focus?.();
|
|
832
|
+
};
|
|
833
|
+
}, [ref, active]);
|
|
834
|
+
}
|
|
835
|
+
function useIsMobile(breakpoint = 768) {
|
|
836
|
+
const [isMobile, setIsMobile] = useState(false);
|
|
837
|
+
const [ready, setReady] = useState(false);
|
|
838
|
+
useEffect(() => {
|
|
839
|
+
if (typeof window === "undefined") return;
|
|
840
|
+
const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
|
|
841
|
+
setIsMobile(mql.matches);
|
|
842
|
+
setReady(true);
|
|
843
|
+
const handler = (e) => setIsMobile(e.matches);
|
|
844
|
+
mql.addEventListener("change", handler);
|
|
845
|
+
return () => mql.removeEventListener("change", handler);
|
|
846
|
+
}, [breakpoint]);
|
|
847
|
+
return { isMobile, ready };
|
|
848
|
+
}
|
|
849
|
+
function ToggleIcon({ isOpen }) {
|
|
850
|
+
return /* @__PURE__ */ jsx(
|
|
851
|
+
"svg",
|
|
852
|
+
{
|
|
853
|
+
width: "18",
|
|
854
|
+
height: "18",
|
|
855
|
+
viewBox: "0 0 24 24",
|
|
856
|
+
fill: "none",
|
|
857
|
+
stroke: "currentColor",
|
|
858
|
+
strokeWidth: "2",
|
|
859
|
+
strokeLinecap: "round",
|
|
860
|
+
strokeLinejoin: "round",
|
|
861
|
+
style: {
|
|
862
|
+
transition: "transform 0.2s ease",
|
|
863
|
+
transform: isOpen ? "rotate(0deg)" : "rotate(180deg)"
|
|
864
|
+
},
|
|
865
|
+
children: /* @__PURE__ */ jsx("path", { d: "M15 18l-6-6 6-6" })
|
|
866
|
+
}
|
|
867
|
+
);
|
|
868
|
+
}
|
|
869
|
+
function HamburgerIcon() {
|
|
870
|
+
return /* @__PURE__ */ jsx("svg", { width: "24", height: "18", viewBox: "0 0 27 18", fill: "none", children: /* @__PURE__ */ jsx(
|
|
871
|
+
"path",
|
|
872
|
+
{
|
|
873
|
+
d: "M1.1875 17.8426C0.851042 17.8426 0.569077 17.7287 0.341604 17.501C0.113868 17.2735 0 16.9914 0 16.6547C0 16.3182 0.113868 16.0363 0.341604 15.8088C0.569077 15.5816 0.851042 15.468 1.1875 15.468H25.7292C26.0656 15.468 26.3476 15.5817 26.5751 15.8092C26.8028 16.0369 26.9167 16.3192 26.9167 16.6559C26.9167 16.9923 26.8028 17.2743 26.5751 17.5018C26.3476 17.729 26.0656 17.8426 25.7292 17.8426H1.1875ZM1.1875 10.1088C0.851042 10.1088 0.569077 9.99492 0.341604 9.76719C0.113868 9.53945 0 9.25735 0 8.9209C0 8.58417 0.113868 8.30221 0.341604 8.075C0.569077 7.84753 0.851042 7.73379 1.1875 7.73379H25.7292C26.0656 7.73379 26.3476 7.84766 26.5751 8.0754C26.8028 8.30313 26.9167 8.58523 26.9167 8.92169C26.9167 9.25841 26.8028 9.54037 26.5751 9.76758C26.3476 9.99506 26.0656 10.1088 25.7292 10.1088H1.1875ZM1.1875 2.3746C0.851042 2.3746 0.569077 2.26087 0.341604 2.0334C0.113868 1.80566 0 1.52343 0 1.18671C0 0.850249 0.113868 0.568284 0.341604 0.340812C0.569077 0.113604 0.851042 0 1.1875 0H25.7292C26.0656 0 26.3476 0.113868 26.5751 0.341604C26.8028 0.569077 26.9167 0.851174 26.9167 1.1879C26.9167 1.52435 26.8028 1.80632 26.5751 2.03379C26.3476 2.261 26.0656 2.3746 25.7292 2.3746H1.1875Z",
|
|
874
|
+
fill: "currentColor"
|
|
875
|
+
}
|
|
876
|
+
) });
|
|
877
|
+
}
|
|
878
|
+
function CloseIcon() {
|
|
879
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
880
|
+
/* @__PURE__ */ jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
|
|
881
|
+
/* @__PURE__ */ jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
|
|
882
|
+
] });
|
|
883
|
+
}
|
|
884
|
+
function HelpCircleIcon2() {
|
|
885
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
886
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
887
|
+
/* @__PURE__ */ jsx("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
888
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
889
|
+
] });
|
|
890
|
+
}
|
|
891
|
+
function GearIcon2() {
|
|
892
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
893
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "3" }),
|
|
894
|
+
/* @__PURE__ */ jsx("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06A1.65 1.65 0 0 0 4.68 15a1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06A1.65 1.65 0 0 0 9 4.68a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
|
|
895
|
+
] });
|
|
896
|
+
}
|
|
897
|
+
var DEFAULT_BOTTOM_MENU = [
|
|
898
|
+
{ id: "settings", title: "\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E23\u0E30\u0E1A\u0E1A", icon: /* @__PURE__ */ jsx(GearIcon2, {}), path: "/settings" },
|
|
899
|
+
{ id: "help", title: "\u0E0A\u0E48\u0E27\u0E22\u0E40\u0E2B\u0E25\u0E37\u0E2D", icon: /* @__PURE__ */ jsx(HelpCircleIcon2, {}), path: "/help" }
|
|
900
|
+
];
|
|
901
|
+
function StaffSidebar({
|
|
902
|
+
orgLogo,
|
|
903
|
+
orgName,
|
|
904
|
+
orgSubtitle,
|
|
905
|
+
menuItems,
|
|
906
|
+
bottomMenuItems,
|
|
907
|
+
user,
|
|
908
|
+
roleLabel,
|
|
909
|
+
onNavigate,
|
|
910
|
+
onLogout,
|
|
911
|
+
onProfile,
|
|
912
|
+
currentPath,
|
|
913
|
+
width = "280px",
|
|
914
|
+
className,
|
|
915
|
+
collapsible = false,
|
|
916
|
+
isOpen: controlledIsOpen,
|
|
917
|
+
onToggle,
|
|
918
|
+
onExpandRequest,
|
|
919
|
+
topOffset = 0,
|
|
920
|
+
mobileBreakpoint = 768
|
|
921
|
+
}) {
|
|
922
|
+
const isDark = useDarkMode();
|
|
923
|
+
const { isMobile, ready } = useIsMobile(mobileBreakpoint);
|
|
924
|
+
const drawerRef = useRef(null);
|
|
925
|
+
const [internalOpen, setInternalOpen] = useState(true);
|
|
926
|
+
const [mobileDrawerOpen, setMobileDrawerOpen] = useState(false);
|
|
927
|
+
const sidebarOpen = controlledIsOpen !== void 0 ? controlledIsOpen : internalOpen;
|
|
928
|
+
const collapsed = collapsible && !sidebarOpen;
|
|
929
|
+
const collapsedWidth = "64px";
|
|
930
|
+
const currentWidth = collapsed ? collapsedWidth : width;
|
|
931
|
+
const resolvedBottomMenu = bottomMenuItems !== void 0 ? bottomMenuItems : DEFAULT_BOTTOM_MENU;
|
|
932
|
+
const handleToggle = () => {
|
|
933
|
+
if (onToggle) {
|
|
934
|
+
onToggle();
|
|
935
|
+
} else {
|
|
936
|
+
setInternalOpen(!internalOpen);
|
|
937
|
+
}
|
|
938
|
+
};
|
|
939
|
+
const handleExpandRequest = () => {
|
|
940
|
+
if (onExpandRequest) {
|
|
941
|
+
onExpandRequest();
|
|
942
|
+
} else {
|
|
943
|
+
if (onToggle) {
|
|
944
|
+
onToggle();
|
|
945
|
+
} else {
|
|
946
|
+
setInternalOpen(true);
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
useFocusTrap(drawerRef, isMobile && mobileDrawerOpen);
|
|
951
|
+
const openDrawer = useCallback(() => setMobileDrawerOpen(true), []);
|
|
952
|
+
const closeDrawer = useCallback(() => setMobileDrawerOpen(false), []);
|
|
953
|
+
const handleMobileNavigate = useCallback((path) => {
|
|
954
|
+
onNavigate(path);
|
|
955
|
+
if (isMobile) closeDrawer();
|
|
956
|
+
}, [onNavigate, isMobile, closeDrawer]);
|
|
957
|
+
useEffect(() => {
|
|
958
|
+
if (isMobile && mobileDrawerOpen) {
|
|
959
|
+
const originalOverflow = document.body.style.overflow;
|
|
960
|
+
document.body.style.overflow = "hidden";
|
|
961
|
+
return () => {
|
|
962
|
+
document.body.style.overflow = originalOverflow;
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
}, [isMobile, mobileDrawerOpen]);
|
|
966
|
+
useEffect(() => {
|
|
967
|
+
if (!isMobile || !mobileDrawerOpen) return;
|
|
968
|
+
const handler = (e) => {
|
|
969
|
+
if (e.key === "Escape") closeDrawer();
|
|
970
|
+
};
|
|
971
|
+
window.addEventListener("keydown", handler);
|
|
972
|
+
return () => window.removeEventListener("keydown", handler);
|
|
973
|
+
}, [isMobile, mobileDrawerOpen, closeDrawer]);
|
|
974
|
+
if (!ready) return null;
|
|
975
|
+
if (isMobile) {
|
|
976
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
977
|
+
/* @__PURE__ */ jsxs(
|
|
978
|
+
"header",
|
|
979
|
+
{
|
|
980
|
+
style: {
|
|
981
|
+
position: "sticky",
|
|
982
|
+
top: 0,
|
|
983
|
+
left: 0,
|
|
984
|
+
right: 0,
|
|
985
|
+
height: "60px",
|
|
986
|
+
background: "linear-gradient(to bottom left, #3AAE7D, #346D55)",
|
|
987
|
+
display: "flex",
|
|
988
|
+
alignItems: "center",
|
|
989
|
+
justifyContent: "space-between",
|
|
990
|
+
padding: "0 16px",
|
|
991
|
+
zIndex: 49,
|
|
992
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)"
|
|
993
|
+
},
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px", flex: 1, minWidth: 0 }, children: [
|
|
996
|
+
orgLogo ? /* @__PURE__ */ jsx(
|
|
997
|
+
"img",
|
|
998
|
+
{
|
|
999
|
+
src: orgLogo,
|
|
1000
|
+
alt: orgName,
|
|
1001
|
+
style: {
|
|
1002
|
+
width: "40px",
|
|
1003
|
+
height: "40px",
|
|
1004
|
+
borderRadius: "50%",
|
|
1005
|
+
objectFit: "cover",
|
|
1006
|
+
flexShrink: 0,
|
|
1007
|
+
border: "2px solid rgba(255,255,255,0.3)"
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
) : /* @__PURE__ */ jsx("div", { style: {
|
|
1011
|
+
width: "40px",
|
|
1012
|
+
height: "40px",
|
|
1013
|
+
borderRadius: "50%",
|
|
1014
|
+
background: "rgba(255,255,255,0.2)",
|
|
1015
|
+
display: "flex",
|
|
1016
|
+
alignItems: "center",
|
|
1017
|
+
justifyContent: "center",
|
|
1018
|
+
color: "#fff",
|
|
1019
|
+
fontWeight: 700,
|
|
1020
|
+
fontSize: "16px",
|
|
1021
|
+
flexShrink: 0
|
|
1022
|
+
}, children: orgName.slice(0, 2) }),
|
|
1023
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
1024
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
1025
|
+
color: "#fff",
|
|
1026
|
+
fontWeight: 700,
|
|
1027
|
+
fontSize: "15px",
|
|
1028
|
+
lineHeight: "20px",
|
|
1029
|
+
margin: 0,
|
|
1030
|
+
overflow: "hidden",
|
|
1031
|
+
textOverflow: "ellipsis",
|
|
1032
|
+
whiteSpace: "nowrap"
|
|
1033
|
+
}, children: orgName }),
|
|
1034
|
+
orgSubtitle && /* @__PURE__ */ jsx("p", { style: {
|
|
1035
|
+
color: "rgba(255,255,255,0.75)",
|
|
1036
|
+
fontSize: "12px",
|
|
1037
|
+
lineHeight: "16px",
|
|
1038
|
+
margin: 0,
|
|
1039
|
+
overflow: "hidden",
|
|
1040
|
+
textOverflow: "ellipsis",
|
|
1041
|
+
whiteSpace: "nowrap"
|
|
1042
|
+
}, children: orgSubtitle })
|
|
1043
|
+
] })
|
|
1044
|
+
] }),
|
|
1045
|
+
/* @__PURE__ */ jsx(
|
|
1046
|
+
"button",
|
|
1047
|
+
{
|
|
1048
|
+
onClick: openDrawer,
|
|
1049
|
+
"aria-label": "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
|
|
1050
|
+
style: {
|
|
1051
|
+
width: "44px",
|
|
1052
|
+
height: "44px",
|
|
1053
|
+
borderRadius: "10px",
|
|
1054
|
+
border: "none",
|
|
1055
|
+
background: "rgba(255,255,255,0.12)",
|
|
1056
|
+
cursor: "pointer",
|
|
1057
|
+
display: "flex",
|
|
1058
|
+
alignItems: "center",
|
|
1059
|
+
justifyContent: "center",
|
|
1060
|
+
color: "#ffffff",
|
|
1061
|
+
flexShrink: 0,
|
|
1062
|
+
transition: "background-color 0.15s ease",
|
|
1063
|
+
WebkitTapHighlightColor: "transparent"
|
|
1064
|
+
},
|
|
1065
|
+
children: /* @__PURE__ */ jsx(HamburgerIcon, {})
|
|
1066
|
+
}
|
|
1067
|
+
)
|
|
1068
|
+
]
|
|
1069
|
+
}
|
|
1070
|
+
),
|
|
1071
|
+
/* @__PURE__ */ jsx(
|
|
1072
|
+
"div",
|
|
1073
|
+
{
|
|
1074
|
+
onClick: closeDrawer,
|
|
1075
|
+
"aria-hidden": "true",
|
|
1076
|
+
style: {
|
|
1077
|
+
position: "fixed",
|
|
1078
|
+
inset: 0,
|
|
1079
|
+
background: "rgba(0,0,0,0.45)",
|
|
1080
|
+
zIndex: 99,
|
|
1081
|
+
opacity: mobileDrawerOpen ? 1 : 0,
|
|
1082
|
+
pointerEvents: mobileDrawerOpen ? "auto" : "none",
|
|
1083
|
+
transition: "opacity 0.3s ease",
|
|
1084
|
+
WebkitTapHighlightColor: "transparent"
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
),
|
|
1088
|
+
/* @__PURE__ */ jsxs(
|
|
1089
|
+
"aside",
|
|
1090
|
+
{
|
|
1091
|
+
ref: drawerRef,
|
|
1092
|
+
role: "dialog",
|
|
1093
|
+
"aria-modal": mobileDrawerOpen,
|
|
1094
|
+
className,
|
|
1095
|
+
"aria-hidden": !mobileDrawerOpen,
|
|
1096
|
+
"aria-label": "\u0E40\u0E21\u0E19\u0E39\u0E2B\u0E25\u0E31\u0E01",
|
|
1097
|
+
...!mobileDrawerOpen ? { inert: true } : {},
|
|
1098
|
+
style: {
|
|
1099
|
+
visibility: mobileDrawerOpen ? "visible" : "hidden",
|
|
1100
|
+
position: "fixed",
|
|
1101
|
+
top: 0,
|
|
1102
|
+
left: 0,
|
|
1103
|
+
bottom: 0,
|
|
1104
|
+
width: "min(85vw, 320px)",
|
|
1105
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1106
|
+
zIndex: 100,
|
|
1107
|
+
display: "flex",
|
|
1108
|
+
flexDirection: "column",
|
|
1109
|
+
overflow: "hidden",
|
|
1110
|
+
boxShadow: mobileDrawerOpen ? "4px 0 24px rgba(0,0,0,0.2)" : "none",
|
|
1111
|
+
transform: mobileDrawerOpen ? "translateX(0)" : "translateX(-100%)",
|
|
1112
|
+
transition: mobileDrawerOpen ? "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)" : "transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.3s",
|
|
1113
|
+
color: isDark ? "#ffffff" : void 0
|
|
1114
|
+
},
|
|
1115
|
+
children: [
|
|
1116
|
+
/* @__PURE__ */ jsxs("div", { style: {
|
|
1117
|
+
display: "flex",
|
|
1118
|
+
alignItems: "center",
|
|
1119
|
+
justifyContent: "space-between",
|
|
1120
|
+
padding: "16px 16px 16px 20px",
|
|
1121
|
+
background: "linear-gradient(to bottom left, #3AAE7D, #346D55)",
|
|
1122
|
+
flexShrink: 0
|
|
1123
|
+
}, children: [
|
|
1124
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "12px", flex: 1, minWidth: 0 }, children: [
|
|
1125
|
+
orgLogo ? /* @__PURE__ */ jsx(
|
|
1126
|
+
"img",
|
|
1127
|
+
{
|
|
1128
|
+
src: orgLogo,
|
|
1129
|
+
alt: orgName,
|
|
1130
|
+
style: {
|
|
1131
|
+
width: "44px",
|
|
1132
|
+
height: "44px",
|
|
1133
|
+
borderRadius: "50%",
|
|
1134
|
+
objectFit: "cover",
|
|
1135
|
+
flexShrink: 0,
|
|
1136
|
+
border: "2px solid rgba(255,255,255,0.3)"
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
) : /* @__PURE__ */ jsx("div", { style: {
|
|
1140
|
+
width: "44px",
|
|
1141
|
+
height: "44px",
|
|
1142
|
+
borderRadius: "50%",
|
|
1143
|
+
background: "rgba(255,255,255,0.2)",
|
|
1144
|
+
display: "flex",
|
|
1145
|
+
alignItems: "center",
|
|
1146
|
+
justifyContent: "center",
|
|
1147
|
+
color: "#fff",
|
|
1148
|
+
fontWeight: 700,
|
|
1149
|
+
fontSize: "16px",
|
|
1150
|
+
flexShrink: 0
|
|
1151
|
+
}, children: orgName.slice(0, 2) }),
|
|
1152
|
+
/* @__PURE__ */ jsxs("div", { style: { minWidth: 0 }, children: [
|
|
1153
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
1154
|
+
color: "#fff",
|
|
1155
|
+
fontWeight: 700,
|
|
1156
|
+
fontSize: "15px",
|
|
1157
|
+
lineHeight: "20px",
|
|
1158
|
+
margin: 0,
|
|
1159
|
+
overflow: "hidden",
|
|
1160
|
+
textOverflow: "ellipsis",
|
|
1161
|
+
whiteSpace: "nowrap"
|
|
1162
|
+
}, children: orgName }),
|
|
1163
|
+
orgSubtitle && /* @__PURE__ */ jsx("p", { style: {
|
|
1164
|
+
color: "rgba(255,255,255,0.75)",
|
|
1165
|
+
fontSize: "12px",
|
|
1166
|
+
lineHeight: "16px",
|
|
1167
|
+
margin: 0
|
|
1168
|
+
}, children: orgSubtitle })
|
|
1169
|
+
] })
|
|
1170
|
+
] }),
|
|
1171
|
+
/* @__PURE__ */ jsx(
|
|
1172
|
+
"button",
|
|
1173
|
+
{
|
|
1174
|
+
onClick: closeDrawer,
|
|
1175
|
+
"aria-label": "\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
|
|
1176
|
+
style: {
|
|
1177
|
+
width: "40px",
|
|
1178
|
+
height: "40px",
|
|
1179
|
+
borderRadius: "10px",
|
|
1180
|
+
border: "none",
|
|
1181
|
+
background: "rgba(255,255,255,0.15)",
|
|
1182
|
+
cursor: "pointer",
|
|
1183
|
+
display: "flex",
|
|
1184
|
+
alignItems: "center",
|
|
1185
|
+
justifyContent: "center",
|
|
1186
|
+
color: "#ffffff",
|
|
1187
|
+
flexShrink: 0,
|
|
1188
|
+
transition: "background-color 0.15s ease",
|
|
1189
|
+
WebkitTapHighlightColor: "transparent"
|
|
1190
|
+
},
|
|
1191
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
1192
|
+
}
|
|
1193
|
+
)
|
|
1194
|
+
] }),
|
|
1195
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, overflowY: "auto", minHeight: 0 }, children: /* @__PURE__ */ jsx(
|
|
1196
|
+
SidebarMenu,
|
|
1197
|
+
{
|
|
1198
|
+
menuItems,
|
|
1199
|
+
onItemClick: handleMobileNavigate,
|
|
1200
|
+
currentPath,
|
|
1201
|
+
collapsed: false
|
|
1202
|
+
}
|
|
1203
|
+
) }),
|
|
1204
|
+
/* @__PURE__ */ jsxs("div", { style: { flexShrink: 0 }, children: [
|
|
1205
|
+
resolvedBottomMenu && resolvedBottomMenu.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1206
|
+
/* @__PURE__ */ jsx("hr", { style: {
|
|
1207
|
+
border: "none",
|
|
1208
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1209
|
+
margin: "4px 12px"
|
|
1210
|
+
} }),
|
|
1211
|
+
/* @__PURE__ */ jsx(
|
|
1212
|
+
SidebarMenu,
|
|
1213
|
+
{
|
|
1214
|
+
menuItems: resolvedBottomMenu,
|
|
1215
|
+
onItemClick: handleMobileNavigate,
|
|
1216
|
+
currentPath,
|
|
1217
|
+
collapsed: false
|
|
1218
|
+
}
|
|
1219
|
+
)
|
|
1220
|
+
] }),
|
|
1221
|
+
/* @__PURE__ */ jsx(
|
|
1222
|
+
SidebarUserProfile,
|
|
1223
|
+
{
|
|
1224
|
+
user,
|
|
1225
|
+
roleLabel,
|
|
1226
|
+
onLogout: () => {
|
|
1227
|
+
closeDrawer();
|
|
1228
|
+
onLogout();
|
|
1229
|
+
},
|
|
1230
|
+
onProfile: onProfile ? () => {
|
|
1231
|
+
closeDrawer();
|
|
1232
|
+
onProfile();
|
|
1233
|
+
} : void 0,
|
|
1234
|
+
collapsed: false
|
|
1235
|
+
}
|
|
1236
|
+
)
|
|
1237
|
+
] })
|
|
1238
|
+
]
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1241
|
+
] });
|
|
1242
|
+
}
|
|
1243
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1244
|
+
/* @__PURE__ */ jsxs(
|
|
1245
|
+
"aside",
|
|
1246
|
+
{
|
|
1247
|
+
className,
|
|
1248
|
+
style: {
|
|
1249
|
+
position: "fixed",
|
|
1250
|
+
top: topOffset,
|
|
1251
|
+
left: 0,
|
|
1252
|
+
height: `calc(100vh - ${typeof topOffset === "number" ? topOffset + "px" : topOffset})`,
|
|
1253
|
+
width: currentWidth,
|
|
1254
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1255
|
+
borderRight: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1256
|
+
display: "flex",
|
|
1257
|
+
flexDirection: "column",
|
|
1258
|
+
zIndex: 50,
|
|
1259
|
+
overflow: "hidden",
|
|
1260
|
+
transition: "width 0.3s ease",
|
|
1261
|
+
color: isDark ? "#ffffff" : void 0
|
|
1262
|
+
},
|
|
1263
|
+
children: [
|
|
1264
|
+
/* @__PURE__ */ jsx(
|
|
1265
|
+
SidebarHeader,
|
|
1266
|
+
{
|
|
1267
|
+
orgLogo,
|
|
1268
|
+
orgName,
|
|
1269
|
+
orgSubtitle,
|
|
1270
|
+
collapsed
|
|
1271
|
+
}
|
|
1272
|
+
),
|
|
1273
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, overflowY: "auto", minHeight: 0 }, children: /* @__PURE__ */ jsx(
|
|
1274
|
+
SidebarMenu,
|
|
1275
|
+
{
|
|
1276
|
+
menuItems,
|
|
1277
|
+
onItemClick: onNavigate,
|
|
1278
|
+
currentPath,
|
|
1279
|
+
collapsed,
|
|
1280
|
+
onExpandRequest: handleExpandRequest
|
|
1281
|
+
}
|
|
1282
|
+
) }),
|
|
1283
|
+
/* @__PURE__ */ jsxs("div", { style: { flexShrink: 0 }, children: [
|
|
1284
|
+
resolvedBottomMenu && resolvedBottomMenu.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1285
|
+
/* @__PURE__ */ jsx("hr", { style: {
|
|
1286
|
+
border: "none",
|
|
1287
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1288
|
+
margin: "4px 12px"
|
|
1289
|
+
} }),
|
|
1290
|
+
/* @__PURE__ */ jsx(
|
|
1291
|
+
SidebarMenu,
|
|
1292
|
+
{
|
|
1293
|
+
menuItems: resolvedBottomMenu,
|
|
1294
|
+
onItemClick: onNavigate,
|
|
1295
|
+
currentPath,
|
|
1296
|
+
collapsed,
|
|
1297
|
+
onExpandRequest: handleExpandRequest
|
|
1298
|
+
}
|
|
1299
|
+
)
|
|
1300
|
+
] }),
|
|
1301
|
+
/* @__PURE__ */ jsx(
|
|
1302
|
+
SidebarUserProfile,
|
|
1303
|
+
{
|
|
1304
|
+
user,
|
|
1305
|
+
roleLabel,
|
|
1306
|
+
onLogout,
|
|
1307
|
+
onProfile,
|
|
1308
|
+
collapsed
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
] })
|
|
1312
|
+
]
|
|
1313
|
+
}
|
|
1314
|
+
),
|
|
1315
|
+
collapsible && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1316
|
+
/* @__PURE__ */ jsx("style", { children: `@media(hover:hover){.sidebar-toggle-btn:hover{background-color:${isDark ? "#374151" : "#f3f4f6"}!important}}` }),
|
|
1317
|
+
/* @__PURE__ */ jsx(
|
|
1318
|
+
"button",
|
|
1319
|
+
{
|
|
1320
|
+
className: "sidebar-toggle-btn",
|
|
1321
|
+
onClick: handleToggle,
|
|
1322
|
+
title: sidebarOpen ? "\u0E22\u0E48\u0E2D Sidebar" : "\u0E02\u0E22\u0E32\u0E22 Sidebar",
|
|
1323
|
+
style: {
|
|
1324
|
+
position: "fixed",
|
|
1325
|
+
top: `calc(${typeof topOffset === "number" ? topOffset + "px" : topOffset} + 10vh)`,
|
|
1326
|
+
left: currentWidth,
|
|
1327
|
+
zIndex: 51,
|
|
1328
|
+
width: "24px",
|
|
1329
|
+
height: "40px",
|
|
1330
|
+
borderRadius: "0 6px 6px 0",
|
|
1331
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1332
|
+
borderRight: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1333
|
+
borderBottom: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
1334
|
+
borderLeft: "none",
|
|
1335
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1336
|
+
cursor: "pointer",
|
|
1337
|
+
display: "flex",
|
|
1338
|
+
alignItems: "center",
|
|
1339
|
+
justifyContent: "center",
|
|
1340
|
+
boxShadow: isDark ? "2px 0 8px rgba(0,0,0,0.3)" : "2px 0 8px rgba(0,0,0,0.06)",
|
|
1341
|
+
transition: "left 0.3s ease",
|
|
1342
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
1343
|
+
WebkitTapHighlightColor: "transparent"
|
|
1344
|
+
},
|
|
1345
|
+
children: /* @__PURE__ */ jsx(ToggleIcon, { isOpen: sidebarOpen })
|
|
1346
|
+
}
|
|
1347
|
+
)
|
|
1348
|
+
] })
|
|
1349
|
+
] });
|
|
1350
|
+
}
|
|
1351
|
+
function BellIcon2() {
|
|
1352
|
+
return /* @__PURE__ */ jsx("svg", { width: "22", height: "24", viewBox: "0 0 22 24", fill: "none", children: /* @__PURE__ */ jsx(
|
|
1353
|
+
"path",
|
|
1354
|
+
{
|
|
1355
|
+
d: "M21.2321 13.4463L19.3618 6.71712C18.8136 4.74574 17.6222 3.01418 15.9769 1.79767C14.3316 0.581165 12.3269 -0.0504751 10.2814 0.00315377C8.23593 0.0567826 6.26708 0.792603 4.6878 2.09365C3.10852 3.3947 2.00945 5.18632 1.5653 7.18371L0.11728 13.6954C-0.0426654 14.4149 -0.0389674 15.1611 0.128101 15.879C0.29517 16.5969 0.621344 17.2681 1.08254 17.8431C1.54374 18.418 2.12818 18.8821 2.79272 19.2009C3.45727 19.5198 4.18494 19.6853 4.92202 19.6853H6.01861C6.24454 20.7979 6.84817 21.7982 7.72723 22.5167C8.60629 23.2352 9.70671 23.6277 10.842 23.6277C11.9774 23.6277 13.0778 23.2352 13.9569 22.5167C14.8359 21.7982 15.4396 20.7979 15.6655 19.6853H16.4904C17.2492 19.6853 17.9977 19.5099 18.6774 19.1728C19.3572 18.8357 19.9498 18.346 20.409 17.742C20.8682 17.1379 21.1815 16.4359 21.3245 15.6907C21.4674 14.9455 21.4352 14.1774 21.2321 13.4463ZM10.842 21.654C10.2334 21.6515 9.64049 21.461 9.1443 21.1086C8.6481 20.7562 8.27291 20.2591 8.07005 19.6853H13.614C13.4112 20.2591 13.036 20.7562 12.5398 21.1086C12.0436 21.461 11.4506 21.6515 10.842 21.654ZM18.8411 16.55C18.5668 16.9139 18.2114 17.2088 17.8032 17.4113C17.3949 17.6138 16.9451 17.7183 16.4894 17.7165H4.92202C4.47982 17.7164 4.04328 17.6171 3.64463 17.4257C3.24598 17.2344 2.89539 16.9559 2.61874 16.611C2.34208 16.266 2.14643 15.8633 2.04622 15.4326C1.94602 15.0019 1.94381 14.5542 2.03977 14.1226L3.4868 7.60994C3.83561 6.04105 4.69886 4.63379 5.93932 3.61186C7.17978 2.58992 8.72625 2.01197 10.3329 1.96988C11.9395 1.92779 13.5142 2.42398 14.8064 3.37956C16.0987 4.33515 17.0344 5.69528 17.4649 7.24376L19.3352 13.9729C19.4588 14.4114 19.4785 14.8725 19.3927 15.3199C19.3069 15.7672 19.1181 16.1884 18.8411 16.55Z",
|
|
1356
|
+
fill: "currentColor"
|
|
1357
|
+
}
|
|
1358
|
+
) });
|
|
1359
|
+
}
|
|
1360
|
+
function HamburgerIcon2() {
|
|
1361
|
+
return /* @__PURE__ */ jsx("svg", { width: "24", height: "18", viewBox: "0 0 27 18", fill: "none", children: /* @__PURE__ */ jsx(
|
|
1362
|
+
"path",
|
|
1363
|
+
{
|
|
1364
|
+
d: "M1.1875 17.8426C0.851042 17.8426 0.569077 17.7287 0.341604 17.501C0.113868 17.2735 0 16.9914 0 16.6547C0 16.3182 0.113868 16.0363 0.341604 15.8088C0.569077 15.5816 0.851042 15.468 1.1875 15.468H25.7292C26.0656 15.468 26.3476 15.5817 26.5751 15.8092C26.8028 16.0369 26.9167 16.3192 26.9167 16.6559C26.9167 16.9923 26.8028 17.2743 26.5751 17.5018C26.3476 17.729 26.0656 17.8426 25.7292 17.8426H1.1875ZM1.1875 10.1088C0.851042 10.1088 0.569077 9.99492 0.341604 9.76719C0.113868 9.53945 0 9.25735 0 8.9209C0 8.58417 0.113868 8.30221 0.341604 8.075C0.569077 7.84753 0.851042 7.73379 1.1875 7.73379H25.7292C26.0656 7.73379 26.3476 7.84766 26.5751 8.0754C26.8028 8.30313 26.9167 8.58523 26.9167 8.92169C26.9167 9.25841 26.8028 9.54037 26.5751 9.76758C26.3476 9.99506 26.0656 10.1088 25.7292 10.1088H1.1875ZM1.1875 2.3746C0.851042 2.3746 0.569077 2.26087 0.341604 2.0334C0.113868 1.80566 0 1.52343 0 1.18671C0 0.850249 0.113868 0.568284 0.341604 0.340812C0.569077 0.113604 0.851042 0 1.1875 0H25.7292C26.0656 0 26.3476 0.113868 26.5751 0.341604C26.8028 0.569077 26.9167 0.851174 26.9167 1.1879C26.9167 1.52435 26.8028 1.80632 26.5751 2.03379C26.3476 2.261 26.0656 2.3746 25.7292 2.3746H1.1875Z",
|
|
1365
|
+
fill: "currentColor"
|
|
1366
|
+
}
|
|
1367
|
+
) });
|
|
1368
|
+
}
|
|
1369
|
+
function MessageOutlinedIcon(props) {
|
|
1370
|
+
return /* @__PURE__ */ jsx("svg", { focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", fill: "currentColor", ...props, children: /* @__PURE__ */ jsx("path", { d: "M4 4h16v12H5.17L4 17.17zm0-2c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm2 10h12v2H6zm0-3h12v2H6zm0-3h12v2H6z" }) });
|
|
1371
|
+
}
|
|
1372
|
+
function AvatarPlaceholder2({ size = 44 }) {
|
|
1373
|
+
return /* @__PURE__ */ jsx(
|
|
1374
|
+
"div",
|
|
1375
|
+
{
|
|
1376
|
+
style: {
|
|
1377
|
+
width: `${size}px`,
|
|
1378
|
+
height: `${size}px`,
|
|
1379
|
+
borderRadius: "50%",
|
|
1380
|
+
backgroundColor: "#f1f5f9",
|
|
1381
|
+
display: "flex",
|
|
1382
|
+
alignItems: "center",
|
|
1383
|
+
justifyContent: "center",
|
|
1384
|
+
flexShrink: 0,
|
|
1385
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.05)"
|
|
1386
|
+
},
|
|
1387
|
+
children: /* @__PURE__ */ jsx("svg", { width: size * 0.6, height: size * 0.6, viewBox: "0 0 24 24", fill: "#94a3b8", children: /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) })
|
|
1388
|
+
}
|
|
1389
|
+
);
|
|
1390
|
+
}
|
|
1391
|
+
function getNotifBg(type) {
|
|
1392
|
+
const map = {
|
|
1393
|
+
success: "#dcfce7",
|
|
1394
|
+
warning: "#fef9c3",
|
|
1395
|
+
error: "#fee2e2",
|
|
1396
|
+
reminder: "#f3e8ff",
|
|
1397
|
+
info: "#dbeafe"
|
|
1398
|
+
};
|
|
1399
|
+
return map[type] || map.info;
|
|
1400
|
+
}
|
|
1401
|
+
function getNotifFg(type) {
|
|
1402
|
+
const map = {
|
|
1403
|
+
success: "#15803d",
|
|
1404
|
+
warning: "#a16207",
|
|
1405
|
+
error: "#b91c1c",
|
|
1406
|
+
reminder: "#7e22ce",
|
|
1407
|
+
info: "#1d4ed8"
|
|
1408
|
+
};
|
|
1409
|
+
return map[type] || map.info;
|
|
1410
|
+
}
|
|
1411
|
+
function getNotifIcon(type) {
|
|
1412
|
+
const map = {
|
|
1413
|
+
success: "\u2713",
|
|
1414
|
+
warning: "!",
|
|
1415
|
+
error: "\u2715",
|
|
1416
|
+
reminder: "\u23F0",
|
|
1417
|
+
info: "i"
|
|
1418
|
+
};
|
|
1419
|
+
return map[type] || map.info;
|
|
1420
|
+
}
|
|
1421
|
+
function UserHeader({
|
|
1422
|
+
user,
|
|
1423
|
+
notifications = [],
|
|
1424
|
+
onToggleSidebar,
|
|
1425
|
+
notificationBell,
|
|
1426
|
+
onMarkAllRead,
|
|
1427
|
+
onNotificationClick,
|
|
1428
|
+
onProfile,
|
|
1429
|
+
className
|
|
1430
|
+
}) {
|
|
1431
|
+
const displayName = `${user?.firstName || ""} ${user?.lastName || ""}`.trim() || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
|
|
1432
|
+
const [isNotifOpen, setIsNotifOpen] = useState(false);
|
|
1433
|
+
const [activeFilter, setActiveFilter] = useState("all");
|
|
1434
|
+
const notifRef = useRef(null);
|
|
1435
|
+
const isDark = useDarkMode();
|
|
1436
|
+
const [imgError, setImgError] = useState(false);
|
|
1437
|
+
useEffect(() => {
|
|
1438
|
+
setImgError(false);
|
|
1439
|
+
}, [user?.pictureUrl]);
|
|
1440
|
+
useEffect(() => {
|
|
1441
|
+
if (!isNotifOpen) return;
|
|
1442
|
+
const onKey = (e) => {
|
|
1443
|
+
if (e.key === "Escape") setIsNotifOpen(false);
|
|
1444
|
+
};
|
|
1445
|
+
document.addEventListener("keydown", onKey);
|
|
1446
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
1447
|
+
}, [isNotifOpen]);
|
|
1448
|
+
useEffect(() => {
|
|
1449
|
+
const handleClickOutside = (e) => {
|
|
1450
|
+
if (notifRef.current && !notifRef.current.contains(e.target)) {
|
|
1451
|
+
setIsNotifOpen(false);
|
|
1452
|
+
}
|
|
1453
|
+
};
|
|
1454
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1455
|
+
document.addEventListener("touchstart", handleClickOutside);
|
|
1456
|
+
return () => {
|
|
1457
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
1458
|
+
document.removeEventListener("touchstart", handleClickOutside);
|
|
1459
|
+
};
|
|
1460
|
+
}, []);
|
|
1461
|
+
const unreadCount = notifications.filter((n) => !n.isRead).length;
|
|
1462
|
+
const actionCount = notifications.filter((n) => n.category === "action").length;
|
|
1463
|
+
const generalCount = notifications.filter((n) => !n.category || n.category === "general").length;
|
|
1464
|
+
const filteredNotifications = notifications.filter((n) => {
|
|
1465
|
+
if (activeFilter === "all") return true;
|
|
1466
|
+
if (activeFilter === "action") return n.category === "action";
|
|
1467
|
+
return !n.category || n.category === "general";
|
|
1468
|
+
});
|
|
1469
|
+
return /* @__PURE__ */ jsx(
|
|
1470
|
+
"header",
|
|
1471
|
+
{
|
|
1472
|
+
className,
|
|
1473
|
+
style: {
|
|
1474
|
+
background: "linear-gradient(to bottom left, #3AAE7D, #346D55)",
|
|
1475
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.15)",
|
|
1476
|
+
position: "sticky",
|
|
1477
|
+
top: 0,
|
|
1478
|
+
zIndex: 40,
|
|
1479
|
+
color: "#ffffff"
|
|
1480
|
+
},
|
|
1481
|
+
children: /* @__PURE__ */ jsxs(
|
|
1482
|
+
"div",
|
|
1483
|
+
{
|
|
1484
|
+
style: {
|
|
1485
|
+
display: "flex",
|
|
1486
|
+
alignItems: "center",
|
|
1487
|
+
justifyContent: "space-between",
|
|
1488
|
+
padding: "14px 20px"
|
|
1489
|
+
},
|
|
1490
|
+
children: [
|
|
1491
|
+
/* @__PURE__ */ jsxs(
|
|
1492
|
+
"div",
|
|
1493
|
+
{
|
|
1494
|
+
onClick: onProfile,
|
|
1495
|
+
role: onProfile ? "button" : void 0,
|
|
1496
|
+
tabIndex: onProfile ? 0 : void 0,
|
|
1497
|
+
onKeyDown: (e) => {
|
|
1498
|
+
if (onProfile && (e.key === "Enter" || e.key === " ")) {
|
|
1499
|
+
e.preventDefault();
|
|
1500
|
+
onProfile();
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
onMouseEnter: (e) => {
|
|
1504
|
+
if (onProfile) e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.12)";
|
|
1505
|
+
},
|
|
1506
|
+
onMouseLeave: (e) => {
|
|
1507
|
+
if (onProfile) e.currentTarget.style.backgroundColor = "transparent";
|
|
1508
|
+
},
|
|
1509
|
+
style: {
|
|
1510
|
+
display: "flex",
|
|
1511
|
+
alignItems: "center",
|
|
1512
|
+
gap: "12px",
|
|
1513
|
+
cursor: onProfile ? "pointer" : "default",
|
|
1514
|
+
padding: "4px 8px",
|
|
1515
|
+
borderRadius: "10px",
|
|
1516
|
+
transition: "background-color 0.15s ease",
|
|
1517
|
+
flex: 1,
|
|
1518
|
+
minWidth: 0,
|
|
1519
|
+
overflow: "hidden"
|
|
1520
|
+
},
|
|
1521
|
+
children: [
|
|
1522
|
+
user?.pictureUrl && !imgError ? /* @__PURE__ */ jsx(
|
|
1523
|
+
"img",
|
|
1524
|
+
{
|
|
1525
|
+
src: user.pictureUrl,
|
|
1526
|
+
alt: displayName,
|
|
1527
|
+
onError: () => setImgError(true),
|
|
1528
|
+
style: {
|
|
1529
|
+
width: "44px",
|
|
1530
|
+
height: "44px",
|
|
1531
|
+
borderRadius: "50%",
|
|
1532
|
+
objectFit: "cover",
|
|
1533
|
+
border: "2px solid rgba(255,255,255,0.7)",
|
|
1534
|
+
flexShrink: 0
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
) : /* @__PURE__ */ jsx(AvatarPlaceholder2, { size: 44 }),
|
|
1538
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1539
|
+
/* @__PURE__ */ jsxs(
|
|
1540
|
+
"p",
|
|
1541
|
+
{
|
|
1542
|
+
style: {
|
|
1543
|
+
fontSize: "15px",
|
|
1544
|
+
fontWeight: 600,
|
|
1545
|
+
color: "#ffffff",
|
|
1546
|
+
margin: 0,
|
|
1547
|
+
overflow: "hidden",
|
|
1548
|
+
textOverflow: "ellipsis",
|
|
1549
|
+
whiteSpace: "nowrap"
|
|
1550
|
+
},
|
|
1551
|
+
children: [
|
|
1552
|
+
"\u0E2A\u0E27\u0E31\u0E2A\u0E14\u0E35,",
|
|
1553
|
+
" ",
|
|
1554
|
+
/* @__PURE__ */ jsx(
|
|
1555
|
+
"span",
|
|
1556
|
+
{
|
|
1557
|
+
style: {
|
|
1558
|
+
color: "#ffffff"
|
|
1559
|
+
},
|
|
1560
|
+
children: displayName
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1563
|
+
]
|
|
1564
|
+
}
|
|
1565
|
+
),
|
|
1566
|
+
user?.subtitle && /* @__PURE__ */ jsx(
|
|
1567
|
+
"p",
|
|
1568
|
+
{
|
|
1569
|
+
style: {
|
|
1570
|
+
fontSize: "12px",
|
|
1571
|
+
color: "rgba(255,255,255,0.75)",
|
|
1572
|
+
margin: "2px 0 0",
|
|
1573
|
+
fontWeight: 400
|
|
1574
|
+
},
|
|
1575
|
+
children: user.subtitle
|
|
1576
|
+
}
|
|
1577
|
+
)
|
|
1578
|
+
] })
|
|
1579
|
+
]
|
|
1580
|
+
}
|
|
1581
|
+
),
|
|
1582
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "4px" }, children: [
|
|
1583
|
+
/* @__PURE__ */ jsxs("div", { className: "gov-notif-wrap", style: { position: "relative" }, ref: notifRef, children: [
|
|
1584
|
+
notificationBell ? /* @__PURE__ */ jsx(
|
|
1585
|
+
"div",
|
|
1586
|
+
{
|
|
1587
|
+
role: "button",
|
|
1588
|
+
tabIndex: 0,
|
|
1589
|
+
"aria-haspopup": "true",
|
|
1590
|
+
"aria-expanded": isNotifOpen,
|
|
1591
|
+
onClick: () => setIsNotifOpen(!isNotifOpen),
|
|
1592
|
+
onKeyDown: (e) => {
|
|
1593
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1594
|
+
e.preventDefault();
|
|
1595
|
+
setIsNotifOpen(!isNotifOpen);
|
|
1596
|
+
}
|
|
1597
|
+
},
|
|
1598
|
+
style: { cursor: "pointer", display: "flex" },
|
|
1599
|
+
children: notificationBell
|
|
1600
|
+
}
|
|
1601
|
+
) : /* @__PURE__ */ jsxs(
|
|
1602
|
+
"button",
|
|
1603
|
+
{
|
|
1604
|
+
onClick: () => setIsNotifOpen(!isNotifOpen),
|
|
1605
|
+
"aria-label": unreadCount > 0 ? `\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19 ${unreadCount} \u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E22\u0E31\u0E07\u0E44\u0E21\u0E48\u0E2D\u0E48\u0E32\u0E19` : "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19",
|
|
1606
|
+
"aria-haspopup": "true",
|
|
1607
|
+
"aria-expanded": isNotifOpen,
|
|
1608
|
+
onMouseEnter: (e) => {
|
|
1609
|
+
e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.15)";
|
|
1610
|
+
},
|
|
1611
|
+
onMouseLeave: (e) => {
|
|
1612
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1613
|
+
},
|
|
1614
|
+
style: {
|
|
1615
|
+
padding: "10px",
|
|
1616
|
+
borderRadius: "8px",
|
|
1617
|
+
border: "none",
|
|
1618
|
+
background: "transparent",
|
|
1619
|
+
cursor: "pointer",
|
|
1620
|
+
position: "relative",
|
|
1621
|
+
display: "flex",
|
|
1622
|
+
alignItems: "center",
|
|
1623
|
+
justifyContent: "center",
|
|
1624
|
+
color: "#ffffff",
|
|
1625
|
+
transition: "background-color 0.15s ease"
|
|
1626
|
+
},
|
|
1627
|
+
children: [
|
|
1628
|
+
/* @__PURE__ */ jsx(BellIcon2, {}),
|
|
1629
|
+
unreadCount > 0 && /* @__PURE__ */ jsx(
|
|
1630
|
+
"span",
|
|
1631
|
+
{
|
|
1632
|
+
style: {
|
|
1633
|
+
position: "absolute",
|
|
1634
|
+
top: "2px",
|
|
1635
|
+
right: "2px",
|
|
1636
|
+
minWidth: "16px",
|
|
1637
|
+
height: "16px",
|
|
1638
|
+
background: "#e11d1d",
|
|
1639
|
+
boxShadow: "0 0 0 2px rgba(52,109,85,0.9)",
|
|
1640
|
+
borderRadius: "8px",
|
|
1641
|
+
display: "flex",
|
|
1642
|
+
alignItems: "center",
|
|
1643
|
+
justifyContent: "center",
|
|
1644
|
+
fontSize: unreadCount > 99 ? "8px" : "10px",
|
|
1645
|
+
fontWeight: 700,
|
|
1646
|
+
color: "#fff",
|
|
1647
|
+
padding: "0 3px",
|
|
1648
|
+
lineHeight: 1
|
|
1649
|
+
},
|
|
1650
|
+
children: unreadCount > 99 ? "99+" : unreadCount
|
|
1651
|
+
}
|
|
1652
|
+
)
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
1657
|
+
.gov-notif-dropdown{position:absolute;top:100%;right:0;margin-top:8px;width:360px;max-width:calc(100vw - 32px);
|
|
1658
|
+
opacity:0;visibility:hidden;pointer-events:none;transform:translateY(-8px) scale(.98);transform-origin:top right;
|
|
1659
|
+
transition:opacity .18s ease,transform .22s cubic-bezier(.2,.8,.2,1),visibility 0s linear .22s;will-change:opacity,transform}
|
|
1660
|
+
.gov-notif-dropdown[data-open="true"]{opacity:1;visibility:visible;pointer-events:auto;transform:none;
|
|
1661
|
+
transition:opacity .18s ease,transform .22s cubic-bezier(.2,.8,.2,1),visibility 0s}
|
|
1662
|
+
@media(max-width:767px){.gov-notif-wrap{position:static!important}.gov-notif-dropdown{position:absolute;top:100%;left:16px;right:16px;width:auto;max-width:none;margin-top:8px;transform-origin:top center}}
|
|
1663
|
+
@media(prefers-reduced-motion:reduce){.gov-notif-dropdown,.gov-notif-dropdown[data-open="true"]{transition:none;transform:none}}
|
|
1664
|
+
` }),
|
|
1665
|
+
/* @__PURE__ */ jsxs(
|
|
1666
|
+
"div",
|
|
1667
|
+
{
|
|
1668
|
+
className: "gov-notif-dropdown",
|
|
1669
|
+
"data-open": isNotifOpen,
|
|
1670
|
+
"aria-hidden": !isNotifOpen,
|
|
1671
|
+
...!isNotifOpen ? { inert: true } : {},
|
|
1672
|
+
style: {
|
|
1673
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
1674
|
+
borderRadius: "12px",
|
|
1675
|
+
boxShadow: isDark ? "0 10px 40px rgba(0,0,0,0.4)" : "0 10px 40px rgba(0,0,0,0.12)",
|
|
1676
|
+
zIndex: 999,
|
|
1677
|
+
overflow: "hidden",
|
|
1678
|
+
color: isDark ? "#ffffff" : "#111",
|
|
1679
|
+
border: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`
|
|
1680
|
+
},
|
|
1681
|
+
children: [
|
|
1682
|
+
/* @__PURE__ */ jsxs(
|
|
1683
|
+
"div",
|
|
1684
|
+
{
|
|
1685
|
+
style: {
|
|
1686
|
+
padding: "16px 16px 0",
|
|
1687
|
+
background: isDark ? "#1f2937" : "#fafafa"
|
|
1688
|
+
},
|
|
1689
|
+
children: [
|
|
1690
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: "12px" }, children: [
|
|
1691
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 600, fontSize: "14px", color: isDark ? "#ffffff" : "#111" }, children: "\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19" }),
|
|
1692
|
+
onMarkAllRead && /* @__PURE__ */ jsx(
|
|
1693
|
+
"button",
|
|
1694
|
+
{
|
|
1695
|
+
onClick: onMarkAllRead,
|
|
1696
|
+
style: {
|
|
1697
|
+
fontSize: "12px",
|
|
1698
|
+
color: isDark ? "#80d897" : "var(--color-alias-color-brand-primary, #1e7d55)",
|
|
1699
|
+
background: "none",
|
|
1700
|
+
border: "none",
|
|
1701
|
+
cursor: "pointer",
|
|
1702
|
+
fontWeight: 500
|
|
1703
|
+
},
|
|
1704
|
+
children: "\u0E2D\u0E48\u0E32\u0E19\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14"
|
|
1705
|
+
}
|
|
1706
|
+
)
|
|
1707
|
+
] }),
|
|
1708
|
+
/* @__PURE__ */ jsx(
|
|
1709
|
+
"div",
|
|
1710
|
+
{
|
|
1711
|
+
style: {
|
|
1712
|
+
display: "flex",
|
|
1713
|
+
gap: "6px",
|
|
1714
|
+
paddingBottom: "12px",
|
|
1715
|
+
borderBottom: `1px solid ${isDark ? "#374151" : "#e5e7eb"}`
|
|
1716
|
+
},
|
|
1717
|
+
children: [
|
|
1718
|
+
{ key: "all", label: "\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14", count: notifications.length },
|
|
1719
|
+
{ key: "action", label: "\u0E15\u0E49\u0E2D\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23", count: actionCount },
|
|
1720
|
+
{ key: "general", label: "\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E17\u0E31\u0E48\u0E27\u0E44\u0E1B", count: generalCount }
|
|
1721
|
+
].map((tab) => {
|
|
1722
|
+
const isActive = activeFilter === tab.key;
|
|
1723
|
+
return /* @__PURE__ */ jsxs(
|
|
1724
|
+
"button",
|
|
1725
|
+
{
|
|
1726
|
+
"aria-pressed": isActive,
|
|
1727
|
+
onClick: () => setActiveFilter(tab.key),
|
|
1728
|
+
style: {
|
|
1729
|
+
display: "inline-flex",
|
|
1730
|
+
alignItems: "center",
|
|
1731
|
+
gap: "5px",
|
|
1732
|
+
padding: "5px 10px",
|
|
1733
|
+
fontSize: "12px",
|
|
1734
|
+
fontWeight: isActive ? 600 : 400,
|
|
1735
|
+
color: isActive ? isDark ? "#ffffff" : "#1e7d55" : isDark ? "#9ca3af" : "#6b7280",
|
|
1736
|
+
background: isActive ? isDark ? "rgba(30,125,85,0.2)" : "rgba(30,125,85,0.08)" : "transparent",
|
|
1737
|
+
border: `1px solid ${isActive ? isDark ? "rgba(30,125,85,0.4)" : "rgba(30,125,85,0.25)" : isDark ? "#4b5563" : "#e5e7eb"}`,
|
|
1738
|
+
borderRadius: "16px",
|
|
1739
|
+
cursor: "pointer",
|
|
1740
|
+
transition: "all 0.15s ease",
|
|
1741
|
+
whiteSpace: "nowrap"
|
|
1742
|
+
},
|
|
1743
|
+
children: [
|
|
1744
|
+
tab.label,
|
|
1745
|
+
/* @__PURE__ */ jsx(
|
|
1746
|
+
"span",
|
|
1747
|
+
{
|
|
1748
|
+
style: {
|
|
1749
|
+
minWidth: "18px",
|
|
1750
|
+
height: "18px",
|
|
1751
|
+
display: "inline-flex",
|
|
1752
|
+
alignItems: "center",
|
|
1753
|
+
justifyContent: "center",
|
|
1754
|
+
borderRadius: "9px",
|
|
1755
|
+
fontSize: "10px",
|
|
1756
|
+
fontWeight: 700,
|
|
1757
|
+
lineHeight: 1,
|
|
1758
|
+
padding: "0 4px",
|
|
1759
|
+
background: isActive ? isDark ? "#1e7d55" : "#1e7d55" : isDark ? "#4b5563" : "#e5e7eb",
|
|
1760
|
+
color: isActive ? "#ffffff" : isDark ? "#d1d5db" : "#6b7280"
|
|
1761
|
+
},
|
|
1762
|
+
children: tab.count
|
|
1763
|
+
}
|
|
1764
|
+
)
|
|
1765
|
+
]
|
|
1766
|
+
},
|
|
1767
|
+
tab.key
|
|
1768
|
+
);
|
|
1769
|
+
})
|
|
1770
|
+
}
|
|
1771
|
+
)
|
|
1772
|
+
]
|
|
1773
|
+
}
|
|
1774
|
+
),
|
|
1775
|
+
/* @__PURE__ */ jsx("div", { style: { maxHeight: "60vh", overflowY: "auto" }, children: filteredNotifications.length === 0 ? /* @__PURE__ */ jsx(
|
|
1776
|
+
"div",
|
|
1777
|
+
{
|
|
1778
|
+
style: {
|
|
1779
|
+
padding: "48px 32px",
|
|
1780
|
+
textAlign: "center",
|
|
1781
|
+
color: isDark ? "#9ca3af" : "#6b7280",
|
|
1782
|
+
fontSize: "14px",
|
|
1783
|
+
display: "flex",
|
|
1784
|
+
flexDirection: "column",
|
|
1785
|
+
alignItems: "center",
|
|
1786
|
+
justifyContent: "center",
|
|
1787
|
+
gap: "12px"
|
|
1788
|
+
},
|
|
1789
|
+
children: activeFilter === "action" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1790
|
+
/* @__PURE__ */ jsx(MessageOutlinedIcon, { style: { width: "48px", height: "48px", opacity: 0.4 } }),
|
|
1791
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 500 }, children: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E17\u0E35\u0E48\u0E15\u0E49\u0E2D\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23" })
|
|
1792
|
+
] }) : activeFilter === "all" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1793
|
+
/* @__PURE__ */ jsx(BellIcon2, {}),
|
|
1794
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 500, marginTop: "8px" }, children: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E43\u0E2B\u0E21\u0E48" })
|
|
1795
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1796
|
+
/* @__PURE__ */ jsx("div", { style: { fontSize: "40px", opacity: 0.6, marginBottom: "-8px" }, children: "\u{1F4CB}" }),
|
|
1797
|
+
/* @__PURE__ */ jsx("span", { style: { fontWeight: 500 }, children: "\u0E44\u0E21\u0E48\u0E21\u0E35\u0E01\u0E32\u0E23\u0E41\u0E08\u0E49\u0E07\u0E40\u0E15\u0E37\u0E2D\u0E19\u0E17\u0E31\u0E48\u0E27\u0E44\u0E1B" })
|
|
1798
|
+
] })
|
|
1799
|
+
}
|
|
1800
|
+
) : filteredNotifications.map((item) => /* @__PURE__ */ jsxs(
|
|
1801
|
+
"div",
|
|
1802
|
+
{
|
|
1803
|
+
role: "button",
|
|
1804
|
+
tabIndex: 0,
|
|
1805
|
+
onKeyDown: (e) => {
|
|
1806
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
1807
|
+
e.preventDefault();
|
|
1808
|
+
onNotificationClick?.(item);
|
|
1809
|
+
setIsNotifOpen(false);
|
|
1810
|
+
}
|
|
1811
|
+
},
|
|
1812
|
+
onClick: () => {
|
|
1813
|
+
onNotificationClick?.(item);
|
|
1814
|
+
setIsNotifOpen(false);
|
|
1815
|
+
},
|
|
1816
|
+
style: {
|
|
1817
|
+
padding: "12px 16px",
|
|
1818
|
+
borderBottom: `1px solid ${isDark ? "#2d3748" : "#f3f4f6"}`,
|
|
1819
|
+
cursor: "pointer",
|
|
1820
|
+
background: !item.isRead ? isDark ? "rgba(59,130,246,0.15)" : "rgba(219,234,254,0.3)" : "transparent",
|
|
1821
|
+
position: "relative",
|
|
1822
|
+
display: "flex",
|
|
1823
|
+
gap: "12px",
|
|
1824
|
+
alignItems: "flex-start",
|
|
1825
|
+
transition: "background-color 0.15s ease"
|
|
1826
|
+
},
|
|
1827
|
+
onMouseEnter: (e) => {
|
|
1828
|
+
e.currentTarget.style.backgroundColor = isDark ? "#1f2937" : "#f9fafb";
|
|
1829
|
+
},
|
|
1830
|
+
onMouseLeave: (e) => {
|
|
1831
|
+
e.currentTarget.style.backgroundColor = !item.isRead ? isDark ? "rgba(59,130,246,0.15)" : "rgba(219,234,254,0.3)" : "transparent";
|
|
1832
|
+
},
|
|
1833
|
+
children: [
|
|
1834
|
+
!item.isRead && /* @__PURE__ */ jsx(
|
|
1835
|
+
"span",
|
|
1836
|
+
{
|
|
1837
|
+
style: {
|
|
1838
|
+
position: "absolute",
|
|
1839
|
+
top: "12px",
|
|
1840
|
+
right: "12px",
|
|
1841
|
+
width: "8px",
|
|
1842
|
+
height: "8px",
|
|
1843
|
+
background: "#ef4444",
|
|
1844
|
+
borderRadius: "50%"
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
),
|
|
1848
|
+
/* @__PURE__ */ jsx(
|
|
1849
|
+
"div",
|
|
1850
|
+
{
|
|
1851
|
+
style: {
|
|
1852
|
+
width: "32px",
|
|
1853
|
+
height: "32px",
|
|
1854
|
+
borderRadius: "50%",
|
|
1855
|
+
background: getNotifBg(item.type),
|
|
1856
|
+
color: getNotifFg(item.type),
|
|
1857
|
+
fontWeight: 700,
|
|
1858
|
+
display: "flex",
|
|
1859
|
+
alignItems: "center",
|
|
1860
|
+
justifyContent: "center",
|
|
1861
|
+
fontSize: "13px",
|
|
1862
|
+
flexShrink: 0,
|
|
1863
|
+
marginTop: "2px"
|
|
1864
|
+
},
|
|
1865
|
+
children: getNotifIcon(item.type)
|
|
1866
|
+
}
|
|
1867
|
+
),
|
|
1868
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1869
|
+
item.category === "action" && /* @__PURE__ */ jsx(
|
|
1870
|
+
"span",
|
|
1871
|
+
{
|
|
1872
|
+
style: {
|
|
1873
|
+
display: "inline-block",
|
|
1874
|
+
fontSize: "10px",
|
|
1875
|
+
fontWeight: 600,
|
|
1876
|
+
color: "#b45309",
|
|
1877
|
+
background: "#fef3c7",
|
|
1878
|
+
padding: "1px 6px",
|
|
1879
|
+
borderRadius: "4px",
|
|
1880
|
+
marginBottom: "4px"
|
|
1881
|
+
},
|
|
1882
|
+
children: "\u0E15\u0E49\u0E2D\u0E07\u0E14\u0E33\u0E40\u0E19\u0E34\u0E19\u0E01\u0E32\u0E23"
|
|
1883
|
+
}
|
|
1884
|
+
),
|
|
1885
|
+
/* @__PURE__ */ jsx(
|
|
1886
|
+
"p",
|
|
1887
|
+
{
|
|
1888
|
+
style: {
|
|
1889
|
+
fontSize: "13px",
|
|
1890
|
+
fontWeight: !item.isRead ? 600 : 500,
|
|
1891
|
+
color: isDark ? "#ffffff" : "#111",
|
|
1892
|
+
margin: "0 0 2px"
|
|
1893
|
+
},
|
|
1894
|
+
children: item.title
|
|
1895
|
+
}
|
|
1896
|
+
),
|
|
1897
|
+
/* @__PURE__ */ jsx(
|
|
1898
|
+
"p",
|
|
1899
|
+
{
|
|
1900
|
+
style: {
|
|
1901
|
+
fontSize: "12px",
|
|
1902
|
+
color: isDark ? "#9ca3af" : "#6b7280",
|
|
1903
|
+
margin: "0 0 4px",
|
|
1904
|
+
lineHeight: "18px"
|
|
1905
|
+
},
|
|
1906
|
+
children: item.description
|
|
1907
|
+
}
|
|
1908
|
+
),
|
|
1909
|
+
/* @__PURE__ */ jsx(
|
|
1910
|
+
"p",
|
|
1911
|
+
{
|
|
1912
|
+
style: {
|
|
1913
|
+
fontSize: "10px",
|
|
1914
|
+
color: isDark ? "#6b7280" : "#9ca3af",
|
|
1915
|
+
margin: 0,
|
|
1916
|
+
fontWeight: 500
|
|
1917
|
+
},
|
|
1918
|
+
children: item.date
|
|
1919
|
+
}
|
|
1920
|
+
)
|
|
1921
|
+
] })
|
|
1922
|
+
]
|
|
1923
|
+
},
|
|
1924
|
+
item.id
|
|
1925
|
+
)) })
|
|
1926
|
+
]
|
|
1927
|
+
}
|
|
1928
|
+
)
|
|
1929
|
+
] }),
|
|
1930
|
+
onToggleSidebar && /* @__PURE__ */ jsx(
|
|
1931
|
+
"button",
|
|
1932
|
+
{
|
|
1933
|
+
onClick: onToggleSidebar,
|
|
1934
|
+
"aria-label": "\u0E40\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39",
|
|
1935
|
+
style: {
|
|
1936
|
+
padding: "10px",
|
|
1937
|
+
borderRadius: "8px",
|
|
1938
|
+
border: "none",
|
|
1939
|
+
background: "transparent",
|
|
1940
|
+
cursor: "pointer",
|
|
1941
|
+
display: "flex",
|
|
1942
|
+
alignItems: "center",
|
|
1943
|
+
justifyContent: "center",
|
|
1944
|
+
color: "#ffffff",
|
|
1945
|
+
transition: "background-color 0.15s ease"
|
|
1946
|
+
},
|
|
1947
|
+
onMouseEnter: (e) => {
|
|
1948
|
+
e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.15)";
|
|
1949
|
+
},
|
|
1950
|
+
onMouseLeave: (e) => {
|
|
1951
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
1952
|
+
},
|
|
1953
|
+
children: /* @__PURE__ */ jsx(HamburgerIcon2, {})
|
|
1954
|
+
}
|
|
1955
|
+
)
|
|
1956
|
+
] })
|
|
1957
|
+
]
|
|
1958
|
+
}
|
|
1959
|
+
)
|
|
1960
|
+
}
|
|
1961
|
+
);
|
|
1962
|
+
}
|
|
1963
|
+
function LogoutIcon2() {
|
|
1964
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1965
|
+
/* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
|
|
1966
|
+
/* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
|
|
1967
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
|
|
1968
|
+
] });
|
|
1969
|
+
}
|
|
1970
|
+
function ProfileIcon() {
|
|
1971
|
+
return /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
1972
|
+
/* @__PURE__ */ jsx("path", { d: "M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" }),
|
|
1973
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "7", r: "4" })
|
|
1974
|
+
] });
|
|
1975
|
+
}
|
|
1976
|
+
function AvatarPlaceholder3({ size = 56 }) {
|
|
1977
|
+
return /* @__PURE__ */ jsx(
|
|
1978
|
+
"div",
|
|
1979
|
+
{
|
|
1980
|
+
style: {
|
|
1981
|
+
width: `${size}px`,
|
|
1982
|
+
height: `${size}px`,
|
|
1983
|
+
borderRadius: "50%",
|
|
1984
|
+
backgroundColor: "#f1f5f9",
|
|
1985
|
+
display: "flex",
|
|
1986
|
+
alignItems: "center",
|
|
1987
|
+
justifyContent: "center",
|
|
1988
|
+
flexShrink: 0,
|
|
1989
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.05)"
|
|
1990
|
+
},
|
|
1991
|
+
children: /* @__PURE__ */ jsx("svg", { width: size * 0.6, height: size * 0.6, viewBox: "0 0 24 24", fill: "#94a3b8", children: /* @__PURE__ */ jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" }) })
|
|
1992
|
+
}
|
|
1993
|
+
);
|
|
1994
|
+
}
|
|
1995
|
+
function UserSidebar({
|
|
1996
|
+
user,
|
|
1997
|
+
roleLabel,
|
|
1998
|
+
menuItems,
|
|
1999
|
+
onNavigate,
|
|
2000
|
+
onLogout,
|
|
2001
|
+
isOpen,
|
|
2002
|
+
onClose,
|
|
2003
|
+
roleColor = "var(--color-alias-semantic-warning, orange)",
|
|
2004
|
+
onProfile
|
|
2005
|
+
}) {
|
|
2006
|
+
const isDark = useDarkMode();
|
|
2007
|
+
const [imgError, setImgError] = useState(false);
|
|
2008
|
+
const panelRef = useRef(null);
|
|
2009
|
+
useFocusTrap(panelRef, isOpen);
|
|
2010
|
+
useEffect(() => {
|
|
2011
|
+
setImgError(false);
|
|
2012
|
+
}, [user?.pictureUrl]);
|
|
2013
|
+
useEffect(() => {
|
|
2014
|
+
if (!isOpen) return;
|
|
2015
|
+
const original = document.body.style.overflow;
|
|
2016
|
+
document.body.style.overflow = "hidden";
|
|
2017
|
+
const onKey = (e) => {
|
|
2018
|
+
if (e.key === "Escape") onClose();
|
|
2019
|
+
};
|
|
2020
|
+
window.addEventListener("keydown", onKey);
|
|
2021
|
+
return () => {
|
|
2022
|
+
document.body.style.overflow = original;
|
|
2023
|
+
window.removeEventListener("keydown", onKey);
|
|
2024
|
+
};
|
|
2025
|
+
}, [isOpen, onClose]);
|
|
2026
|
+
const getFullName = () => {
|
|
2027
|
+
if (!user) return "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
|
|
2028
|
+
if (user.firstName && user.lastName) return `${user.firstName} ${user.lastName}`;
|
|
2029
|
+
return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
|
|
2030
|
+
};
|
|
2031
|
+
const handleMenuClick = (path) => {
|
|
2032
|
+
onNavigate(path);
|
|
2033
|
+
onClose();
|
|
2034
|
+
};
|
|
2035
|
+
const handleLogout = () => {
|
|
2036
|
+
onClose();
|
|
2037
|
+
onLogout();
|
|
2038
|
+
};
|
|
2039
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2040
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
2041
|
+
"div",
|
|
2042
|
+
{
|
|
2043
|
+
onClick: onClose,
|
|
2044
|
+
"aria-hidden": "true",
|
|
2045
|
+
style: {
|
|
2046
|
+
position: "fixed",
|
|
2047
|
+
inset: 0,
|
|
2048
|
+
background: "rgba(0,0,0,0.5)",
|
|
2049
|
+
zIndex: 45,
|
|
2050
|
+
transition: "opacity 0.3s ease"
|
|
2051
|
+
}
|
|
2052
|
+
}
|
|
2053
|
+
),
|
|
2054
|
+
/* @__PURE__ */ jsxs(
|
|
2055
|
+
"aside",
|
|
2056
|
+
{
|
|
2057
|
+
ref: panelRef,
|
|
2058
|
+
role: "dialog",
|
|
2059
|
+
"aria-modal": isOpen,
|
|
2060
|
+
"aria-hidden": !isOpen,
|
|
2061
|
+
"aria-label": "\u0E40\u0E21\u0E19\u0E39\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49",
|
|
2062
|
+
...!isOpen ? { inert: true } : {},
|
|
2063
|
+
style: {
|
|
2064
|
+
visibility: isOpen ? "visible" : "hidden",
|
|
2065
|
+
position: "fixed",
|
|
2066
|
+
top: 0,
|
|
2067
|
+
right: 0,
|
|
2068
|
+
height: "100%",
|
|
2069
|
+
width: "80vw",
|
|
2070
|
+
maxWidth: "320px",
|
|
2071
|
+
background: isDark ? "#1e293b" : "#fff",
|
|
2072
|
+
boxShadow: isDark ? "-4px 0 24px rgba(0,0,0,0.4)" : "-4px 0 24px rgba(0,0,0,0.12)",
|
|
2073
|
+
zIndex: 50,
|
|
2074
|
+
transform: isOpen ? "translateX(0)" : "translateX(100%)",
|
|
2075
|
+
transition: isOpen ? "transform 0.3s ease" : "transform 0.3s ease, visibility 0s linear 0.3s",
|
|
2076
|
+
display: "flex",
|
|
2077
|
+
flexDirection: "column",
|
|
2078
|
+
overflowY: "auto",
|
|
2079
|
+
color: isDark ? "#ffffff" : void 0
|
|
2080
|
+
},
|
|
2081
|
+
children: [
|
|
2082
|
+
user && /* @__PURE__ */ jsx(
|
|
2083
|
+
"div",
|
|
2084
|
+
{
|
|
2085
|
+
style: {
|
|
2086
|
+
padding: "20px",
|
|
2087
|
+
borderBottom: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`
|
|
2088
|
+
},
|
|
2089
|
+
children: /* @__PURE__ */ jsxs(
|
|
2090
|
+
"div",
|
|
2091
|
+
{
|
|
2092
|
+
style: {
|
|
2093
|
+
display: "flex",
|
|
2094
|
+
alignItems: "center",
|
|
2095
|
+
gap: "12px",
|
|
2096
|
+
padding: "8px"
|
|
2097
|
+
},
|
|
2098
|
+
children: [
|
|
2099
|
+
user.pictureUrl && !imgError ? /* @__PURE__ */ jsx(
|
|
2100
|
+
"img",
|
|
2101
|
+
{
|
|
2102
|
+
src: user.pictureUrl,
|
|
2103
|
+
alt: getFullName(),
|
|
2104
|
+
onError: () => setImgError(true),
|
|
2105
|
+
style: {
|
|
2106
|
+
width: "56px",
|
|
2107
|
+
height: "56px",
|
|
2108
|
+
borderRadius: "50%",
|
|
2109
|
+
objectFit: "cover",
|
|
2110
|
+
flexShrink: 0,
|
|
2111
|
+
boxShadow: "0 2px 8px rgba(0,0,0,0.1)"
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
) : /* @__PURE__ */ jsx(AvatarPlaceholder3, { size: 56 }),
|
|
2115
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2116
|
+
/* @__PURE__ */ jsx(
|
|
2117
|
+
"p",
|
|
2118
|
+
{
|
|
2119
|
+
style: {
|
|
2120
|
+
fontWeight: 700,
|
|
2121
|
+
fontSize: "16px",
|
|
2122
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
2123
|
+
margin: 0,
|
|
2124
|
+
overflow: "hidden",
|
|
2125
|
+
textOverflow: "ellipsis",
|
|
2126
|
+
whiteSpace: "nowrap"
|
|
2127
|
+
},
|
|
2128
|
+
children: getFullName()
|
|
2129
|
+
}
|
|
2130
|
+
),
|
|
2131
|
+
/* @__PURE__ */ jsxs(
|
|
2132
|
+
"p",
|
|
2133
|
+
{
|
|
2134
|
+
style: {
|
|
2135
|
+
fontSize: "13px",
|
|
2136
|
+
color: isDark ? "#e2e8f0" : "var(--color-alias-text-colors-tertiary, #475272)",
|
|
2137
|
+
margin: "2px 0 0",
|
|
2138
|
+
display: "flex",
|
|
2139
|
+
alignItems: "center",
|
|
2140
|
+
gap: "6px"
|
|
2141
|
+
},
|
|
2142
|
+
children: [
|
|
2143
|
+
/* @__PURE__ */ jsx(
|
|
2144
|
+
"span",
|
|
2145
|
+
{
|
|
2146
|
+
style: {
|
|
2147
|
+
width: "8px",
|
|
2148
|
+
height: "8px",
|
|
2149
|
+
borderRadius: "50%",
|
|
2150
|
+
background: roleColor,
|
|
2151
|
+
display: "inline-block"
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
),
|
|
2155
|
+
roleLabel
|
|
2156
|
+
]
|
|
2157
|
+
}
|
|
2158
|
+
)
|
|
2159
|
+
] })
|
|
2160
|
+
]
|
|
2161
|
+
}
|
|
2162
|
+
)
|
|
2163
|
+
}
|
|
2164
|
+
),
|
|
2165
|
+
/* @__PURE__ */ jsx(
|
|
2166
|
+
SidebarMenu,
|
|
2167
|
+
{
|
|
2168
|
+
menuItems: onProfile ? [{ id: "__profile__", title: "\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C", icon: /* @__PURE__ */ jsx(ProfileIcon, {}), path: "__profile__" }, ...menuItems] : menuItems,
|
|
2169
|
+
onItemClick: (path) => {
|
|
2170
|
+
if (path === "__profile__" && onProfile) {
|
|
2171
|
+
onProfile();
|
|
2172
|
+
onClose();
|
|
2173
|
+
} else {
|
|
2174
|
+
handleMenuClick(path);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
),
|
|
2179
|
+
/* @__PURE__ */ jsx(
|
|
2180
|
+
"div",
|
|
2181
|
+
{
|
|
2182
|
+
style: {
|
|
2183
|
+
padding: "20px",
|
|
2184
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`
|
|
2185
|
+
},
|
|
2186
|
+
children: /* @__PURE__ */ jsxs(
|
|
2187
|
+
"button",
|
|
2188
|
+
{
|
|
2189
|
+
onClick: handleLogout,
|
|
2190
|
+
onMouseEnter: (e) => {
|
|
2191
|
+
e.currentTarget.style.backgroundColor = isDark ? "#3b1c1c" : "#fef2f2";
|
|
2192
|
+
},
|
|
2193
|
+
onMouseLeave: (e) => {
|
|
2194
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
2195
|
+
},
|
|
2196
|
+
style: {
|
|
2197
|
+
width: "100%",
|
|
2198
|
+
display: "flex",
|
|
2199
|
+
alignItems: "center",
|
|
2200
|
+
gap: "16px",
|
|
2201
|
+
padding: "14px 16px",
|
|
2202
|
+
borderRadius: "8px",
|
|
2203
|
+
border: "none",
|
|
2204
|
+
background: "transparent",
|
|
2205
|
+
color: "var(--color-alias-semantic-critical, #f21515)",
|
|
2206
|
+
cursor: "pointer",
|
|
2207
|
+
transition: "background-color 0.15s ease",
|
|
2208
|
+
fontSize: "15px",
|
|
2209
|
+
fontWeight: 500
|
|
2210
|
+
},
|
|
2211
|
+
children: [
|
|
2212
|
+
/* @__PURE__ */ jsx(LogoutIcon2, {}),
|
|
2213
|
+
/* @__PURE__ */ jsx("span", { children: "\u0E2D\u0E2D\u0E01\u0E08\u0E32\u0E01\u0E23\u0E30\u0E1A\u0E1A" })
|
|
2214
|
+
]
|
|
2215
|
+
}
|
|
2216
|
+
)
|
|
2217
|
+
}
|
|
2218
|
+
)
|
|
2219
|
+
]
|
|
2220
|
+
}
|
|
2221
|
+
)
|
|
2222
|
+
] });
|
|
2223
|
+
}
|
|
2224
|
+
function BottomBar({
|
|
2225
|
+
children,
|
|
2226
|
+
sidebarWidth = "280px",
|
|
2227
|
+
height = "73px",
|
|
2228
|
+
className,
|
|
2229
|
+
style
|
|
2230
|
+
}) {
|
|
2231
|
+
const isDark = useDarkMode();
|
|
2232
|
+
return /* @__PURE__ */ jsx(
|
|
2233
|
+
"div",
|
|
2234
|
+
{
|
|
2235
|
+
className,
|
|
2236
|
+
style: {
|
|
2237
|
+
position: "fixed",
|
|
2238
|
+
bottom: 0,
|
|
2239
|
+
left: sidebarWidth,
|
|
2240
|
+
right: 0,
|
|
2241
|
+
height,
|
|
2242
|
+
background: isDark ? "#111827" : "#ffffff",
|
|
2243
|
+
color: isDark ? "#ffffff" : "var(--color-alias-text-colors-primary, #060d26)",
|
|
2244
|
+
borderTop: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`,
|
|
2245
|
+
display: "flex",
|
|
2246
|
+
alignItems: "center",
|
|
2247
|
+
justifyContent: "space-between",
|
|
2248
|
+
padding: "16px 24px",
|
|
2249
|
+
zIndex: 30,
|
|
2250
|
+
transition: "left 0.3s ease",
|
|
2251
|
+
...style
|
|
2252
|
+
},
|
|
2253
|
+
children
|
|
2254
|
+
}
|
|
2255
|
+
);
|
|
2256
|
+
}
|
|
2257
|
+
var FONT_SIZE_OPTIONS = [
|
|
2258
|
+
{ key: "xsmall", label: "\u0E40\u0E25\u0E47\u0E01\u0E21\u0E32\u0E01", scale: 0.8 },
|
|
2259
|
+
{ key: "small", label: "\u0E40\u0E25\u0E47\u0E01", scale: 0.9 },
|
|
2260
|
+
{ key: "medium", label: "\u0E01\u0E25\u0E32\u0E07", scale: 1 },
|
|
2261
|
+
{ key: "large", label: "\u0E43\u0E2B\u0E0D\u0E48", scale: 1.2 },
|
|
2262
|
+
{ key: "xlarge", label: "\u0E43\u0E2B\u0E0D\u0E48\u0E21\u0E32\u0E01", scale: 1.4 }
|
|
2263
|
+
];
|
|
2264
|
+
var BASE_FONT_SIZES = {
|
|
2265
|
+
"--font-alias-mobile-body-fontsize": 16,
|
|
2266
|
+
"--font-alias-mobile-h1-fontsize": 28,
|
|
2267
|
+
"--font-alias-mobile-h2-fontsize": 24,
|
|
2268
|
+
"--font-alias-mobile-h3-fontsize": 20,
|
|
2269
|
+
"--font-alias-mobile-sub-fontsize": 14,
|
|
2270
|
+
"--font-alias-mobile-button-fontsize": 16
|
|
2271
|
+
};
|
|
2272
|
+
var SettingsContext = createContext(void 0);
|
|
2273
|
+
function SettingsProvider({
|
|
2274
|
+
children,
|
|
2275
|
+
defaultTheme = "light",
|
|
2276
|
+
defaultFontSize = "medium",
|
|
2277
|
+
themeStorageKey = "app-theme",
|
|
2278
|
+
fontSizeStorageKey = "app-font-size"
|
|
2279
|
+
}) {
|
|
2280
|
+
const [theme, setThemeState] = useState(defaultTheme);
|
|
2281
|
+
const [fontSize, setFontSizeState] = useState(defaultFontSize);
|
|
2282
|
+
const [loaded, setLoaded] = useState(false);
|
|
2283
|
+
useEffect(() => {
|
|
2284
|
+
try {
|
|
2285
|
+
const savedTheme = localStorage.getItem(themeStorageKey);
|
|
2286
|
+
if (savedTheme === "light" || savedTheme === "dark") {
|
|
2287
|
+
setThemeState(savedTheme);
|
|
2288
|
+
}
|
|
2289
|
+
const savedFontSize = localStorage.getItem(fontSizeStorageKey);
|
|
2290
|
+
if (savedFontSize && FONT_SIZE_OPTIONS.some((o) => o.key === savedFontSize)) {
|
|
2291
|
+
setFontSizeState(savedFontSize);
|
|
2292
|
+
}
|
|
2293
|
+
} catch {
|
|
2294
|
+
}
|
|
2295
|
+
setLoaded(true);
|
|
2296
|
+
}, [themeStorageKey, fontSizeStorageKey]);
|
|
2297
|
+
useEffect(() => {
|
|
2298
|
+
const root = document.documentElement;
|
|
2299
|
+
if (theme === "dark") {
|
|
2300
|
+
root.classList.add("dark");
|
|
2301
|
+
} else {
|
|
2302
|
+
root.classList.remove("dark");
|
|
2303
|
+
}
|
|
2304
|
+
if (!loaded) return;
|
|
2305
|
+
try {
|
|
2306
|
+
localStorage.setItem(themeStorageKey, theme);
|
|
2307
|
+
} catch {
|
|
2308
|
+
}
|
|
2309
|
+
}, [theme, themeStorageKey, loaded]);
|
|
2310
|
+
useEffect(() => {
|
|
2311
|
+
const option = FONT_SIZE_OPTIONS.find((o) => o.key === fontSize) || FONT_SIZE_OPTIONS[2];
|
|
2312
|
+
const root = document.documentElement;
|
|
2313
|
+
Object.entries(BASE_FONT_SIZES).forEach(([varName, baseValue]) => {
|
|
2314
|
+
root.style.setProperty(varName, `${baseValue * option.scale}px`);
|
|
2315
|
+
});
|
|
2316
|
+
root.style.fontSize = `${16 * option.scale}px`;
|
|
2317
|
+
root.style.setProperty("--global-font-scale", option.scale.toString());
|
|
2318
|
+
document.body.style.zoom = option.scale.toString();
|
|
2319
|
+
if (!loaded) return;
|
|
2320
|
+
try {
|
|
2321
|
+
localStorage.setItem(fontSizeStorageKey, fontSize);
|
|
2322
|
+
} catch {
|
|
2323
|
+
}
|
|
2324
|
+
}, [fontSize, fontSizeStorageKey, loaded]);
|
|
2325
|
+
const setTheme = useCallback((t) => {
|
|
2326
|
+
setThemeState(t);
|
|
2327
|
+
}, []);
|
|
2328
|
+
const toggleTheme = useCallback(() => {
|
|
2329
|
+
setThemeState((prev) => prev === "light" ? "dark" : "light");
|
|
2330
|
+
}, []);
|
|
2331
|
+
const setFontSize = useCallback((s) => {
|
|
2332
|
+
setFontSizeState(s);
|
|
2333
|
+
}, []);
|
|
2334
|
+
const fontSizeOption = FONT_SIZE_OPTIONS.find((o) => o.key === fontSize) || FONT_SIZE_OPTIONS[2];
|
|
2335
|
+
return /* @__PURE__ */ jsx(
|
|
2336
|
+
SettingsContext.Provider,
|
|
2337
|
+
{
|
|
2338
|
+
value: { theme, setTheme, toggleTheme, fontSize, setFontSize, fontSizeOption },
|
|
2339
|
+
children
|
|
2340
|
+
}
|
|
2341
|
+
);
|
|
2342
|
+
}
|
|
2343
|
+
function useSettings() {
|
|
2344
|
+
const context = useContext(SettingsContext);
|
|
2345
|
+
if (!context) {
|
|
2346
|
+
throw new Error("useSettings must be used within <SettingsProvider>");
|
|
2347
|
+
}
|
|
2348
|
+
return context;
|
|
2349
|
+
}
|
|
2350
|
+
function SunIcon() {
|
|
2351
|
+
return /* @__PURE__ */ jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2352
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "5" }),
|
|
2353
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "1", x2: "12", y2: "3" }),
|
|
2354
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "21", x2: "12", y2: "23" }),
|
|
2355
|
+
/* @__PURE__ */ jsx("line", { x1: "4.22", y1: "4.22", x2: "5.64", y2: "5.64" }),
|
|
2356
|
+
/* @__PURE__ */ jsx("line", { x1: "18.36", y1: "18.36", x2: "19.78", y2: "19.78" }),
|
|
2357
|
+
/* @__PURE__ */ jsx("line", { x1: "1", y1: "12", x2: "3", y2: "12" }),
|
|
2358
|
+
/* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "23", y2: "12" }),
|
|
2359
|
+
/* @__PURE__ */ jsx("line", { x1: "4.22", y1: "19.78", x2: "5.64", y2: "18.36" }),
|
|
2360
|
+
/* @__PURE__ */ jsx("line", { x1: "18.36", y1: "5.64", x2: "19.78", y2: "4.22" })
|
|
2361
|
+
] });
|
|
2362
|
+
}
|
|
2363
|
+
function MoonIcon() {
|
|
2364
|
+
return /* @__PURE__ */ jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" }) });
|
|
2365
|
+
}
|
|
2366
|
+
function ThemeSettings({ onBack }) {
|
|
2367
|
+
const { theme, setTheme } = useSettings();
|
|
2368
|
+
const isDark = useDarkMode();
|
|
2369
|
+
const options = [
|
|
2370
|
+
{ key: "light", label: "\u0E2A\u0E27\u0E48\u0E32\u0E07", icon: /* @__PURE__ */ jsx(SunIcon, {}), bg: "#fff", text: "#111" },
|
|
2371
|
+
{ key: "dark", label: "\u0E21\u0E37\u0E14", icon: /* @__PURE__ */ jsx(MoonIcon, {}), bg: "#1f2937", text: isDark ? "#334155" : "#f9fafb" }
|
|
2372
|
+
];
|
|
2373
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2374
|
+
onBack && /* @__PURE__ */ jsxs(
|
|
2375
|
+
"button",
|
|
2376
|
+
{
|
|
2377
|
+
onClick: onBack,
|
|
2378
|
+
style: {
|
|
2379
|
+
display: "flex",
|
|
2380
|
+
alignItems: "center",
|
|
2381
|
+
gap: 8,
|
|
2382
|
+
padding: "12px 16px",
|
|
2383
|
+
width: "100%",
|
|
2384
|
+
border: "none",
|
|
2385
|
+
background: "transparent",
|
|
2386
|
+
cursor: "pointer",
|
|
2387
|
+
fontSize: 15,
|
|
2388
|
+
fontWeight: 600,
|
|
2389
|
+
color: `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`
|
|
2390
|
+
},
|
|
2391
|
+
children: [
|
|
2392
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }) }),
|
|
2393
|
+
"\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E27\u0E48\u0E32\u0E07/\u0E21\u0E37\u0E14"
|
|
2394
|
+
]
|
|
2395
|
+
}
|
|
2396
|
+
),
|
|
2397
|
+
/* @__PURE__ */ jsx("div", { style: { padding: "12px 16px", display: "flex", gap: 12 }, children: options.map((opt) => {
|
|
2398
|
+
const isSelected = theme === opt.key;
|
|
2399
|
+
return /* @__PURE__ */ jsxs(
|
|
2400
|
+
"button",
|
|
2401
|
+
{
|
|
2402
|
+
onClick: () => setTheme(opt.key),
|
|
2403
|
+
style: {
|
|
2404
|
+
flex: 1,
|
|
2405
|
+
padding: "20px 12px",
|
|
2406
|
+
borderRadius: 12,
|
|
2407
|
+
border: isSelected ? "2px solid var(--color-alias-color-brand-primary, #1e7d55)" : "2px solid var(--color-border-colors-neutral, #c8cedd)",
|
|
2408
|
+
background: opt.bg,
|
|
2409
|
+
cursor: "pointer",
|
|
2410
|
+
display: "flex",
|
|
2411
|
+
flexDirection: "column",
|
|
2412
|
+
alignItems: "center",
|
|
2413
|
+
gap: 8,
|
|
2414
|
+
transition: "all 0.2s ease"
|
|
2415
|
+
},
|
|
2416
|
+
children: [
|
|
2417
|
+
/* @__PURE__ */ jsx("span", { style: { color: opt.text }, children: opt.icon }),
|
|
2418
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
2419
|
+
fontSize: 13,
|
|
2420
|
+
fontWeight: isSelected ? 700 : 500,
|
|
2421
|
+
color: opt.text
|
|
2422
|
+
}, children: opt.label }),
|
|
2423
|
+
isSelected && /* @__PURE__ */ jsx("span", { style: {
|
|
2424
|
+
width: 20,
|
|
2425
|
+
height: 20,
|
|
2426
|
+
borderRadius: "50%",
|
|
2427
|
+
background: "var(--color-alias-color-brand-primary, #1e7d55)",
|
|
2428
|
+
display: "flex",
|
|
2429
|
+
alignItems: "center",
|
|
2430
|
+
justifyContent: "center"
|
|
2431
|
+
}, children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 24 24", fill: "none", stroke: "#fff", strokeWidth: "3", children: /* @__PURE__ */ jsx("polyline", { points: "20 6 9 17 4 12" }) }) })
|
|
2432
|
+
]
|
|
2433
|
+
},
|
|
2434
|
+
opt.key
|
|
2435
|
+
);
|
|
2436
|
+
}) })
|
|
2437
|
+
] });
|
|
2438
|
+
}
|
|
2439
|
+
function FontSizeSettings({ onBack }) {
|
|
2440
|
+
const { fontSize, setFontSize, fontSizeOption } = useSettings();
|
|
2441
|
+
const isDark = useDarkMode();
|
|
2442
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
2443
|
+
onBack && /* @__PURE__ */ jsxs(
|
|
2444
|
+
"button",
|
|
2445
|
+
{
|
|
2446
|
+
onClick: onBack,
|
|
2447
|
+
style: {
|
|
2448
|
+
display: "flex",
|
|
2449
|
+
alignItems: "center",
|
|
2450
|
+
gap: 8,
|
|
2451
|
+
padding: "12px 16px",
|
|
2452
|
+
width: "100%",
|
|
2453
|
+
border: "none",
|
|
2454
|
+
background: "transparent",
|
|
2455
|
+
cursor: "pointer",
|
|
2456
|
+
fontSize: 15,
|
|
2457
|
+
fontWeight: 600,
|
|
2458
|
+
color: `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`
|
|
2459
|
+
},
|
|
2460
|
+
children: [
|
|
2461
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M19 12H5M12 19l-7-7 7-7" }) }),
|
|
2462
|
+
"\u0E02\u0E19\u0E32\u0E14\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23"
|
|
2463
|
+
]
|
|
2464
|
+
}
|
|
2465
|
+
),
|
|
2466
|
+
/* @__PURE__ */ jsxs("div", { style: {
|
|
2467
|
+
margin: "8px 16px",
|
|
2468
|
+
padding: "16px",
|
|
2469
|
+
borderRadius: 10,
|
|
2470
|
+
background: isDark ? "#334155" : "var(--color-foundations-fuji-pallet-light, #ebedf5)",
|
|
2471
|
+
textAlign: "center"
|
|
2472
|
+
}, children: [
|
|
2473
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
2474
|
+
fontSize: `${16 * fontSizeOption.scale}px`,
|
|
2475
|
+
fontWeight: 500,
|
|
2476
|
+
color: `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`,
|
|
2477
|
+
margin: 0
|
|
2478
|
+
}, children: "\u0E15\u0E31\u0E27\u0E2D\u0E22\u0E48\u0E32\u0E07\u0E02\u0E49\u0E2D\u0E04\u0E27\u0E32\u0E21" }),
|
|
2479
|
+
/* @__PURE__ */ jsxs("p", { style: {
|
|
2480
|
+
fontSize: `${12 * fontSizeOption.scale}px`,
|
|
2481
|
+
color: `var(--color-alias-text-colors-tertiary, ${isDark ? "#c8cedd" : "#475272"})`,
|
|
2482
|
+
margin: "4px 0 0"
|
|
2483
|
+
}, children: [
|
|
2484
|
+
"\xD7",
|
|
2485
|
+
fontSizeOption.scale
|
|
2486
|
+
] })
|
|
2487
|
+
] }),
|
|
2488
|
+
/* @__PURE__ */ jsx("div", { style: { padding: "8px 16px", display: "flex", flexDirection: "column", gap: 4 }, children: FONT_SIZE_OPTIONS.map((opt) => {
|
|
2489
|
+
const isSelected = fontSize === opt.key;
|
|
2490
|
+
return /* @__PURE__ */ jsxs(
|
|
2491
|
+
"button",
|
|
2492
|
+
{
|
|
2493
|
+
onClick: () => setFontSize(opt.key),
|
|
2494
|
+
onMouseEnter: (e) => {
|
|
2495
|
+
if (!isSelected) e.currentTarget.style.backgroundColor = isDark ? "#334155" : "#f9fafb";
|
|
2496
|
+
},
|
|
2497
|
+
onMouseLeave: (e) => {
|
|
2498
|
+
if (!isSelected) e.currentTarget.style.backgroundColor = "transparent";
|
|
2499
|
+
},
|
|
2500
|
+
style: {
|
|
2501
|
+
display: "flex",
|
|
2502
|
+
alignItems: "center",
|
|
2503
|
+
justifyContent: "space-between",
|
|
2504
|
+
padding: "12px 14px",
|
|
2505
|
+
borderRadius: 8,
|
|
2506
|
+
border: isSelected ? "2px solid var(--color-alias-color-brand-primary, #1e7d55)" : "1px solid transparent",
|
|
2507
|
+
background: isSelected ? "color-mix(in srgb, var(--color-alias-color-brand-primary, #1e7d55) 8%, transparent)" : "transparent",
|
|
2508
|
+
cursor: "pointer",
|
|
2509
|
+
transition: "all 0.15s ease"
|
|
2510
|
+
},
|
|
2511
|
+
children: [
|
|
2512
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
2513
|
+
fontSize: `${14 * opt.scale}px`,
|
|
2514
|
+
fontWeight: isSelected ? 600 : 400,
|
|
2515
|
+
color: isSelected ? "var(--color-alias-color-brand-primary, #1e7d55)" : `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`
|
|
2516
|
+
}, children: opt.label }),
|
|
2517
|
+
/* @__PURE__ */ jsxs("span", { style: {
|
|
2518
|
+
fontSize: 12,
|
|
2519
|
+
color: `var(--color-alias-text-colors-tertiary, ${isDark ? "#c8cedd" : "#475272"})`
|
|
2520
|
+
}, children: [
|
|
2521
|
+
"\xD7",
|
|
2522
|
+
opt.scale
|
|
2523
|
+
] })
|
|
2524
|
+
]
|
|
2525
|
+
},
|
|
2526
|
+
opt.key
|
|
2527
|
+
);
|
|
2528
|
+
}) })
|
|
2529
|
+
] });
|
|
2530
|
+
}
|
|
2531
|
+
function FontSizeIcon() {
|
|
2532
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2533
|
+
/* @__PURE__ */ jsx("polyline", { points: "4 7 4 4 20 4 20 7" }),
|
|
2534
|
+
/* @__PURE__ */ jsx("line", { x1: "9", y1: "20", x2: "15", y2: "20" }),
|
|
2535
|
+
/* @__PURE__ */ jsx("line", { x1: "12", y1: "4", x2: "12", y2: "20" })
|
|
2536
|
+
] });
|
|
2537
|
+
}
|
|
2538
|
+
function PaletteIcon() {
|
|
2539
|
+
return /* @__PURE__ */ jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
2540
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", r: "10" }),
|
|
2541
|
+
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "8", r: "1.5", fill: "currentColor" }),
|
|
2542
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "14", r: "1.5", fill: "currentColor" }),
|
|
2543
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "14", r: "1.5", fill: "currentColor" })
|
|
2544
|
+
] });
|
|
2545
|
+
}
|
|
2546
|
+
function SettingsPanel({ className, showTheme = true }) {
|
|
2547
|
+
const [view, setView] = useState("menu");
|
|
2548
|
+
const isDark = useDarkMode();
|
|
2549
|
+
if (view === "theme" && showTheme) {
|
|
2550
|
+
return /* @__PURE__ */ jsx(ThemeSettings, { onBack: () => setView("menu") });
|
|
2551
|
+
}
|
|
2552
|
+
if (view === "fontSize") {
|
|
2553
|
+
return /* @__PURE__ */ jsx(FontSizeSettings, { onBack: () => setView("menu") });
|
|
2554
|
+
}
|
|
2555
|
+
const allMenuItems = [
|
|
2556
|
+
{
|
|
2557
|
+
id: "fontSize",
|
|
2558
|
+
icon: /* @__PURE__ */ jsx(FontSizeIcon, {}),
|
|
2559
|
+
label: "\u0E02\u0E19\u0E32\u0E14\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23",
|
|
2560
|
+
description: "\u0E40\u0E25\u0E47\u0E01\u0E21\u0E32\u0E01 / \u0E40\u0E25\u0E47\u0E01 / \u0E01\u0E25\u0E32\u0E07 / \u0E43\u0E2B\u0E0D\u0E48 / \u0E43\u0E2B\u0E0D\u0E48\u0E21\u0E32\u0E01",
|
|
2561
|
+
onClick: () => setView("fontSize")
|
|
2562
|
+
},
|
|
2563
|
+
...showTheme ? [{
|
|
2564
|
+
id: "theme",
|
|
2565
|
+
icon: /* @__PURE__ */ jsx(PaletteIcon, {}),
|
|
2566
|
+
label: "\u0E42\u0E2B\u0E21\u0E14\u0E2A\u0E27\u0E48\u0E32\u0E07/\u0E21\u0E37\u0E14",
|
|
2567
|
+
description: "\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E18\u0E35\u0E21\u0E41\u0E2D\u0E1B\u0E1E\u0E25\u0E34\u0E40\u0E04\u0E0A\u0E31\u0E19",
|
|
2568
|
+
onClick: () => setView("theme")
|
|
2569
|
+
}] : []
|
|
2570
|
+
];
|
|
2571
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
2572
|
+
/* @__PURE__ */ jsx("div", { style: {
|
|
2573
|
+
padding: "16px",
|
|
2574
|
+
borderBottom: `1px solid ${isDark ? "#374151" : "var(--color-border-colors-neutral, #c8cedd)"}`
|
|
2575
|
+
}, children: /* @__PURE__ */ jsx("h3", { style: {
|
|
2576
|
+
fontSize: 16,
|
|
2577
|
+
fontWeight: 700,
|
|
2578
|
+
margin: 0,
|
|
2579
|
+
color: `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`
|
|
2580
|
+
}, children: "\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32\u0E23\u0E30\u0E1A\u0E1A" }) }),
|
|
2581
|
+
/* @__PURE__ */ jsx("div", { style: { padding: "8px", display: "flex", flexDirection: "column", gap: 2 }, children: allMenuItems.map((item) => /* @__PURE__ */ jsxs(
|
|
2582
|
+
"button",
|
|
2583
|
+
{
|
|
2584
|
+
onClick: item.onClick,
|
|
2585
|
+
onMouseEnter: (e) => {
|
|
2586
|
+
e.currentTarget.style.backgroundColor = isDark ? "#334155" : "#f9fafb";
|
|
2587
|
+
},
|
|
2588
|
+
onMouseLeave: (e) => {
|
|
2589
|
+
e.currentTarget.style.backgroundColor = "transparent";
|
|
2590
|
+
},
|
|
2591
|
+
style: {
|
|
2592
|
+
display: "flex",
|
|
2593
|
+
alignItems: "center",
|
|
2594
|
+
gap: 14,
|
|
2595
|
+
padding: "14px 12px",
|
|
2596
|
+
borderRadius: 10,
|
|
2597
|
+
border: "none",
|
|
2598
|
+
background: "transparent",
|
|
2599
|
+
cursor: "pointer",
|
|
2600
|
+
width: "100%",
|
|
2601
|
+
textAlign: "left",
|
|
2602
|
+
transition: "background-color 0.15s ease"
|
|
2603
|
+
},
|
|
2604
|
+
children: [
|
|
2605
|
+
/* @__PURE__ */ jsx("span", { style: {
|
|
2606
|
+
width: 40,
|
|
2607
|
+
height: 40,
|
|
2608
|
+
borderRadius: 10,
|
|
2609
|
+
background: isDark ? "#334155" : "var(--color-foundations-fuji-pallet-light, #ebedf5)",
|
|
2610
|
+
display: "flex",
|
|
2611
|
+
alignItems: "center",
|
|
2612
|
+
justifyContent: "center",
|
|
2613
|
+
color: "var(--color-alias-color-brand-primary, #1e7d55)",
|
|
2614
|
+
flexShrink: 0
|
|
2615
|
+
}, children: item.icon }),
|
|
2616
|
+
/* @__PURE__ */ jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
2617
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
2618
|
+
fontSize: 15,
|
|
2619
|
+
fontWeight: 600,
|
|
2620
|
+
margin: 0,
|
|
2621
|
+
color: `var(--color-alias-text-colors-primary, ${isDark ? "#fcfcff" : "#060d26"})`
|
|
2622
|
+
}, children: item.label }),
|
|
2623
|
+
/* @__PURE__ */ jsx("p", { style: {
|
|
2624
|
+
fontSize: 12,
|
|
2625
|
+
margin: "2px 0 0",
|
|
2626
|
+
color: `var(--color-alias-text-colors-tertiary, ${isDark ? "#c8cedd" : "#475272"})`
|
|
2627
|
+
}, children: item.description })
|
|
2628
|
+
] }),
|
|
2629
|
+
/* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsx("path", { d: "M9 18l6-6-6-6" }) })
|
|
2630
|
+
]
|
|
2631
|
+
},
|
|
2632
|
+
item.id
|
|
2633
|
+
)) })
|
|
2634
|
+
] });
|
|
2635
|
+
}
|
|
2636
|
+
|
|
2637
|
+
// src/icons/index.ts
|
|
2638
|
+
var Icons = {
|
|
2639
|
+
Home: HomeIcon,
|
|
2640
|
+
Search: SearchIcon,
|
|
2641
|
+
Bell: BellIcon,
|
|
2642
|
+
Folder: FolderIcon,
|
|
2643
|
+
Clipboard: ClipboardIcon,
|
|
2644
|
+
FileText: FileTextIcon,
|
|
2645
|
+
Calendar: CalendarIcon,
|
|
2646
|
+
User: UserIcon,
|
|
2647
|
+
Users: UsersIcon,
|
|
2648
|
+
Gear: GearIcon,
|
|
2649
|
+
Wrench: WrenchIcon,
|
|
2650
|
+
Shield: ShieldIcon,
|
|
2651
|
+
HelpCircle: HelpCircleIcon,
|
|
2652
|
+
BarChart: BarChartIcon,
|
|
2653
|
+
History: HistoryIcon,
|
|
2654
|
+
Database: DatabaseIcon,
|
|
2655
|
+
Building: BuildingIcon,
|
|
2656
|
+
MapPin: MapPinIcon,
|
|
2657
|
+
Phone: PhoneIcon,
|
|
2658
|
+
Mail: MailIcon,
|
|
2659
|
+
CheckCircle: CheckCircleIcon,
|
|
2660
|
+
AlertTriangle: AlertTriangleIcon,
|
|
2661
|
+
XCircle: XCircleIcon,
|
|
2662
|
+
PlusCircle: PlusCircleIcon,
|
|
2663
|
+
LogOut: LogOutIcon,
|
|
2664
|
+
Download: DownloadIcon,
|
|
2665
|
+
Upload: UploadIcon,
|
|
2666
|
+
Printer: PrinterIcon,
|
|
2667
|
+
Star: StarIcon,
|
|
2668
|
+
Heart: HeartIcon,
|
|
2669
|
+
Eye: EyeIcon,
|
|
2670
|
+
Edit: EditIcon,
|
|
2671
|
+
Trash: TrashIcon
|
|
2672
|
+
};
|
|
2673
|
+
function useLineConnectCallback({ liffId, onLineConnected, onConnectError }) {
|
|
2674
|
+
useEffect(() => {
|
|
2675
|
+
if (typeof window !== "undefined" && window.localStorage.getItem("is_linking_line") === "true") {
|
|
2676
|
+
window.localStorage.removeItem("is_linking_line");
|
|
2677
|
+
const checkLiffAndLink = async () => {
|
|
2678
|
+
const liff = window.liff;
|
|
2679
|
+
if (liff) {
|
|
2680
|
+
try {
|
|
2681
|
+
await liff.init({ liffId });
|
|
2682
|
+
if (liff.isLoggedIn()) {
|
|
2683
|
+
const profile = await liff.getProfile();
|
|
2684
|
+
if (profile?.userId && onLineConnected) {
|
|
2685
|
+
await onLineConnected(profile.userId);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
} catch (err) {
|
|
2689
|
+
console.error("LIFF linking error:", err);
|
|
2690
|
+
if (onConnectError) onConnectError(err);
|
|
2691
|
+
}
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
const interval = setInterval(() => {
|
|
2695
|
+
if (window.liff) {
|
|
2696
|
+
clearInterval(interval);
|
|
2697
|
+
checkLiffAndLink();
|
|
2698
|
+
}
|
|
2699
|
+
}, 500);
|
|
2700
|
+
setTimeout(() => clearInterval(interval), 1e4);
|
|
2701
|
+
}
|
|
2702
|
+
}, [liffId, onLineConnected, onConnectError]);
|
|
2703
|
+
}
|
|
2704
|
+
var startLineConnection = (liffId, redirectUrl) => {
|
|
2705
|
+
if (typeof window === "undefined") return;
|
|
2706
|
+
const liff = window.liff;
|
|
2707
|
+
if (liff) {
|
|
2708
|
+
liff.init({ liffId }).then(() => {
|
|
2709
|
+
if (!liff.isLoggedIn()) {
|
|
2710
|
+
window.localStorage.setItem("is_linking_line", "true");
|
|
2711
|
+
liff.login({ redirectUri: redirectUrl || window.location.href });
|
|
2712
|
+
} else {
|
|
2713
|
+
window.localStorage.setItem("is_linking_line", "true");
|
|
2714
|
+
window.location.reload();
|
|
2715
|
+
}
|
|
2716
|
+
});
|
|
2717
|
+
}
|
|
2718
|
+
};
|
|
2719
|
+
|
|
2720
|
+
export { AlertTriangleIcon, BarChartIcon, BellIcon, BottomBar, BuildingIcon, CalendarIcon, CheckCircleIcon, ClipboardIcon, DatabaseIcon, DownloadIcon, EditIcon, EyeIcon, FONT_SIZE_OPTIONS, FileTextIcon, FolderIcon, FontSizeSettings, GearIcon, HeartIcon, HelpCircleIcon, HistoryIcon, HomeIcon, Icons, LogOutIcon, MailIcon, MapPinIcon, PhoneIcon, PlusCircleIcon, PrinterIcon, SearchIcon, SettingsPanel, SettingsProvider, ShieldIcon, SidebarHeader, SidebarMenu, SidebarUserProfile, StaffSidebar, StarIcon, ThemeSettings, TrashIcon, UploadIcon, UserHeader, UserIcon, UserSidebar, UsersIcon, WrenchIcon, XCircleIcon, startLineConnection, useDarkMode, useLineConnectCallback, useSettings };
|
|
2721
|
+
//# sourceMappingURL=index.mjs.map
|
|
2722
|
+
//# sourceMappingURL=index.mjs.map
|