your-ai-workflow-firebase-os 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AccessNotice-BZ5Gt1nP.js +40 -0
- package/dist/AccessNotice-CN7kc70o.cjs +1 -0
- package/dist/{AddressField-R-HvndkG.js → AddressField-9Sqn8TvC.js} +3 -3
- package/dist/{AddressField-BkzFOo2t.cjs → AddressField-B7wtV8yA.cjs} +1 -1
- package/dist/Assets-DBMwZ3bN.cjs +1 -0
- package/dist/Assets-DT-NU_WO.js +296 -0
- package/dist/Attachments-Bl9_dfsu.js +46 -0
- package/dist/Attachments-UVK9SRXf.cjs +1 -0
- package/dist/Billing-0RIHayHy.cjs +1 -0
- package/dist/Billing-FNE2r3_d.js +379 -0
- package/dist/BookingCalendar-BP5kiv3d.cjs +1 -0
- package/dist/BookingCalendar-DZ2fEFja.js +309 -0
- package/dist/Button-4lzOE31p.js +48 -0
- package/dist/Button-5DlB2MCi.cjs +1 -0
- package/dist/CalendarView-BimoXy_k.cjs +1 -0
- package/dist/CalendarView-D-ykjpvI.js +664 -0
- package/dist/ConfirmModal-Di9GR-vV.cjs +1 -0
- package/dist/ConfirmModal-gKQEpd4d.js +113 -0
- package/dist/ContactPopup-BXnHrRwl.js +1114 -0
- package/dist/ContactPopup-lxmRMoIa.cjs +1 -0
- package/dist/CopyLink-BpEQWmfI.cjs +1 -0
- package/dist/CopyLink-CBAVfcm1.js +43 -0
- package/dist/DashboardNav-CXa_ci-_.cjs +1 -0
- package/dist/DashboardNav-Dmn7PVSp.js +886 -0
- package/dist/EmailAdmin-CjN_rvxT.js +318 -0
- package/dist/EmailAdmin-lAEBdY1s.cjs +1 -0
- package/dist/EventCard-46EquygT.cjs +1 -0
- package/dist/EventCard-B6xD-mk3.js +97 -0
- package/dist/FileViewerPopup-CX-J75TM.js +1283 -0
- package/dist/FileViewerPopup-D8-MmIoS.cjs +3 -0
- package/dist/FormNote-BivRNA3J.js +50 -0
- package/dist/FormNote-BtdTGpml.cjs +1 -0
- package/dist/FormsAdmin-B5PBCG2W.js +812 -0
- package/dist/FormsAdmin-BQCULvi5.cjs +1 -0
- package/dist/Inbox-BPk2ZkE5.js +779 -0
- package/dist/Inbox-DNrcBx0o.cjs +3 -0
- package/dist/Loader-Bu89fsbB.cjs +1 -0
- package/dist/Loader-D4gwgBOq.js +32 -0
- package/dist/ManagePlanButton-B0dwqZBd.cjs +1 -0
- package/dist/ManagePlanButton-BSrOHYze.js +29 -0
- package/dist/MyBookings-6qr0GgzO.cjs +1 -0
- package/dist/MyBookings-BQjGM2LQ.js +113 -0
- package/dist/PageTitle-CZhgmmDT.cjs +3 -0
- package/dist/PageTitle-D93YCiN8.js +1606 -0
- package/dist/PagesAdmin-BcHIcqM5.cjs +34 -0
- package/dist/PagesAdmin-D69P9nRb.js +5802 -0
- package/dist/PagesAdmin-DNwZOKjA.cjs +1 -0
- package/dist/PagesAdmin-HUITEcHx.js +3 -0
- package/dist/PaymentsAdmin-C2iCI9qC.js +1291 -0
- package/dist/PaymentsAdmin-CoXi2vCm.cjs +2 -0
- package/dist/{PhoneInputField-B3P_vUDW.cjs → PhoneInputField-BEwYZMB7.cjs} +1 -1
- package/dist/{PhoneInputField-BlYHb5e0.js → PhoneInputField-BG0L2djE.js} +2 -2
- package/dist/PhoneInputField-DfOtCIH_.js +2 -0
- package/dist/{PhoneInputField-CdNTvWXQ.cjs → PhoneInputField-jhWvto8C.cjs} +1 -1
- package/dist/Popup-DHYGFl2-.cjs +1 -0
- package/dist/Popup-xROLytgr.js +142 -0
- package/dist/ProviderMark-BBfaM5Yl.js +52 -0
- package/dist/ProviderMark-xLkUN3Fx.cjs +1 -0
- package/dist/PublishApp-Bm-6r3Td.js +595 -0
- package/dist/PublishApp-D4XJUkJa.cjs +2 -0
- package/dist/Said-CoC15awL.js +94 -0
- package/dist/Said-IqCNofdh.cjs +1 -0
- package/dist/ScheduleAdmin-BKfQkrR8.js +1853 -0
- package/dist/ScheduleAdmin-DwK36GAZ.cjs +1 -0
- package/dist/SchedulePicker--urIH2Eb.js +112 -0
- package/dist/SchedulePicker-nmqzUnUH.cjs +1 -0
- package/dist/Setup-CHLgd-ag.js +849 -0
- package/dist/Setup-CaDranTm.cjs +1374 -0
- package/dist/SetupPayments-CVIwh1eQ.js +411 -0
- package/dist/SetupPayments-HNXWA25X.cjs +1 -0
- package/dist/SignInAdmin-C94-A-0w.cjs +4 -0
- package/dist/SignInAdmin-Yxgv_8U4.js +766 -0
- package/dist/SupportBar-CDT0HwdP.cjs +1 -0
- package/dist/SupportBar-CN_JGC-9.js +117 -0
- package/dist/SystemTabContent-L3vGGF3P.cjs +1 -0
- package/dist/SystemTabContent-QdxxLILE.js +35 -0
- package/dist/TemplateDrive-DV8zNjYe.cjs +1 -0
- package/dist/TemplateDrive-NJY_AAvV.js +1197 -0
- package/dist/ThemeAdmin-BzFjJkLg.js +269 -0
- package/dist/ThemeAdmin-DVnPNxe7.cjs +1 -0
- package/dist/ThemeAdmin-DY7Vc4Sj.cjs +3 -0
- package/dist/ThemeAdmin-DnC-D2N3.js +2 -0
- package/dist/{ContactPopup-9J_YeJrb.js → TimeZoneField-DkI1Bkcz.js} +3382 -5513
- package/dist/TimeZoneField-qs7NPR30.cjs +12 -0
- package/dist/TransactionsAdmin-BsZ-oQWi.js +582 -0
- package/dist/TransactionsAdmin-CTSTiPld.cjs +1 -0
- package/dist/Trouble-9es_AI4F.cjs +1 -0
- package/dist/Trouble-oWt9fMsm.js +164 -0
- package/dist/Users-CTitWXyd.cjs +1 -0
- package/dist/Users-DJjQTWJF.js +1207 -0
- package/dist/aiModels-DIP9fn8T.cjs +1 -0
- package/dist/{aiModels-BHlEfuRJ.js → aiModels-DnDhNGup.js} +29 -61
- package/dist/arrivalRoads-BJ-35vkk.js +228 -0
- package/dist/arrivalRoads-qoU-B4jt.cjs +4 -0
- package/dist/{bake-D0gLVNTL.cjs → bake-n2wyFw0B.cjs} +1 -1
- package/dist/{bake-OErV2MLy.js → bake-naZeMu98.js} +14 -14
- package/dist/bookingPages-C7a3srPG.js +102 -0
- package/dist/bookingPages-DvbFbD9X.cjs +1 -0
- package/dist/components/CustomSelect.d.ts +7 -1
- package/dist/components/RegistrationFields.d.ts +6 -1
- package/dist/components/Reveal.d.ts +12 -0
- package/dist/components/ScrollToTop.d.ts +4 -0
- package/dist/contentFallback-C9MZjdq7.cjs +1 -0
- package/dist/contentFallback-CEDY0Pwp.js +96 -0
- package/dist/contentKey-Bwry4lDa.js +13 -0
- package/dist/contentKey-DJGYYnAE.cjs +1 -0
- package/dist/{dist-_zWHDDrc.js → dist-DUPvBnOA.js} +1 -1
- package/dist/email-BfnZnMwD.cjs +1 -0
- package/dist/email-Ddj8Dlu6.js +58 -0
- package/dist/{fileBytes-B0qxHYQL.cjs → fileBytes-BJPaiX9Y.cjs} +1 -1
- package/dist/{fileBytes-uhq3pGCS.js → fileBytes-bjgvCfWu.js} +2 -2
- package/dist/forms-Bvx9HTM6.js +75 -0
- package/dist/forms-CmNeTETW.cjs +1 -0
- package/dist/lib/ThemeContext.d.ts +0 -14
- package/dist/lib/bareImgWatch.d.ts +6 -1
- package/dist/lib/localEdits.d.ts +2 -0
- package/dist/lib/pageDesignLines.d.ts +1 -1
- package/dist/lib/paymentProducts.d.ts +8 -0
- package/dist/lib/payments.d.ts +11 -1
- package/dist/lib/people.d.ts +9 -0
- package/dist/lib/recordsKey.d.ts +24 -0
- package/dist/{lucide-react-DiyP8FA_.js → lucide-react-CA7GD7Nv.js} +8 -8
- package/dist/notices-B7iIrIEg.js +29 -0
- package/dist/notices-upMg8UVh.cjs +1 -0
- package/dist/openOnArrival-Buwqb86D.cjs +1 -0
- package/dist/openOnArrival-S2K6v-lB.js +35 -0
- package/dist/pageFiles--Ih60ITP.js +45 -0
- package/dist/pageFiles-UtBmlOcD.cjs +1 -0
- package/dist/pages/PagesAdmin.d.ts +69 -7
- package/dist/{pdf-DLuvpvHg.js → pdf-DRXcPGkr.js} +1 -1
- package/dist/{pdf.worker.min-C0gkd2Ec.js → pdf.worker.min-CfKZezeM.js} +1 -1
- package/dist/people-2jZE_pdI.js +102 -0
- package/dist/people-BpVvIr9-.cjs +1 -0
- package/dist/personName-CFw3pxuu.js +18 -0
- package/dist/personName-CbzN_i57.cjs +1 -0
- package/dist/publishSteps-C1cDFzzB.js +88 -0
- package/dist/publishSteps-SSm8afDw.cjs +1 -0
- package/dist/recordLock-DHVvI9bP.js +61 -0
- package/dist/recordLock-DWeIxiwh.cjs +1 -0
- package/dist/recordsKey-B7QrxdeU.cjs +1 -0
- package/dist/recordsKey-D5-wC0Aw.js +141 -0
- package/dist/registrationFields-CLeR2lQJ.js +181 -0
- package/dist/registrationFields-v4pOoRdn.cjs +1 -0
- package/dist/renderer.cjs.js +1 -1
- package/dist/renderer.es.js +1 -1
- package/dist/roles-D6VaHWfV.js +147 -0
- package/dist/roles-DQUFFBQe.cjs +1 -0
- package/dist/scheduleData-ATN8w5hI.js +727 -0
- package/dist/scheduleData-Cltj0ABZ.cjs +1 -0
- package/dist/server.cjs.js +6 -6
- package/dist/server.es.js +716 -715
- package/dist/serviceStatus-TQyZO_Y_.cjs +1 -0
- package/dist/serviceStatus-vS8AI7SZ.js +125 -0
- package/dist/tabAudience-BqpN6dsR.cjs +1 -0
- package/dist/tabAudience-CRyMvv0v.js +34 -0
- package/dist/transactions-BqMQDRx3.js +343 -0
- package/dist/transactions-CufFrdAM.cjs +1 -0
- package/dist/useIsPhone-BVGx_X3e.js +13 -0
- package/dist/useIsPhone-o63tNneA.cjs +1 -0
- package/dist/{validate-DzSJWuyL.js → validate-CmC_tLK-.js} +433 -351
- package/dist/validate-DZMwqSrb.cjs +103 -0
- package/dist/vite/validate.d.ts +14 -0
- package/dist/vite.cjs.js +1 -1
- package/dist/vite.es.js +1 -1
- package/dist/your-ai-workflow-firebase-os.cjs.js +15 -1431
- package/dist/your-ai-workflow-firebase-os.css +1 -1
- package/dist/your-ai-workflow-firebase-os.es.js +11695 -35911
- package/package.json +1 -1
- package/src/index.css +122 -2
- package/dist/ContactPopup-DF8qQCoY.cjs +0 -12
- package/dist/PhoneInputField-Btx07xvM.js +0 -2
- package/dist/aiModels-BIhoTNH0.cjs +0 -1
- package/dist/validate-e48WXJdP.cjs +0 -103
- /package/dist/{address-DI1YaCI4.cjs → address-Bsb8COq2.cjs} +0 -0
- /package/dist/{address-Ca1h_UZX.js → address-C2bHNxJU.js} +0 -0
- /package/dist/{dist-BLGlDv1e.cjs → dist-E4jTFPs7.cjs} +0 -0
- /package/dist/{lucide-react-BYniZ3lQ.cjs → lucide-react-BwV6L6Is.cjs} +0 -0
- /package/dist/{mediaKind-dk396a03.cjs → mediaKind-D0MWyv6b.cjs} +0 -0
- /package/dist/{mediaKind-De2Cx_kB.js → mediaKind-DmKMsjeY.js} +0 -0
- /package/dist/{pdf-CC5g01eC.cjs → pdf-jLjjhvjp.cjs} +0 -0
- /package/dist/{pdf.worker.min-pI_P-OCl.cjs → pdf.worker.min-bLgNWd7w.cjs} +0 -0
- /package/dist/{verifiedAccount-C1iCxopN.js → verifiedAccount-DRbRFJ6H.js} +0 -0
- /package/dist/{verifiedAccount-D3OeaOBo.cjs → verifiedAccount-DScyKk96.cjs} +0 -0
|
@@ -0,0 +1,1207 @@
|
|
|
1
|
+
import { c as e, l as t, s as n, t as r } from "./PageTitle-D93YCiN8.js";
|
|
2
|
+
import { $r as i, Ar as a, C as o, Ci as s, Mr as c, Pr as l, Ta as u, Wr as d, Zr as f, bi as p, c as m, cr as h, dr as g, fa as _, g as v, h as ee, ha as y, i as b, ja as x, jr as S, ka as C, kr as w, l as te, la as ne, nr as re, o as T, pa as E, s as ie, sr as ae, u as D, v as O, vi as oe, xi as se, yi as ce } from "./TimeZoneField-DkI1Bkcz.js";
|
|
3
|
+
import { S as k, _ as A, d as le, f as ue, g as de, h as fe, m as j, t as pe, v as me } from "./DashboardNav-Dmn7PVSp.js";
|
|
4
|
+
import { C as he, D as ge, b as _e, d as ve, m as ye, r as be } from "./verifiedAccount-DRbRFJ6H.js";
|
|
5
|
+
import { C as xe, F as Se, G as Ce, X as M, bn as we, h as Te, ht as Ee, in as De, mn as N, mt as Oe, o as P, sn as F, w as ke } from "./lucide-react-CA7GD7Nv.js";
|
|
6
|
+
import "./scheduleData-ATN8w5hI.js";
|
|
7
|
+
import { a as Ae, c as I, f as L } from "./registrationFields-CLeR2lQJ.js";
|
|
8
|
+
import { a as je, c as Me, i as Ne, l as Pe, n as Fe, o as R, r as z, s as Ie, t as B, u as V } from "./roles-D6VaHWfV.js";
|
|
9
|
+
import { n as Le } from "./notices-B7iIrIEg.js";
|
|
10
|
+
import { t as Re } from "./FormNote-BivRNA3J.js";
|
|
11
|
+
import { t as ze } from "./ConfirmModal-gKQEpd4d.js";
|
|
12
|
+
import { r as H, u as Be } from "./recordsKey-D5-wC0Aw.js";
|
|
13
|
+
import { i as Ve, o as He } from "./pageFiles--Ih60ITP.js";
|
|
14
|
+
import { n as U, t as Ue } from "./personName-CFw3pxuu.js";
|
|
15
|
+
import { n as We, t as W } from "./people-2jZE_pdI.js";
|
|
16
|
+
import { n as Ge } from "./SystemTabContent-QdxxLILE.js";
|
|
17
|
+
import { n as Ke, t as qe } from "./useIsPhone-BVGx_X3e.js";
|
|
18
|
+
import { useEffect as Je, useRef as Ye, useState as G } from "react";
|
|
19
|
+
import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
|
|
20
|
+
import { collection as Xe, deleteDoc as Y, doc as X, getDocs as Ze, onSnapshot as Qe, query as $e, setDoc as et, updateDoc as tt, where as Z } from "firebase/firestore";
|
|
21
|
+
import { deleteObject as nt, ref as rt } from "firebase/storage";
|
|
22
|
+
import { useNavigate as it, useParams as at } from "react-router-dom";
|
|
23
|
+
//#region src/pages/Users.tsx
|
|
24
|
+
function ot(e) {
|
|
25
|
+
return e.length === 1 ? /\bplan$/i.test(e[0]) ? e[0] : `${e[0]} plan` : `Plans: ${e.join(", ")}`;
|
|
26
|
+
}
|
|
27
|
+
var st = "flex flex-col divide-y divide-[var(--panel-border)]/60 rounded-2xl border border-[var(--panel-border)]/60", ct = "flex items-center gap-3 rounded-2xl border border-dashed border-[var(--panel-border)] px-4 py-3 sm:px-5", Q = `${m.replace("h-11 ", "h-9 sm:h-10 ")} flex-1 min-w-0 max-w-sm`, lt = {
|
|
28
|
+
user: "Everybody who signs up",
|
|
29
|
+
internal: "People you mark as your team",
|
|
30
|
+
admin: "People who run the app"
|
|
31
|
+
};
|
|
32
|
+
function ut({ roles: e, plans: r }) {
|
|
33
|
+
let [i, a] = G(""), [o, s] = G(""), [c, l] = G(""), [d, f] = G(""), [p, m] = G(!1), [h, g] = G(""), [v, y] = G(""), [b, x] = G(null), [S, C] = G(""), w = [...B(e), ...e], te = Be() || [], re = async (t) => {
|
|
34
|
+
let n = Ne(t.id, o, e);
|
|
35
|
+
if (n) {
|
|
36
|
+
l(n);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
f(t.id);
|
|
40
|
+
try {
|
|
41
|
+
await je(t.id, o), a(""), l("");
|
|
42
|
+
} catch (e) {
|
|
43
|
+
l(u(e, "The new name could not be saved. Try again."));
|
|
44
|
+
}
|
|
45
|
+
f("");
|
|
46
|
+
}, ae = async (e) => {
|
|
47
|
+
f(e.id);
|
|
48
|
+
try {
|
|
49
|
+
x({
|
|
50
|
+
role: e,
|
|
51
|
+
standing: await Ie(e.id)
|
|
52
|
+
});
|
|
53
|
+
} catch {
|
|
54
|
+
x({
|
|
55
|
+
role: e,
|
|
56
|
+
standing: {
|
|
57
|
+
people: [],
|
|
58
|
+
pages: []
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
f("");
|
|
63
|
+
}, D = () => {
|
|
64
|
+
m(!1), g(""), y("");
|
|
65
|
+
}, oe = async () => {
|
|
66
|
+
let t = R(h, e);
|
|
67
|
+
if (t) {
|
|
68
|
+
y(t);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
f("adding");
|
|
72
|
+
try {
|
|
73
|
+
await Fe(h.trim()), D();
|
|
74
|
+
} catch (e) {
|
|
75
|
+
y(u(e, "The role could not be saved. Try again."));
|
|
76
|
+
}
|
|
77
|
+
f("");
|
|
78
|
+
};
|
|
79
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(ee, {
|
|
80
|
+
icon: ke,
|
|
81
|
+
title: "Roles",
|
|
82
|
+
description: "The words you mark people with, and the words your pages are kept for. Renaming one changes it everywhere.",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ q("div", {
|
|
85
|
+
className: st,
|
|
86
|
+
children: w.map((f) => {
|
|
87
|
+
let p = E(f.id), m = r[f.id] || [], h = We(f.id, W(f.id, te), e), g = V(f.id, e), v = p ? !!_(f.id) : !!f.icon;
|
|
88
|
+
return /* @__PURE__ */ J("div", {
|
|
89
|
+
className: "px-4 py-2.5 sm:py-3",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ J("div", {
|
|
92
|
+
className: "flex items-center gap-2 sm:gap-3",
|
|
93
|
+
children: [/* @__PURE__ */ q(t, {
|
|
94
|
+
name: g,
|
|
95
|
+
label: `Change the icon for ${f.name}`,
|
|
96
|
+
open: S === f.id,
|
|
97
|
+
onClick: () => C(S === f.id ? "" : f.id)
|
|
98
|
+
}), i === f.id ? /* @__PURE__ */ J(K, { children: [
|
|
99
|
+
/* @__PURE__ */ q("input", {
|
|
100
|
+
autoFocus: !0,
|
|
101
|
+
value: o,
|
|
102
|
+
disabled: d === f.id,
|
|
103
|
+
placeholder: ne[f.id] || f.name,
|
|
104
|
+
"aria-label": `Rename ${f.name}`,
|
|
105
|
+
onChange: (e) => {
|
|
106
|
+
s(e.target.value), c && l("");
|
|
107
|
+
},
|
|
108
|
+
onKeyDown: (e) => {
|
|
109
|
+
e.key === "Enter" && (e.preventDefault(), re(f)), e.key === "Escape" && (e.preventDefault(), a(""), l(""));
|
|
110
|
+
},
|
|
111
|
+
className: Q
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ q("span", { className: "flex-1" }),
|
|
114
|
+
/* @__PURE__ */ q(T, {
|
|
115
|
+
icon: F,
|
|
116
|
+
compact: !0,
|
|
117
|
+
busy: d === f.id,
|
|
118
|
+
title: `Save ${o || f.name}`,
|
|
119
|
+
onClick: () => re(f),
|
|
120
|
+
children: "Save"
|
|
121
|
+
}),
|
|
122
|
+
/* @__PURE__ */ q(T, {
|
|
123
|
+
icon: P,
|
|
124
|
+
compact: !0,
|
|
125
|
+
title: "Keep the name",
|
|
126
|
+
onClick: () => {
|
|
127
|
+
a(""), l("");
|
|
128
|
+
},
|
|
129
|
+
children: "Cancel"
|
|
130
|
+
})
|
|
131
|
+
] }) : /* @__PURE__ */ J(K, { children: [
|
|
132
|
+
/* @__PURE__ */ J("span", {
|
|
133
|
+
className: "flex-1 min-w-0 flex items-center gap-2.5",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ q("span", {
|
|
136
|
+
className: "text-[13.5px] font-bold text-foreground leading-tight truncate",
|
|
137
|
+
children: f.name
|
|
138
|
+
}),
|
|
139
|
+
p && /* @__PURE__ */ q("span", {
|
|
140
|
+
className: "max-sm:hidden text-[12px] font-medium text-foreground/45 truncate",
|
|
141
|
+
children: lt[f.id]
|
|
142
|
+
}),
|
|
143
|
+
m.length > 0 && /* @__PURE__ */ q("span", {
|
|
144
|
+
className: "max-sm:hidden min-w-0 overflow-hidden",
|
|
145
|
+
title: m.join(", "),
|
|
146
|
+
children: /* @__PURE__ */ q(O, {
|
|
147
|
+
state: "saved",
|
|
148
|
+
label: ot(m)
|
|
149
|
+
})
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
/* @__PURE__ */ q(T, {
|
|
154
|
+
icon: M,
|
|
155
|
+
compact: !0,
|
|
156
|
+
title: `Rename ${f.name}`,
|
|
157
|
+
onClick: () => {
|
|
158
|
+
a(f.id), s(f.name), l("");
|
|
159
|
+
},
|
|
160
|
+
children: "Rename"
|
|
161
|
+
}),
|
|
162
|
+
!p && /* @__PURE__ */ q(T, {
|
|
163
|
+
icon: xe,
|
|
164
|
+
tone: "danger",
|
|
165
|
+
compact: !0,
|
|
166
|
+
busy: d === f.id,
|
|
167
|
+
title: `Remove ${f.name}`,
|
|
168
|
+
onClick: () => ae(f),
|
|
169
|
+
children: "Remove"
|
|
170
|
+
})
|
|
171
|
+
] })]
|
|
172
|
+
}),
|
|
173
|
+
S === f.id && /* @__PURE__ */ q("div", {
|
|
174
|
+
className: "mt-2.5",
|
|
175
|
+
children: /* @__PURE__ */ q(n, {
|
|
176
|
+
label: `${f.name} is drawn as`,
|
|
177
|
+
hint: "Type a word — anything close comes up. Until you pick one it follows the name.",
|
|
178
|
+
value: g,
|
|
179
|
+
onPick: async (e) => {
|
|
180
|
+
C("");
|
|
181
|
+
try {
|
|
182
|
+
await Me(f.id, e);
|
|
183
|
+
} catch (e) {
|
|
184
|
+
l(u(e, "The icon could not be saved. Try again."));
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
resetLabel: v ? "Use the one the name suggests" : void 0,
|
|
188
|
+
resetTitle: `Go back to the icon ${f.name} suggests`,
|
|
189
|
+
onReset: v ? async () => {
|
|
190
|
+
C("");
|
|
191
|
+
try {
|
|
192
|
+
await Me(f.id, "");
|
|
193
|
+
} catch (e) {
|
|
194
|
+
l(u(e, "The icon could not be saved. Try again."));
|
|
195
|
+
}
|
|
196
|
+
} : void 0
|
|
197
|
+
})
|
|
198
|
+
}),
|
|
199
|
+
!!h && i !== f.id && /* @__PURE__ */ q("p", {
|
|
200
|
+
className: "max-sm:hidden text-[12px] font-medium text-foreground/45 leading-relaxed mt-1",
|
|
201
|
+
children: h
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}, f.id);
|
|
205
|
+
})
|
|
206
|
+
}),
|
|
207
|
+
!!c && /* @__PURE__ */ q("p", {
|
|
208
|
+
className: "text-[12px] font-semibold text-red-500 px-1 -mt-2",
|
|
209
|
+
children: c
|
|
210
|
+
}),
|
|
211
|
+
/* @__PURE__ */ J("div", {
|
|
212
|
+
className: "flex flex-col gap-1.5",
|
|
213
|
+
children: [/* @__PURE__ */ q("div", {
|
|
214
|
+
className: ct,
|
|
215
|
+
children: p ? /* @__PURE__ */ J(K, { children: [
|
|
216
|
+
/* @__PURE__ */ q("input", {
|
|
217
|
+
autoFocus: !0,
|
|
218
|
+
value: h,
|
|
219
|
+
placeholder: "Client",
|
|
220
|
+
disabled: d === "adding",
|
|
221
|
+
"aria-label": "Name the role",
|
|
222
|
+
onChange: (e) => {
|
|
223
|
+
g(e.target.value), v && y("");
|
|
224
|
+
},
|
|
225
|
+
onKeyDown: (e) => {
|
|
226
|
+
e.key === "Enter" && (e.preventDefault(), oe()), e.key === "Escape" && (e.preventDefault(), D());
|
|
227
|
+
},
|
|
228
|
+
className: Q
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ q("span", { className: "flex-1" }),
|
|
231
|
+
/* @__PURE__ */ q(T, {
|
|
232
|
+
icon: F,
|
|
233
|
+
compact: !0,
|
|
234
|
+
busy: d === "adding",
|
|
235
|
+
title: "Add this role",
|
|
236
|
+
onClick: oe,
|
|
237
|
+
children: "Add"
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ q(T, {
|
|
240
|
+
icon: P,
|
|
241
|
+
compact: !0,
|
|
242
|
+
title: "Cancel the new role",
|
|
243
|
+
onClick: D,
|
|
244
|
+
children: "Cancel"
|
|
245
|
+
})
|
|
246
|
+
] }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(T, {
|
|
247
|
+
icon: Ce,
|
|
248
|
+
onClick: () => {
|
|
249
|
+
m(!0), y("");
|
|
250
|
+
},
|
|
251
|
+
children: "Add a role"
|
|
252
|
+
}), !e.length && /* @__PURE__ */ J("p", {
|
|
253
|
+
className: "text-[12.5px] text-foreground/55 font-medium leading-relaxed",
|
|
254
|
+
children: [/* @__PURE__ */ q("span", {
|
|
255
|
+
className: "sm:hidden",
|
|
256
|
+
children: "A word of your own — Client, say, or Supplier."
|
|
257
|
+
}), /* @__PURE__ */ q("span", {
|
|
258
|
+
className: "max-sm:hidden",
|
|
259
|
+
children: "A word of your own to mark people with — Client, say, or Supplier — and a page can be kept for them alone."
|
|
260
|
+
})]
|
|
261
|
+
})] })
|
|
262
|
+
}), !!v && /* @__PURE__ */ q("p", {
|
|
263
|
+
className: "text-[12px] font-semibold text-red-500 px-1",
|
|
264
|
+
children: v
|
|
265
|
+
})]
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ q("p", {
|
|
268
|
+
className: `${ie} px-1 max-sm:hidden`,
|
|
269
|
+
children: "A role you make opens nothing on its own. Tick it on a page's row on the Pages screen, or let a plan on the Payments screen give it. Renaming changes the word on every screen and nothing else — nobody loses a page and no rules have to be pasted again."
|
|
270
|
+
})
|
|
271
|
+
]
|
|
272
|
+
}), /* @__PURE__ */ q(ze, {
|
|
273
|
+
isOpen: !!b,
|
|
274
|
+
title: b ? `Remove ${b.role.name}?` : "",
|
|
275
|
+
message: b ? mt(b.standing) : "",
|
|
276
|
+
confirmText: "Yes, remove it",
|
|
277
|
+
cancelText: "Keep it",
|
|
278
|
+
isProcessing: d === "removing",
|
|
279
|
+
onCancel: () => x(null),
|
|
280
|
+
onConfirm: async () => {
|
|
281
|
+
if (b) {
|
|
282
|
+
f("removing");
|
|
283
|
+
try {
|
|
284
|
+
await z(b.role.id), x(null);
|
|
285
|
+
} catch (e) {
|
|
286
|
+
l(u(e, "The role could not be removed. Try again.")), x(null);
|
|
287
|
+
}
|
|
288
|
+
f("");
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
})] });
|
|
292
|
+
}
|
|
293
|
+
var dt = "A group opens nothing on its own. Keep a tab to one on the Pages screen, and only people whose role is in it see that tab.";
|
|
294
|
+
function ft(e) {
|
|
295
|
+
return `${e ? `${e} ${e === 1 ? "tab is" : "tabs are"} kept to it, and ${e === 1 ? "goes" : "go"} back to everybody ticked on ${e === 1 ? "it" : "them"}.` : "No tab is kept to it."} Nobody’s role changes and no page is deleted — only the group itself goes.`;
|
|
296
|
+
}
|
|
297
|
+
function pt({ roles: e }) {
|
|
298
|
+
let { groups: t } = me(), [n, r] = G(""), [i, a] = G(""), [o, s] = G(""), [c, l] = G(""), [d, f] = G(!1), [p, m] = G(""), [h, g] = G(""), [_, v] = G(null), y = [...B(e), ...e].map((e) => ({
|
|
299
|
+
value: e.id,
|
|
300
|
+
label: e.name
|
|
301
|
+
})), b = async (e) => {
|
|
302
|
+
let n = j(i, t, e.id);
|
|
303
|
+
if (n) {
|
|
304
|
+
s(n);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
l(e.id);
|
|
308
|
+
try {
|
|
309
|
+
await fe(e.id, i), r(""), s("");
|
|
310
|
+
} catch (e) {
|
|
311
|
+
s(u(e, "The new name could not be saved. Try again."));
|
|
312
|
+
}
|
|
313
|
+
l("");
|
|
314
|
+
}, x = async (e, t) => {
|
|
315
|
+
let n = e.roles.includes(t) ? e.roles.filter((e) => e !== t) : [...e.roles, t];
|
|
316
|
+
s("");
|
|
317
|
+
try {
|
|
318
|
+
await de(e.id, n);
|
|
319
|
+
} catch (e) {
|
|
320
|
+
s(u(e, "That could not be saved. Try again."));
|
|
321
|
+
}
|
|
322
|
+
}, S = async (e) => {
|
|
323
|
+
l(e.id);
|
|
324
|
+
try {
|
|
325
|
+
v({
|
|
326
|
+
group: e,
|
|
327
|
+
tabs: (await A(e.id)).length
|
|
328
|
+
});
|
|
329
|
+
} catch {
|
|
330
|
+
v({
|
|
331
|
+
group: e,
|
|
332
|
+
tabs: 0
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
l("");
|
|
336
|
+
}, C = () => {
|
|
337
|
+
f(!1), m(""), g("");
|
|
338
|
+
}, w = async () => {
|
|
339
|
+
let e = j(p, t);
|
|
340
|
+
if (e) {
|
|
341
|
+
g(e);
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
l("adding");
|
|
345
|
+
try {
|
|
346
|
+
await le(p.trim()), C();
|
|
347
|
+
} catch (e) {
|
|
348
|
+
g(u(e, "The group could not be saved. Try again."));
|
|
349
|
+
}
|
|
350
|
+
l("");
|
|
351
|
+
};
|
|
352
|
+
return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J(ee, {
|
|
353
|
+
icon: N,
|
|
354
|
+
title: "Groups",
|
|
355
|
+
description: "Roles that belong together — a department, a branch, a client’s company. A tab can be kept to one group.",
|
|
356
|
+
children: [
|
|
357
|
+
t.length > 0 && /* @__PURE__ */ q("div", {
|
|
358
|
+
className: st,
|
|
359
|
+
children: t.map((e) => /* @__PURE__ */ J("div", {
|
|
360
|
+
className: "px-4 py-2.5 sm:py-3 flex flex-col gap-2",
|
|
361
|
+
children: [/* @__PURE__ */ q("div", {
|
|
362
|
+
className: "flex items-center gap-2 sm:gap-3",
|
|
363
|
+
children: n === e.id ? /* @__PURE__ */ J(K, { children: [
|
|
364
|
+
/* @__PURE__ */ q("input", {
|
|
365
|
+
autoFocus: !0,
|
|
366
|
+
value: i,
|
|
367
|
+
disabled: c === e.id,
|
|
368
|
+
placeholder: e.name,
|
|
369
|
+
"aria-label": `Rename ${e.name}`,
|
|
370
|
+
onChange: (e) => {
|
|
371
|
+
a(e.target.value), o && s("");
|
|
372
|
+
},
|
|
373
|
+
onKeyDown: (t) => {
|
|
374
|
+
t.key === "Enter" && (t.preventDefault(), b(e)), t.key === "Escape" && (t.preventDefault(), r(""), s(""));
|
|
375
|
+
},
|
|
376
|
+
className: Q
|
|
377
|
+
}),
|
|
378
|
+
/* @__PURE__ */ q("span", { className: "flex-1" }),
|
|
379
|
+
/* @__PURE__ */ q(T, {
|
|
380
|
+
icon: F,
|
|
381
|
+
compact: !0,
|
|
382
|
+
busy: c === e.id,
|
|
383
|
+
title: `Save ${i || e.name}`,
|
|
384
|
+
onClick: () => b(e),
|
|
385
|
+
children: "Save"
|
|
386
|
+
}),
|
|
387
|
+
/* @__PURE__ */ q(T, {
|
|
388
|
+
icon: P,
|
|
389
|
+
compact: !0,
|
|
390
|
+
title: "Keep the name",
|
|
391
|
+
onClick: () => {
|
|
392
|
+
r(""), s("");
|
|
393
|
+
},
|
|
394
|
+
children: "Cancel"
|
|
395
|
+
})
|
|
396
|
+
] }) : /* @__PURE__ */ J(K, { children: [
|
|
397
|
+
/* @__PURE__ */ q("span", {
|
|
398
|
+
className: "flex-1 min-w-0 text-[13.5px] font-bold text-foreground leading-tight truncate",
|
|
399
|
+
children: e.name
|
|
400
|
+
}),
|
|
401
|
+
/* @__PURE__ */ q("div", {
|
|
402
|
+
className: "max-sm:hidden shrink-0 min-w-0 max-w-[18rem]",
|
|
403
|
+
children: /* @__PURE__ */ q(re, {
|
|
404
|
+
multiple: !0,
|
|
405
|
+
compact: !0,
|
|
406
|
+
portal: !0,
|
|
407
|
+
direction: "auto",
|
|
408
|
+
className: "console-select",
|
|
409
|
+
ariaLabel: `Roles in ${e.name}`,
|
|
410
|
+
placeholder: "Pick its roles",
|
|
411
|
+
values: e.roles,
|
|
412
|
+
options: y,
|
|
413
|
+
onChange: (t) => x(e, t)
|
|
414
|
+
})
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ q(T, {
|
|
417
|
+
icon: M,
|
|
418
|
+
compact: !0,
|
|
419
|
+
title: `Rename ${e.name}`,
|
|
420
|
+
onClick: () => {
|
|
421
|
+
r(e.id), a(e.name), s("");
|
|
422
|
+
},
|
|
423
|
+
children: "Rename"
|
|
424
|
+
}),
|
|
425
|
+
/* @__PURE__ */ q(T, {
|
|
426
|
+
icon: xe,
|
|
427
|
+
tone: "danger",
|
|
428
|
+
compact: !0,
|
|
429
|
+
busy: c === e.id,
|
|
430
|
+
title: `Remove ${e.name}`,
|
|
431
|
+
onClick: () => S(e),
|
|
432
|
+
children: "Remove"
|
|
433
|
+
})
|
|
434
|
+
] })
|
|
435
|
+
}), n !== e.id && /* @__PURE__ */ q("div", {
|
|
436
|
+
className: "sm:hidden",
|
|
437
|
+
children: /* @__PURE__ */ q(re, {
|
|
438
|
+
multiple: !0,
|
|
439
|
+
dense: !0,
|
|
440
|
+
portal: !0,
|
|
441
|
+
direction: "auto",
|
|
442
|
+
className: "console-select",
|
|
443
|
+
ariaLabel: `Roles in ${e.name}`,
|
|
444
|
+
placeholder: "Pick its roles",
|
|
445
|
+
values: e.roles,
|
|
446
|
+
options: y,
|
|
447
|
+
onChange: (t) => x(e, t)
|
|
448
|
+
})
|
|
449
|
+
})]
|
|
450
|
+
}, e.id))
|
|
451
|
+
}),
|
|
452
|
+
!!o && /* @__PURE__ */ q(Re, {
|
|
453
|
+
tone: "error",
|
|
454
|
+
children: o
|
|
455
|
+
}),
|
|
456
|
+
/* @__PURE__ */ J("div", {
|
|
457
|
+
className: "flex flex-col gap-1.5",
|
|
458
|
+
children: [/* @__PURE__ */ q("div", {
|
|
459
|
+
className: ct,
|
|
460
|
+
children: d ? /* @__PURE__ */ J(K, { children: [
|
|
461
|
+
/* @__PURE__ */ q("input", {
|
|
462
|
+
autoFocus: !0,
|
|
463
|
+
value: p,
|
|
464
|
+
placeholder: "Sales",
|
|
465
|
+
disabled: c === "adding",
|
|
466
|
+
"aria-label": "Name the group",
|
|
467
|
+
onChange: (e) => {
|
|
468
|
+
m(e.target.value), h && g("");
|
|
469
|
+
},
|
|
470
|
+
onKeyDown: (e) => {
|
|
471
|
+
e.key === "Enter" && (e.preventDefault(), w()), e.key === "Escape" && (e.preventDefault(), C());
|
|
472
|
+
},
|
|
473
|
+
className: Q
|
|
474
|
+
}),
|
|
475
|
+
/* @__PURE__ */ q("span", { className: "flex-1" }),
|
|
476
|
+
/* @__PURE__ */ q(T, {
|
|
477
|
+
icon: F,
|
|
478
|
+
compact: !0,
|
|
479
|
+
busy: c === "adding",
|
|
480
|
+
title: "Add this group",
|
|
481
|
+
onClick: w,
|
|
482
|
+
children: "Add"
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ q(T, {
|
|
485
|
+
icon: P,
|
|
486
|
+
compact: !0,
|
|
487
|
+
title: "Cancel the new group",
|
|
488
|
+
onClick: C,
|
|
489
|
+
children: "Cancel"
|
|
490
|
+
})
|
|
491
|
+
] }) : /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q(T, {
|
|
492
|
+
icon: Ce,
|
|
493
|
+
onClick: () => {
|
|
494
|
+
f(!0), g("");
|
|
495
|
+
},
|
|
496
|
+
children: "Add a group"
|
|
497
|
+
}), !t.length && /* @__PURE__ */ J("p", {
|
|
498
|
+
className: "text-[12.5px] text-foreground/55 font-medium leading-relaxed",
|
|
499
|
+
children: [/* @__PURE__ */ q("span", {
|
|
500
|
+
className: "sm:hidden",
|
|
501
|
+
children: "Roles that belong together — Sales, say."
|
|
502
|
+
}), /* @__PURE__ */ q("span", {
|
|
503
|
+
className: "max-sm:hidden",
|
|
504
|
+
children: "A name for roles that belong together — Sales, say, or North branch — then tick the roles in it."
|
|
505
|
+
})]
|
|
506
|
+
})] })
|
|
507
|
+
}), !!h && /* @__PURE__ */ q(Re, {
|
|
508
|
+
tone: "error",
|
|
509
|
+
children: h
|
|
510
|
+
})]
|
|
511
|
+
}),
|
|
512
|
+
/* @__PURE__ */ q("p", {
|
|
513
|
+
className: `${ie} px-1 max-sm:hidden`,
|
|
514
|
+
children: dt
|
|
515
|
+
})
|
|
516
|
+
]
|
|
517
|
+
}), /* @__PURE__ */ q(ze, {
|
|
518
|
+
isOpen: !!_,
|
|
519
|
+
title: _ ? `Remove ${_.group.name}?` : "",
|
|
520
|
+
message: _ ? ft(_.tabs) : "",
|
|
521
|
+
confirmText: "Yes, remove it",
|
|
522
|
+
cancelText: "Keep it",
|
|
523
|
+
isProcessing: c === "removing",
|
|
524
|
+
onCancel: () => v(null),
|
|
525
|
+
onConfirm: async () => {
|
|
526
|
+
if (_) {
|
|
527
|
+
l("removing");
|
|
528
|
+
try {
|
|
529
|
+
await ue(_.group.id);
|
|
530
|
+
} catch (e) {
|
|
531
|
+
s(u(e, "The group could not be removed. Try again."));
|
|
532
|
+
}
|
|
533
|
+
v(null), l("");
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
})] });
|
|
537
|
+
}
|
|
538
|
+
function mt(e) {
|
|
539
|
+
let t = e.people.length, n = e.pages.length, r = e.plans || [], i = [];
|
|
540
|
+
t && i.push(`${t} ${t === 1 ? "person goes" : "people go"} back to being ${t === 1 ? "a member" : "members"}`), n && i.push(`${n} ${n === 1 ? "page goes" : "pages go"} back to everybody signed in`), r.length && i.push(r.length === 1 ? `the ${r[0]} plan stops giving it` : `${r.length} plans stop giving it`);
|
|
541
|
+
let a = i.length > 2 ? `${i.slice(0, -1).join(", ")}, and ${i[i.length - 1]}` : i.join(", and "), o = i.length ? `${a.charAt(0).toUpperCase()}${a.slice(1)}. ` : "Nobody is marked with it and no page is kept for it. ", s = r.length ? " A plan keeps selling — pick it a new role on the Payments screen." : "";
|
|
542
|
+
return `${o}Whatever those pages have saved stays exactly where it is — you and your admins can still read it — but nobody else will, and the word itself is gone from every list.${n ? ` ${n === 1 ? "That page was built to read what was kept for this role, so it needs building again: open it" : "Those pages were built to read what was kept for this role, so they need building again: open each one"} on your Pages screen and copy the sentence on its row.` : ""}${s}`;
|
|
543
|
+
}
|
|
544
|
+
function ht(e) {
|
|
545
|
+
return `Everything this app keeps about ${e} is deleted — their name, their picture, their role, what they kept on pages only they could see, and their place in every list — and they are signed out at once. If they ever sign in or sign up again they start from nothing, as a new person with no role, like anybody else. Whatever they made on your pages for others stays exactly where it is, under the name the record itself saved. This cannot be undone.`;
|
|
546
|
+
}
|
|
547
|
+
function gt(e) {
|
|
548
|
+
let t = /* @__PURE__ */ new Set();
|
|
549
|
+
for (let [n, r] of e) !r || he(r) !== "user_" || t.add(H(r, "user_", n));
|
|
550
|
+
return [...t];
|
|
551
|
+
}
|
|
552
|
+
async function _t(e) {
|
|
553
|
+
let t = /* @__PURE__ */ new Map();
|
|
554
|
+
for (let [e, n] of k()) !n.isPublic && n.config && t.set(e, n.config);
|
|
555
|
+
try {
|
|
556
|
+
(await Ze(Xe(C, "sys_tabs"))).forEach((e) => t.set(e.id, {
|
|
557
|
+
...t.get(e.id) || {},
|
|
558
|
+
...e.data()
|
|
559
|
+
}));
|
|
560
|
+
} catch {}
|
|
561
|
+
let n = Ve("user_");
|
|
562
|
+
for (let r of gt([...t.entries()])) try {
|
|
563
|
+
let t = await Ze($e(Xe(C, r), Z("uid", "==", e)));
|
|
564
|
+
await Promise.all(t.docs.map(async (e) => {
|
|
565
|
+
await He({
|
|
566
|
+
id: e.id,
|
|
567
|
+
...e.data()
|
|
568
|
+
}, [], n), await Y(e.ref);
|
|
569
|
+
}));
|
|
570
|
+
} catch (e) {
|
|
571
|
+
console.warn(`${r}: a deleted person's own records could not be swept.`, e);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
function vt({ person: e, settings: t }) {
|
|
575
|
+
let n = I(e, t);
|
|
576
|
+
return n.length ? /* @__PURE__ */ J("div", {
|
|
577
|
+
className: "pt-5 border-t border-[var(--panel-border)]/50 flex flex-col gap-3",
|
|
578
|
+
children: [/* @__PURE__ */ q("p", {
|
|
579
|
+
className: `${D} ml-1`,
|
|
580
|
+
children: "What they told you"
|
|
581
|
+
}), /* @__PURE__ */ q("div", {
|
|
582
|
+
className: "flex flex-col divide-y divide-[var(--panel-border)]/50 rounded-xl border border-[var(--panel-border)]/60",
|
|
583
|
+
children: n.map((t) => {
|
|
584
|
+
let n = L(e, t);
|
|
585
|
+
return /* @__PURE__ */ J("div", {
|
|
586
|
+
className: "flex items-baseline justify-between gap-3 px-3.5 py-2.5 min-w-0",
|
|
587
|
+
children: [/* @__PURE__ */ q("span", {
|
|
588
|
+
className: "text-[12.5px] font-medium text-foreground/50 shrink-0 max-w-[45%] truncate",
|
|
589
|
+
children: t.label
|
|
590
|
+
}), /* @__PURE__ */ q("span", {
|
|
591
|
+
className: `text-[13px] font-semibold min-w-0 text-right [overflow-wrap:anywhere] ${n ? "text-foreground" : "text-foreground/35 italic"}`,
|
|
592
|
+
children: n ? Ae(e, t) : "Not given"
|
|
593
|
+
})]
|
|
594
|
+
}, t.key);
|
|
595
|
+
})
|
|
596
|
+
})]
|
|
597
|
+
}) : null;
|
|
598
|
+
}
|
|
599
|
+
var yt = (e) => {
|
|
600
|
+
let t = ce(e);
|
|
601
|
+
return ve(t) || ge(_e(t));
|
|
602
|
+
}, bt = "waiting";
|
|
603
|
+
function xt(e, t, n) {
|
|
604
|
+
let r = /* @__PURE__ */ new Map(), i = [];
|
|
605
|
+
for (let t of e) {
|
|
606
|
+
if (!t.inactive && n(t)) {
|
|
607
|
+
i.push(t);
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
let e = yt(t);
|
|
611
|
+
r.set(e, [...r.get(e) || [], t]);
|
|
612
|
+
}
|
|
613
|
+
let a = [...r.keys()].filter((e) => ![
|
|
614
|
+
"admin",
|
|
615
|
+
"internal",
|
|
616
|
+
"user",
|
|
617
|
+
...t
|
|
618
|
+
].includes(e)).sort(), o = [
|
|
619
|
+
"admin",
|
|
620
|
+
"internal",
|
|
621
|
+
...t,
|
|
622
|
+
...a,
|
|
623
|
+
"user"
|
|
624
|
+
];
|
|
625
|
+
return [...i.length ? [{
|
|
626
|
+
id: bt,
|
|
627
|
+
people: i
|
|
628
|
+
}] : [], ...o.filter((e) => r.has(e)).map((e) => ({
|
|
629
|
+
id: e,
|
|
630
|
+
people: r.get(e)
|
|
631
|
+
}))];
|
|
632
|
+
}
|
|
633
|
+
var St = te.replace("h-11 ", "h-9 ").replace("px-4 ", "px-3 "), Ct = (e) => e.normalize("NFD").replace(/[̀-ͯ]/g, "").toLowerCase();
|
|
634
|
+
function wt(e, t) {
|
|
635
|
+
let n = Ct(t.trim());
|
|
636
|
+
if (!n) return !0;
|
|
637
|
+
let r = e.email || "";
|
|
638
|
+
if ([e.displayName, /[@.]/.test(n) ? r : r.split("@")[0]].some((e) => !!e && Ct(e).includes(n))) return !0;
|
|
639
|
+
let i = n.replace(/\D/g, "");
|
|
640
|
+
return !!i && i.length === n.replace(/[\s+()-]/g, "").length && (e.phone || "").replace(/\D/g, "").includes(i);
|
|
641
|
+
}
|
|
642
|
+
function Tt({ label: t, title: n, count: r, icon: i, plain: a, active: o, onClick: s }) {
|
|
643
|
+
return /* @__PURE__ */ J("button", {
|
|
644
|
+
type: "button",
|
|
645
|
+
"aria-pressed": o,
|
|
646
|
+
"aria-label": n,
|
|
647
|
+
title: n,
|
|
648
|
+
onClick: s,
|
|
649
|
+
className: `inline-flex items-center gap-2 h-9 pl-3 pr-3.5 shrink-0 whitespace-nowrap rounded-full border text-[12.5px] font-semibold transition-all cursor-pointer active:scale-[0.98] ${o ? "border-accent/35 bg-accent/10 text-foreground" : "border-[var(--panel-border)]/70 text-foreground/55 hover:text-foreground hover:border-accent/30 hover:bg-foreground/[0.03]"}`,
|
|
650
|
+
children: [
|
|
651
|
+
i === "" ? /* @__PURE__ */ q("span", { className: "w-1.5 h-1.5 mx-1 rounded-full shrink-0 bg-accent animate-pulse" }) : i && /* @__PURE__ */ q(e, {
|
|
652
|
+
name: i,
|
|
653
|
+
className: `w-3.5 h-3.5 shrink-0 ${a && !o ? "text-foreground/35" : "text-accent"}`
|
|
654
|
+
}),
|
|
655
|
+
/* @__PURE__ */ q("span", { children: t }),
|
|
656
|
+
/* @__PURE__ */ q("span", {
|
|
657
|
+
className: `tabular-nums font-medium ${o ? "text-foreground/50" : "text-foreground/35"}`,
|
|
658
|
+
children: r
|
|
659
|
+
})
|
|
660
|
+
]
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
function Et({ label: t, plain: n, waiting: r, icon: i }) {
|
|
664
|
+
return /* @__PURE__ */ J("span", {
|
|
665
|
+
className: `inline-flex items-center gap-1.5 text-[11.5px] font-semibold whitespace-nowrap shrink-0 ${r ? "text-foreground/70" : "text-foreground/50"}`,
|
|
666
|
+
children: [i ? /* @__PURE__ */ q(e, {
|
|
667
|
+
name: i,
|
|
668
|
+
className: `w-3.5 h-3.5 shrink-0 ${n ? "text-foreground/35" : "text-accent"} ${r ? "animate-pulse" : ""}`
|
|
669
|
+
}) : /* @__PURE__ */ q("span", { className: `w-1.5 h-1.5 rounded-full shrink-0 ${n ? "bg-foreground/25" : "bg-accent"} ${r ? "animate-pulse" : ""}` }), t]
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
function Dt() {
|
|
673
|
+
let { user: t, userRole: n } = g(), m = Pe(), _ = i(), te = s(), { groups: ne } = me(), [E, ie] = G(!0), D = it(), { id: O } = at(), k = Ke(), [A, le] = G([]), [ue, de] = G(null), [fe, j] = G(null), [he, _e] = G(!1), [ve, Ce] = G(""), [M, N] = G(null), [ke, Ae] = G(!1), I = xt(A, m.map((e) => e.id), (e) => !!l(e)), L = I[0]?.people[0]?.id || "", [je, Me] = G(""), [Ne, Fe] = G(""), R = I.some((e) => e.id === je) ? je : "", z = A.length >= 8, Ie = I.filter((e) => !R || e.id === R).map((e) => ({
|
|
674
|
+
...e,
|
|
675
|
+
people: e.people.filter((e) => wt(e, z ? Ne : ""))
|
|
676
|
+
})).filter((e) => e.people.length), B = O ? A.find((e) => e.id === O) || null : A.find((e) => e.id === L) || null, H = (e) => {
|
|
677
|
+
D(e ? `/users/${e.id}` : "/users");
|
|
678
|
+
};
|
|
679
|
+
Je(() => {
|
|
680
|
+
let e = Qe(Xe(C, "user_profiles"), (e) => {
|
|
681
|
+
let t = [];
|
|
682
|
+
e.forEach((e) => {
|
|
683
|
+
let n = {
|
|
684
|
+
id: e.id,
|
|
685
|
+
...e.data()
|
|
686
|
+
};
|
|
687
|
+
n.removed || t.push(n);
|
|
688
|
+
}), t.sort((e, t) => Number(!!l(t)) - Number(!!l(e))), le(t), de(null), ie(!1);
|
|
689
|
+
}, (e) => {
|
|
690
|
+
console.error("Error fetching users:", e), de(e), ie(!1);
|
|
691
|
+
});
|
|
692
|
+
return () => e();
|
|
693
|
+
}, []), Je(() => {
|
|
694
|
+
!O && L && !qe() && D(`/users/${L}`, { replace: !0 });
|
|
695
|
+
}, [
|
|
696
|
+
O,
|
|
697
|
+
L,
|
|
698
|
+
D
|
|
699
|
+
]);
|
|
700
|
+
let Be = Ye(null), [Ve, He] = G(!1);
|
|
701
|
+
Je(() => {
|
|
702
|
+
let e = Be.current, t = e?.querySelector("[aria-current=\"true\"]");
|
|
703
|
+
if (!e || !t || e.scrollHeight <= e.clientHeight) return;
|
|
704
|
+
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
705
|
+
r.top < n.top ? e.scrollTop -= n.top - r.top + 12 : r.bottom > n.bottom - 40 && (e.scrollTop += r.bottom - n.bottom + 40);
|
|
706
|
+
}, [
|
|
707
|
+
O,
|
|
708
|
+
A.length,
|
|
709
|
+
R
|
|
710
|
+
]);
|
|
711
|
+
let We = A.find((e) => e.id === t?.uid), W = n === "admin", Y = (e) => !W || e.id === We?.id ? !1 : e.role !== "admin" || !We?.createdAt ? !0 : e.createdAt ? new Date(We.createdAt).getTime() <= new Date(e.createdAt).getTime() : !1, Ze = [...be.map((e) => ({
|
|
712
|
+
value: ge(e),
|
|
713
|
+
label: y(ge(e), m)
|
|
714
|
+
})), ...m.map((e) => ({
|
|
715
|
+
value: e.id,
|
|
716
|
+
label: e.name
|
|
717
|
+
}))], $e = Ze.map((t) => ({
|
|
718
|
+
value: t.value,
|
|
719
|
+
label: /* @__PURE__ */ J("span", {
|
|
720
|
+
className: "inline-flex items-center gap-2 min-w-0",
|
|
721
|
+
children: [/* @__PURE__ */ q(e, {
|
|
722
|
+
name: V(t.value, m),
|
|
723
|
+
className: "w-4 h-4 shrink-0 opacity-70"
|
|
724
|
+
}), /* @__PURE__ */ q("span", {
|
|
725
|
+
className: "truncate",
|
|
726
|
+
children: t.label
|
|
727
|
+
})]
|
|
728
|
+
})
|
|
729
|
+
})), Z = yt, ot = (e) => {
|
|
730
|
+
let t = ne.filter((t) => ye(Z(e), t)).map((e) => e.name);
|
|
731
|
+
return t.length ? `In ${t.length === 1 ? "the group" : "the groups"} ${t.join(", ")}` : "";
|
|
732
|
+
}, st = (e) => {
|
|
733
|
+
let t = l(e);
|
|
734
|
+
return t ? a(t.role, y(t.role, m)) : "";
|
|
735
|
+
}, ct = (e) => d(e) && (e === "internal" || m.some((t) => t.id === e)), Q = A.filter((e) => l(e)).length, lt = (e) => !se(e) || ce(e) === "user" ? "" : `Paid plan · until ${new Date(p(e)).toLocaleDateString(void 0, {
|
|
736
|
+
day: "numeric",
|
|
737
|
+
month: "short",
|
|
738
|
+
year: "numeric"
|
|
739
|
+
})}`, dt = (e) => e === ge("free") ? c() : w(), ft = async (e, t, r) => {
|
|
740
|
+
if (n !== "admin" || !Y(e) || Z(e) === t) return;
|
|
741
|
+
let i = l(e);
|
|
742
|
+
try {
|
|
743
|
+
await tt(X(C, "user_profiles", e.id), {
|
|
744
|
+
role: t,
|
|
745
|
+
...oe(),
|
|
746
|
+
...i ? S() : {}
|
|
747
|
+
}), i && await Le(e.id, dt(t)), j({
|
|
748
|
+
text: `Role set to ${r}`,
|
|
749
|
+
type: "success"
|
|
750
|
+
}), setTimeout(() => j(null), 3e3);
|
|
751
|
+
} catch (e) {
|
|
752
|
+
j({
|
|
753
|
+
text: e.message,
|
|
754
|
+
type: "error"
|
|
755
|
+
}), setTimeout(() => j(null), 3e3);
|
|
756
|
+
}
|
|
757
|
+
}, mt = async (e, t) => {
|
|
758
|
+
if (!(n !== "admin" || !Y(e) || !ct(t))) try {
|
|
759
|
+
await tt(X(C, "user_profiles", e.id), {
|
|
760
|
+
role: t,
|
|
761
|
+
...oe(),
|
|
762
|
+
...S()
|
|
763
|
+
}), await Le(e.id, w()), j({
|
|
764
|
+
text: `${U(e)} is ${f(t, y(t, m))} now`,
|
|
765
|
+
type: "success"
|
|
766
|
+
}), setTimeout(() => j(null), 3e3);
|
|
767
|
+
} catch (e) {
|
|
768
|
+
j({
|
|
769
|
+
text: e.message,
|
|
770
|
+
type: "error"
|
|
771
|
+
}), setTimeout(() => j(null), 3e3);
|
|
772
|
+
}
|
|
773
|
+
}, gt = async (e) => {
|
|
774
|
+
if (n !== "admin" || !Y(e)) return;
|
|
775
|
+
let t = l(e);
|
|
776
|
+
try {
|
|
777
|
+
await tt(X(C, "user_profiles", e.id), S()), t && await Le(e.id, c()), j({
|
|
778
|
+
text: `Request cleared — ${U(e)} stays a member`,
|
|
779
|
+
type: "success"
|
|
780
|
+
}), setTimeout(() => j(null), 3e3);
|
|
781
|
+
} catch (e) {
|
|
782
|
+
j({
|
|
783
|
+
text: e.message,
|
|
784
|
+
type: "error"
|
|
785
|
+
}), setTimeout(() => j(null), 3e3);
|
|
786
|
+
}
|
|
787
|
+
}, bt = async (e, t) => {
|
|
788
|
+
if (!(n !== "admin" || !Y(e))) try {
|
|
789
|
+
await tt(X(C, "user_profiles", e.id), { inactive: t }), j({
|
|
790
|
+
text: `User ${t ? "deactivated" : "activated"} successfully`,
|
|
791
|
+
type: "success"
|
|
792
|
+
}), setTimeout(() => j(null), 3e3);
|
|
793
|
+
} catch (e) {
|
|
794
|
+
j({
|
|
795
|
+
text: e.message,
|
|
796
|
+
type: "error"
|
|
797
|
+
}), setTimeout(() => j(null), 3e3);
|
|
798
|
+
}
|
|
799
|
+
}, Ct = async (e) => {
|
|
800
|
+
if (!(n !== "admin" || !Y(e))) {
|
|
801
|
+
Ae(!0);
|
|
802
|
+
try {
|
|
803
|
+
let t = Date.now();
|
|
804
|
+
await et(X(C, "user_profiles", e.id), {
|
|
805
|
+
removed: !0,
|
|
806
|
+
inactive: !0,
|
|
807
|
+
removedAt: new Date(t).toISOString(),
|
|
808
|
+
removedMs: t
|
|
809
|
+
}), await nt(rt(x, `user_avatars/${e.id}/file.png`)).catch(() => {}), await _t(e.id), Ae(!1), N(null), H(null), j({
|
|
810
|
+
text: "Person deleted",
|
|
811
|
+
type: "success"
|
|
812
|
+
}), setTimeout(() => j(null), 3e3);
|
|
813
|
+
} catch (e) {
|
|
814
|
+
Ae(!1), N(null), j({
|
|
815
|
+
text: e.message,
|
|
816
|
+
type: "error"
|
|
817
|
+
}), setTimeout(() => j(null), 3e3);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}, Dt = async () => {
|
|
821
|
+
if (_e(!1), !(!B || !Y(B) || ve === B.displayName)) try {
|
|
822
|
+
await tt(X(C, "user_profiles", B.id), { displayName: ve }), j({
|
|
823
|
+
text: "Name updated successfully",
|
|
824
|
+
type: "success"
|
|
825
|
+
}), setTimeout(() => j(null), 3e3);
|
|
826
|
+
} catch (e) {
|
|
827
|
+
j({
|
|
828
|
+
text: e.message,
|
|
829
|
+
type: "error"
|
|
830
|
+
}), setTimeout(() => j(null), 3e3);
|
|
831
|
+
}
|
|
832
|
+
}, [Ot, kt] = G(!1);
|
|
833
|
+
if (Je(() => {
|
|
834
|
+
let e;
|
|
835
|
+
return E && A.length === 0 ? e = setTimeout(() => kt(!0), 150) : kt(!1), () => clearTimeout(e);
|
|
836
|
+
}, [E, A.length]), E && A.length === 0) return Ot ? /* @__PURE__ */ q("div", {
|
|
837
|
+
className: "fixed inset-0 z-[100] flex items-center justify-center bg-background/60 backdrop-blur-xl transition-all duration-300",
|
|
838
|
+
children: /* @__PURE__ */ q(Ee, { className: "w-8 h-8 animate-spin text-accent" })
|
|
839
|
+
}) : null;
|
|
840
|
+
let $ = k && !!O, At = !$, jt = !k || !!O, Mt = (e) => z && /* @__PURE__ */ J("div", {
|
|
841
|
+
className: `${St} md:w-56 shrink-0`,
|
|
842
|
+
children: [
|
|
843
|
+
/* @__PURE__ */ q(Se, { className: "w-3.5 h-3.5 mr-2 shrink-0 text-foreground/35" }),
|
|
844
|
+
/* @__PURE__ */ q("input", {
|
|
845
|
+
value: Ne,
|
|
846
|
+
onFocus: e,
|
|
847
|
+
onChange: (e) => Fe(e.target.value),
|
|
848
|
+
onKeyDown: (e) => {
|
|
849
|
+
e.key === "Escape" && Fe("");
|
|
850
|
+
},
|
|
851
|
+
placeholder: "Find somebody",
|
|
852
|
+
"aria-label": "Find somebody",
|
|
853
|
+
className: "flex-1 min-w-0 h-full bg-transparent border-none outline-none shadow-none text-[14px] text-foreground placeholder:text-foreground/35 disabled:cursor-not-allowed text-[13px]"
|
|
854
|
+
}),
|
|
855
|
+
!!Ne && /* @__PURE__ */ q("button", {
|
|
856
|
+
type: "button",
|
|
857
|
+
onClick: () => Fe(""),
|
|
858
|
+
"aria-label": "Clear the search",
|
|
859
|
+
className: "shrink-0 -mr-1 w-6 h-6 flex items-center justify-center rounded-full text-foreground/40 hover:text-foreground hover:bg-foreground/5 transition-colors cursor-pointer",
|
|
860
|
+
children: /* @__PURE__ */ q(P, { className: "w-3.5 h-3.5" })
|
|
861
|
+
})
|
|
862
|
+
]
|
|
863
|
+
}), Nt = Q ? `${Q} ${Q === 1 ? "person is" : "people are"} waiting for an answer — first in the list.` : `${A.length} ${A.length === 1 ? "person has" : "people have"} signed up. ${k ? "Tap somebody to " : "Pick somebody to "}${W ? "change what they can open." : "see their details."}`;
|
|
864
|
+
return /* @__PURE__ */ J("main", {
|
|
865
|
+
className: "flex-1 w-full max-w-7xl mx-auto p-4 pt-2 md:p-8 md:pt-4 z-10 flex flex-col min-h-screen",
|
|
866
|
+
children: [
|
|
867
|
+
/* @__PURE__ */ J(ae.div, {
|
|
868
|
+
initial: {
|
|
869
|
+
opacity: 0,
|
|
870
|
+
y: 20
|
|
871
|
+
},
|
|
872
|
+
animate: {
|
|
873
|
+
opacity: 1,
|
|
874
|
+
y: 0
|
|
875
|
+
},
|
|
876
|
+
className: "mb-6",
|
|
877
|
+
children: [/* @__PURE__ */ q(r, { children: "Users" }), /* @__PURE__ */ J("div", {
|
|
878
|
+
className: "flex items-center gap-2 text-foreground/40 font-bold uppercase tracking-[0.2em] text-[11px]",
|
|
879
|
+
children: [/* @__PURE__ */ q("span", { className: "w-8 h-[1px] bg-foreground/10" }), "/users"]
|
|
880
|
+
})]
|
|
881
|
+
}),
|
|
882
|
+
/* @__PURE__ */ J("div", {
|
|
883
|
+
className: "flex flex-col gap-6 flex-1 pb-16",
|
|
884
|
+
children: [
|
|
885
|
+
/* @__PURE__ */ q(h, { children: fe && /* @__PURE__ */ q(ae.div, {
|
|
886
|
+
exit: {
|
|
887
|
+
opacity: 0,
|
|
888
|
+
y: -6
|
|
889
|
+
},
|
|
890
|
+
children: /* @__PURE__ */ q(Re, {
|
|
891
|
+
tone: fe.type === "error" ? "error" : "done",
|
|
892
|
+
children: fe.text
|
|
893
|
+
})
|
|
894
|
+
}) }),
|
|
895
|
+
/* @__PURE__ */ q(pe, {}),
|
|
896
|
+
/* @__PURE__ */ q(Ge, { tab: "users" }),
|
|
897
|
+
/* @__PURE__ */ J("div", {
|
|
898
|
+
className: "glass-panel border border-[var(--panel-border)] rounded-3xl p-4 sm:p-5 md:p-8 shadow-2xl relative bg-background flex flex-col fbos-tab-fill gap-4",
|
|
899
|
+
children: [
|
|
900
|
+
/* @__PURE__ */ q(ee, {
|
|
901
|
+
icon: Te,
|
|
902
|
+
title: "People",
|
|
903
|
+
description: A.length ? Nt : ue ? void 0 : "Nobody has signed up yet.",
|
|
904
|
+
actions: k || !z ? void 0 : ({ open: e }) => Mt(e),
|
|
905
|
+
children: A.length === 0 && ue ? /* @__PURE__ */ q(Re, {
|
|
906
|
+
tone: "error",
|
|
907
|
+
children: u(ue, "The people could not be read.")
|
|
908
|
+
}) : A.length === 0 ? /* @__PURE__ */ q(v, { children: "Everybody who signs in to your app appears here, and this is where you say what each of them can open." }) : /* @__PURE__ */ J("div", {
|
|
909
|
+
className: "grid grid-cols-1 md:grid-cols-[minmax(0,5fr)_minmax(0,7fr)] gap-x-6 lg:gap-x-8 gap-y-5 items-start",
|
|
910
|
+
children: [
|
|
911
|
+
At && (I.length > 1 || z) && /* @__PURE__ */ J("div", {
|
|
912
|
+
className: "md:col-span-2 flex flex-col md:flex-row md:items-start gap-3 md:gap-4 min-w-0",
|
|
913
|
+
children: [I.length > 1 && /* @__PURE__ */ J("div", {
|
|
914
|
+
role: "group",
|
|
915
|
+
"aria-label": "Show",
|
|
916
|
+
className: "flex-1 min-w-0 flex items-center gap-2 md:flex-wrap max-md:overflow-x-auto max-md:-mx-4 max-md:px-4 hide-scrollbar",
|
|
917
|
+
children: [/* @__PURE__ */ q(Tt, {
|
|
918
|
+
label: "Everyone",
|
|
919
|
+
title: "Show everyone",
|
|
920
|
+
count: A.length,
|
|
921
|
+
active: !R,
|
|
922
|
+
onClick: () => Me("")
|
|
923
|
+
}), I.map((e) => {
|
|
924
|
+
let t = e.id === "waiting", n = t ? "Waiting" : y(e.id, m);
|
|
925
|
+
return /* @__PURE__ */ q(Tt, {
|
|
926
|
+
label: n,
|
|
927
|
+
title: t ? "Show only whoever is waiting for an answer" : `Show only ${n}`,
|
|
928
|
+
count: e.people.length,
|
|
929
|
+
icon: t ? "" : V(e.id, m),
|
|
930
|
+
plain: e.id === "user",
|
|
931
|
+
active: R === e.id,
|
|
932
|
+
onClick: () => Me(R === e.id ? "" : e.id)
|
|
933
|
+
}, e.id);
|
|
934
|
+
})]
|
|
935
|
+
}), k && Mt()]
|
|
936
|
+
}),
|
|
937
|
+
At && /* @__PURE__ */ J("div", {
|
|
938
|
+
ref: Be,
|
|
939
|
+
onScroll: (e) => He(e.currentTarget.scrollTop > 2),
|
|
940
|
+
className: `flex flex-col gap-6 min-w-0 md:max-h-[min(72vh,680px)] md:overflow-y-auto md:pb-8 md:-mr-2 md:pr-2 hide-scrollbar ${Ve ? "md:[mask-image:linear-gradient(to_bottom,transparent,black_1.5rem,black_calc(100%-2rem),transparent)]" : "md:[mask-image:linear-gradient(to_bottom,black_calc(100%-2rem),transparent)]"}`,
|
|
941
|
+
children: [Ie.length === 0 && /* @__PURE__ */ q("p", {
|
|
942
|
+
className: "px-3 py-6 text-[13px] font-medium text-foreground/50",
|
|
943
|
+
children: "Nobody here by that name."
|
|
944
|
+
}), Ie.map((t) => {
|
|
945
|
+
let n = t.id === "waiting";
|
|
946
|
+
return /* @__PURE__ */ J("div", {
|
|
947
|
+
className: "flex flex-col gap-1.5 min-w-0",
|
|
948
|
+
children: [/* @__PURE__ */ J("div", {
|
|
949
|
+
role: "heading",
|
|
950
|
+
"aria-level": 4,
|
|
951
|
+
className: "flex items-center gap-2.5 px-3 text-[13px] font-bold text-foreground/85 leading-tight",
|
|
952
|
+
children: [
|
|
953
|
+
/* @__PURE__ */ q("span", {
|
|
954
|
+
className: `w-7 h-7 rounded-[10px] flex items-center justify-center shrink-0 ${t.id === "user" ? "bg-foreground/[0.05] text-foreground/40" : "bg-accent/10 text-accent"}`,
|
|
955
|
+
children: n ? /* @__PURE__ */ q("span", { className: "w-1.5 h-1.5 rounded-full bg-accent animate-pulse" }) : /* @__PURE__ */ q(e, {
|
|
956
|
+
name: V(t.id, m),
|
|
957
|
+
className: "w-3.5 h-3.5"
|
|
958
|
+
})
|
|
959
|
+
}),
|
|
960
|
+
/* @__PURE__ */ q("span", {
|
|
961
|
+
className: "truncate",
|
|
962
|
+
children: n ? "Waiting for an answer" : y(t.id, m)
|
|
963
|
+
}),
|
|
964
|
+
/* @__PURE__ */ q("span", {
|
|
965
|
+
className: "shrink-0 text-[11.5px] font-semibold text-foreground/35 tabular-nums",
|
|
966
|
+
children: t.people.length
|
|
967
|
+
})
|
|
968
|
+
]
|
|
969
|
+
}), /* @__PURE__ */ q("div", {
|
|
970
|
+
className: `flex flex-col gap-0.5 min-w-0 ${n ? "rounded-2xl border border-accent/20 bg-accent/[0.04] p-1" : ""}`,
|
|
971
|
+
children: t.people.map((e) => {
|
|
972
|
+
let t = !!O && B?.id === e.id;
|
|
973
|
+
return /* @__PURE__ */ J("div", {
|
|
974
|
+
role: "button",
|
|
975
|
+
tabIndex: 0,
|
|
976
|
+
"aria-current": t || void 0,
|
|
977
|
+
onClick: () => H(e),
|
|
978
|
+
onKeyDown: (t) => {
|
|
979
|
+
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), H(e));
|
|
980
|
+
},
|
|
981
|
+
className: `flex items-center gap-3 px-3 py-2.5 rounded-xl transition-colors cursor-pointer outline-none focus-visible:bg-foreground/[0.05] ${t ? "bg-accent/[0.09]" : "hover:bg-foreground/[0.035]"} ${e.inactive ? "opacity-55" : ""}`,
|
|
982
|
+
children: [
|
|
983
|
+
/* @__PURE__ */ J("span", {
|
|
984
|
+
className: "flex flex-col gap-0.5 min-w-0 flex-1",
|
|
985
|
+
children: [/* @__PURE__ */ q("span", {
|
|
986
|
+
className: "text-[14px] font-semibold text-foreground leading-tight truncate",
|
|
987
|
+
children: U(e)
|
|
988
|
+
}), /* @__PURE__ */ q("span", {
|
|
989
|
+
className: "max-sm:hidden text-[12.5px] text-foreground/45 leading-snug truncate",
|
|
990
|
+
children: Ue(e)
|
|
991
|
+
})]
|
|
992
|
+
}),
|
|
993
|
+
!e.inactive && l(e) ? k ? /* @__PURE__ */ q(Et, {
|
|
994
|
+
label: y(l(e).role, m),
|
|
995
|
+
icon: V(l(e).role, m),
|
|
996
|
+
plain: !1,
|
|
997
|
+
waiting: !0
|
|
998
|
+
}) : /* @__PURE__ */ q(Et, {
|
|
999
|
+
label: st(e),
|
|
1000
|
+
plain: !1,
|
|
1001
|
+
waiting: !0
|
|
1002
|
+
}) : e.inactive ? /* @__PURE__ */ q(Et, {
|
|
1003
|
+
label: "Off",
|
|
1004
|
+
plain: !0
|
|
1005
|
+
}) : null,
|
|
1006
|
+
k ? /* @__PURE__ */ q(De, { className: "w-4 h-4 text-foreground/25 shrink-0 -mr-1" }) : t && /* @__PURE__ */ q(De, { className: "w-4 h-4 text-accent/70 shrink-0 -mr-0.5" })
|
|
1007
|
+
]
|
|
1008
|
+
}, e.id);
|
|
1009
|
+
})
|
|
1010
|
+
})]
|
|
1011
|
+
}, t.id);
|
|
1012
|
+
})]
|
|
1013
|
+
}),
|
|
1014
|
+
jt && (B ? /* @__PURE__ */ J("div", {
|
|
1015
|
+
className: "rounded-2xl border border-[var(--panel-border)]/60 bg-foreground/[0.015] overflow-hidden fbos-fade-in min-w-0",
|
|
1016
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1017
|
+
className: "flex items-center gap-3 px-4 sm:px-5 py-4 border-b border-[var(--panel-border)]/50 min-w-0",
|
|
1018
|
+
children: [
|
|
1019
|
+
$ && /* @__PURE__ */ q("button", {
|
|
1020
|
+
type: "button",
|
|
1021
|
+
onClick: () => H(null),
|
|
1022
|
+
"aria-label": "Back to all users",
|
|
1023
|
+
className: "shrink-0 -ml-1.5 w-8 h-8 flex items-center justify-center rounded-lg text-foreground/45 hover:text-foreground active:bg-foreground/5 transition-colors cursor-pointer",
|
|
1024
|
+
children: /* @__PURE__ */ q(we, { className: "w-4.5 h-4.5" })
|
|
1025
|
+
}),
|
|
1026
|
+
/* @__PURE__ */ q("span", {
|
|
1027
|
+
"aria-hidden": !0,
|
|
1028
|
+
className: `max-sm:hidden w-10 h-10 rounded-2xl flex items-center justify-center shrink-0 border border-[var(--panel-border)]/50 ${B.inactive || Z(B) === "user" ? "bg-foreground/[0.04] text-foreground/40" : "bg-accent/10 text-accent"}`,
|
|
1029
|
+
children: /* @__PURE__ */ q(e, {
|
|
1030
|
+
name: V(Z(B), m),
|
|
1031
|
+
className: "w-5 h-5"
|
|
1032
|
+
})
|
|
1033
|
+
}),
|
|
1034
|
+
/* @__PURE__ */ J("div", {
|
|
1035
|
+
className: "flex flex-col flex-1 min-w-0 gap-0.5",
|
|
1036
|
+
children: [he ? /* @__PURE__ */ q("input", {
|
|
1037
|
+
autoFocus: !0,
|
|
1038
|
+
value: ve,
|
|
1039
|
+
"aria-label": "Name",
|
|
1040
|
+
onChange: (e) => Ce(e.target.value),
|
|
1041
|
+
onBlur: Dt,
|
|
1042
|
+
onKeyDown: (e) => e.key === "Enter" && Dt(),
|
|
1043
|
+
className: "text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight bg-transparent border-b-2 border-accent outline-none text-foreground w-full"
|
|
1044
|
+
}) : /* @__PURE__ */ q("h3", {
|
|
1045
|
+
onDoubleClick: () => {
|
|
1046
|
+
Y(B) && (Ce(B.displayName || ""), _e(!0));
|
|
1047
|
+
},
|
|
1048
|
+
className: `text-[17px] sm:text-[18px] font-bold tracking-tight leading-tight text-foreground select-none truncate ${Y(B) ? "cursor-pointer hover:text-accent transition-colors" : ""}`,
|
|
1049
|
+
title: Y(B) ? "Double-click to rename" : "",
|
|
1050
|
+
children: U(B)
|
|
1051
|
+
}), /* @__PURE__ */ q("p", {
|
|
1052
|
+
className: "text-[12.5px] text-foreground/50 leading-snug truncate",
|
|
1053
|
+
children: Ue(B)
|
|
1054
|
+
})]
|
|
1055
|
+
}),
|
|
1056
|
+
B.inactive && /* @__PURE__ */ q("span", {
|
|
1057
|
+
className: "max-sm:hidden",
|
|
1058
|
+
children: /* @__PURE__ */ q(Et, {
|
|
1059
|
+
label: "Off",
|
|
1060
|
+
plain: !0
|
|
1061
|
+
})
|
|
1062
|
+
})
|
|
1063
|
+
]
|
|
1064
|
+
}), /* @__PURE__ */ J("div", {
|
|
1065
|
+
className: "flex flex-col gap-5 p-4 sm:p-5",
|
|
1066
|
+
children: [
|
|
1067
|
+
(() => {
|
|
1068
|
+
let e = l(B);
|
|
1069
|
+
if (!e) return null;
|
|
1070
|
+
let t = ct(e.role), n = e.at ? new Date(e.at).toLocaleDateString(void 0, {
|
|
1071
|
+
day: "numeric",
|
|
1072
|
+
month: "short"
|
|
1073
|
+
}) : "";
|
|
1074
|
+
return /* @__PURE__ */ J("div", {
|
|
1075
|
+
className: "rounded-xl border border-accent/30 bg-accent/[0.05] px-4 py-3 flex items-center gap-3 flex-wrap",
|
|
1076
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1077
|
+
className: "flex flex-col gap-0.5 min-w-0 flex-1",
|
|
1078
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1079
|
+
className: "text-[13px] font-bold text-foreground leading-tight",
|
|
1080
|
+
children: st(B)
|
|
1081
|
+
}), /* @__PURE__ */ q("span", {
|
|
1082
|
+
className: "text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug",
|
|
1083
|
+
children: t ? `${n ? `Asked ${n}. ` : ""}A member until you say otherwise.` : "That role no longer exists — clear the request, or pick them another role below."
|
|
1084
|
+
})]
|
|
1085
|
+
}), Y(B) && /* @__PURE__ */ J("div", {
|
|
1086
|
+
className: "flex items-center gap-2 shrink-0",
|
|
1087
|
+
children: [t && /* @__PURE__ */ q(T, {
|
|
1088
|
+
icon: F,
|
|
1089
|
+
compact: !0,
|
|
1090
|
+
title: `Approve ${U(B)} as ${y(e.role, m)}`,
|
|
1091
|
+
onClick: () => mt(B, e.role),
|
|
1092
|
+
children: "Approve"
|
|
1093
|
+
}), /* @__PURE__ */ q(T, {
|
|
1094
|
+
icon: P,
|
|
1095
|
+
compact: !0,
|
|
1096
|
+
title: t ? "Decline the request" : "Clear the request",
|
|
1097
|
+
onClick: () => gt(B),
|
|
1098
|
+
children: t ? "Decline" : "Clear"
|
|
1099
|
+
})]
|
|
1100
|
+
})]
|
|
1101
|
+
});
|
|
1102
|
+
})(),
|
|
1103
|
+
/* @__PURE__ */ q(b, {
|
|
1104
|
+
label: "Role",
|
|
1105
|
+
hint: [lt(B), ot(B)].filter(Boolean).join(" · ") || void 0,
|
|
1106
|
+
children: /* @__PURE__ */ q(re, {
|
|
1107
|
+
ariaLabel: "Role",
|
|
1108
|
+
value: Z(B),
|
|
1109
|
+
options: $e,
|
|
1110
|
+
onChange: (e) => {
|
|
1111
|
+
let t = Ze.find((t) => t.value === e);
|
|
1112
|
+
t && ft(B, t.value, t.label);
|
|
1113
|
+
},
|
|
1114
|
+
disabled: !Y(B),
|
|
1115
|
+
className: "console-select",
|
|
1116
|
+
dense: !0,
|
|
1117
|
+
portal: !0,
|
|
1118
|
+
direction: "auto"
|
|
1119
|
+
})
|
|
1120
|
+
}),
|
|
1121
|
+
W && !Y(B) && B.id !== We?.id && /* @__PURE__ */ J("p", {
|
|
1122
|
+
className: "-mt-3 flex items-center gap-1.5 px-1 text-[12px] font-medium text-foreground/45",
|
|
1123
|
+
children: [/* @__PURE__ */ q(Oe, { className: "w-3 h-3 shrink-0" }), "Admin since before you, so only they can change this account."]
|
|
1124
|
+
}),
|
|
1125
|
+
/* @__PURE__ */ q(vt, {
|
|
1126
|
+
person: B,
|
|
1127
|
+
settings: _.finishRegistration
|
|
1128
|
+
}),
|
|
1129
|
+
/* @__PURE__ */ q("div", {
|
|
1130
|
+
className: "pt-5 border-t border-[var(--panel-border)]/50",
|
|
1131
|
+
children: /* @__PURE__ */ q(o, {
|
|
1132
|
+
label: "Can use the app",
|
|
1133
|
+
hint: B.inactive ? "Switched off — every page is closed to them." : "Switch off to close every page to them.",
|
|
1134
|
+
hintWideOnly: !0,
|
|
1135
|
+
enabled: !B.inactive,
|
|
1136
|
+
onChange: (e) => bt(B, !e),
|
|
1137
|
+
disabled: !Y(B)
|
|
1138
|
+
})
|
|
1139
|
+
}),
|
|
1140
|
+
Y(B) && /* @__PURE__ */ J("div", {
|
|
1141
|
+
className: "flex items-center justify-between gap-4 pt-5 border-t border-[var(--panel-border)]/50",
|
|
1142
|
+
children: [/* @__PURE__ */ J("div", {
|
|
1143
|
+
className: "flex flex-col gap-0.5 min-w-0 ml-1",
|
|
1144
|
+
children: [/* @__PURE__ */ q("span", {
|
|
1145
|
+
className: "text-[13px] font-medium text-foreground/80",
|
|
1146
|
+
children: "Delete this person"
|
|
1147
|
+
}), /* @__PURE__ */ q("span", {
|
|
1148
|
+
className: "text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug max-sm:hidden",
|
|
1149
|
+
children: "Everything about them goes, their sign-in with it. What they made on your pages stays."
|
|
1150
|
+
})]
|
|
1151
|
+
}), /* @__PURE__ */ q(T, {
|
|
1152
|
+
icon: xe,
|
|
1153
|
+
tone: "danger",
|
|
1154
|
+
compact: !0,
|
|
1155
|
+
title: `Delete ${U(B)}`,
|
|
1156
|
+
onClick: () => N(B),
|
|
1157
|
+
children: "Delete"
|
|
1158
|
+
})]
|
|
1159
|
+
})
|
|
1160
|
+
]
|
|
1161
|
+
})]
|
|
1162
|
+
}) : /* @__PURE__ */ q("div", {
|
|
1163
|
+
className: "rounded-2xl border border-dashed border-[var(--panel-border)] min-h-[200px] flex flex-col items-center justify-center gap-3 px-4 text-center",
|
|
1164
|
+
children: $ && !E ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("p", {
|
|
1165
|
+
className: "text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug",
|
|
1166
|
+
children: "This person is not on the list any more."
|
|
1167
|
+
}), /* @__PURE__ */ q(T, {
|
|
1168
|
+
onClick: () => D("/users", { replace: !0 }),
|
|
1169
|
+
children: "Back to all users"
|
|
1170
|
+
})] }) : /* @__PURE__ */ q("p", {
|
|
1171
|
+
className: "text-[11px] sm:text-[11.5px] text-foreground/40 font-medium leading-snug",
|
|
1172
|
+
children: "Pick somebody to see their role."
|
|
1173
|
+
})
|
|
1174
|
+
}))
|
|
1175
|
+
]
|
|
1176
|
+
})
|
|
1177
|
+
}),
|
|
1178
|
+
W && /* @__PURE__ */ q("div", {
|
|
1179
|
+
hidden: $,
|
|
1180
|
+
children: /* @__PURE__ */ q(ut, {
|
|
1181
|
+
roles: m,
|
|
1182
|
+
plans: te
|
|
1183
|
+
})
|
|
1184
|
+
}),
|
|
1185
|
+
W && /* @__PURE__ */ q("div", {
|
|
1186
|
+
hidden: $,
|
|
1187
|
+
children: /* @__PURE__ */ q(pt, { roles: m })
|
|
1188
|
+
})
|
|
1189
|
+
]
|
|
1190
|
+
})
|
|
1191
|
+
]
|
|
1192
|
+
}),
|
|
1193
|
+
/* @__PURE__ */ q(ze, {
|
|
1194
|
+
isOpen: !!M,
|
|
1195
|
+
title: M ? `Delete ${U(M, "this person")}?` : "",
|
|
1196
|
+
message: M ? ht(U(M, "this person")) : "",
|
|
1197
|
+
confirmText: "Yes, delete them",
|
|
1198
|
+
cancelText: "Keep them",
|
|
1199
|
+
isProcessing: ke,
|
|
1200
|
+
onCancel: () => N(null),
|
|
1201
|
+
onConfirm: () => M && Ct(M)
|
|
1202
|
+
})
|
|
1203
|
+
]
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
//#endregion
|
|
1207
|
+
export { Dt as UsersTab };
|