react-semaphor 0.1.260 → 0.1.262
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/chunks/dashboard-controls-AFlpiHtC.js +42 -0
- package/dist/chunks/dashboard-controls-Cq2fQ7bv.js +1979 -0
- package/dist/chunks/dashboard-filter-controls-button-Cedz-YZx.js +11 -0
- package/dist/chunks/dashboard-filter-controls-button-udrHABi3.js +1066 -0
- package/dist/chunks/{dashboard-json-BUrApiYl.js → dashboard-json-BU6cvmRP.js} +1 -1
- package/dist/chunks/{dashboard-json-U7VmojaR.js → dashboard-json-RKwWONKm.js} +1 -1
- package/dist/chunks/dashboard-summary-settings-dialog-Bl-XplTR.js +1 -0
- package/dist/chunks/dashboard-summary-settings-dialog-DDxHxKjp.js +535 -0
- package/dist/chunks/{edit-dashboard-visual-N2r5ObJ_.js → edit-dashboard-visual-B1r0Ho9B.js} +5970 -5492
- package/dist/chunks/edit-dashboard-visual-BwDFI3hI.js +188 -0
- package/dist/chunks/{index-BNdZjo5d.js → index-BtbNfaQD.js} +50751 -47206
- package/dist/chunks/index-DZ93VE76.js +1114 -0
- package/dist/chunks/{normalize-dashboard-for-dirty-check-Bn27S0PN.js → normalize-dashboard-for-dirty-check-5KpZN8xr.js} +20 -19
- package/dist/chunks/normalize-dashboard-for-dirty-check-BXRUMVb2.js +1 -0
- package/dist/chunks/{resource-management-panel-C_ZqsVMH.js → resource-management-panel-Cz7MYBC7.js} +1 -1
- package/dist/chunks/{resource-management-panel-zF23gLOJ.js → resource-management-panel-DxG6-naG.js} +70 -70
- package/dist/chunks/use-create-flow-overlay-state-BcMrPzMc.js +1445 -0
- package/dist/chunks/use-create-flow-overlay-state-D13D1vB_.js +21 -0
- package/dist/chunks/{use-visual-utils-BBTQGDdB.js → use-visual-utils-DScc5-p_.js} +1 -1
- package/dist/chunks/{use-visual-utils-K1k39w2U.js → use-visual-utils-DmxEKpor.js} +1 -1
- package/dist/dashboard/index.cjs +1 -1
- package/dist/dashboard/index.js +5 -4
- package/dist/index.cjs +1 -1
- package/dist/index.js +102 -99
- package/dist/shared/index.cjs +1 -1
- package/dist/shared/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/surfboard/index.cjs +1 -1
- package/dist/surfboard/index.js +5 -4
- package/dist/types/dashboard.d.ts +105 -0
- package/dist/types/index.cjs +1 -1
- package/dist/types/index.js +4 -3
- package/dist/types/main.d.ts +175 -1
- package/dist/types/shared.d.ts +89 -0
- package/dist/types/surfboard.d.ts +105 -0
- package/dist/types/types.d.ts +113 -0
- package/package.json +1 -1
- package/dist/chunks/dashboard-controls-CIdYp98a.js +0 -47
- package/dist/chunks/dashboard-controls-DOqBYrkB.js +0 -1847
- package/dist/chunks/dashboard-summary-settings-dialog-CaxmCNyy.js +0 -1
- package/dist/chunks/dashboard-summary-settings-dialog-DlVBUQmC.js +0 -544
- package/dist/chunks/edit-dashboard-visual-uA-0wLnR.js +0 -193
- package/dist/chunks/editor-action-buttons-B6lABkRB.js +0 -412
- package/dist/chunks/editor-action-buttons-Dh7Xndgk.js +0 -21
- package/dist/chunks/index-DOeggx0V.js +0 -1109
- package/dist/chunks/normalize-dashboard-for-dirty-check-B7NQDI1H.js +0 -1
- package/dist/chunks/notification-bell-BxyeaeRc.js +0 -839
- package/dist/chunks/notification-bell-tJRds5JJ.js +0 -6
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("react/jsx-runtime"),l=require("react"),a=require("./index-DOeggx0V.js");function W(){var N,C,T,y;const{authToken:s,tokenProps:r}=a.useSemaphorContext(),[i,S]=l.useState(!1),[x,v]=l.useState(!1),[j,b]=l.useState(!1),[p,u]=l.useState(null),[m,n]=l.useState(null),g=m||{tz:((C=(N=r==null?void 0:r.params)==null?void 0:N.calendarContext)==null?void 0:C.tz)||null,weekStart:((y=(T=r==null?void 0:r.params)==null?void 0:T.calendarContext)==null?void 0:y.weekStart)??null},d=l.useCallback(async()=>{if(!(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))){S(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"GET",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to fetch preferences")}const o=await c.json();n({tz:o.tz,weekStart:o.weekStart,source:o.source,isInherited:o.isInherited,userHasPrefs:o.userHasPrefs,inherited:o.inherited})}catch(c){const o=c instanceof Error?c.message:"Unknown error";u(o)}finally{S(!1)}}},[s,r]);l.useEffect(()=>{d()},[d]);const f=l.useCallback(async c=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;v(!0),u(null);try{const o=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"PATCH",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s.accessToken}`},body:JSON.stringify(c)});if(!o.ok){const h=await o.json().catch(()=>({}));throw new Error(h.error||"Failed to update preferences")}return await d(),!0}catch(o){const h=o instanceof Error?o.message:"Unknown error";return u(h),!1}finally{v(!1)}},[s,r,d]),w=l.useCallback(async()=>{if(!(s!=null&&s.accessToken)||!(r!=null&&r.apiServiceUrl))return u("Not authenticated"),!1;b(!0),u(null);try{const c=await fetch(`${r.apiServiceUrl}/v1/user-preferences/calendar`,{method:"DELETE",headers:{Authorization:`Bearer ${s.accessToken}`}});if(!c.ok){const h=await c.json().catch(()=>({}));throw new Error(h.error||"Failed to clear preferences")}const o=await c.text();if(o)try{const h=JSON.parse(o);return n({tz:h.tz,weekStart:h.weekStart,source:h.source,isInherited:h.isInherited??!0,userHasPrefs:!1,inherited:h.inherited}),!0}catch{}return await d(),!0}catch(c){const o=c instanceof Error?c.message:"Unknown error";return u(o),!1}finally{b(!1)}},[s,r,d]);return{preferences:g,isLoading:i,isSaving:x,isClearing:j,error:p,updatePreferences:f,clearPreferences:w,refetch:d}}const I=[{value:"America/New_York",label:"Eastern Time (US & Canada)"},{value:"America/Chicago",label:"Central Time (US & Canada)"},{value:"America/Denver",label:"Mountain Time (US & Canada)"},{value:"America/Los_Angeles",label:"Pacific Time (US & Canada)"},{value:"America/Phoenix",label:"Arizona"},{value:"America/Anchorage",label:"Alaska"},{value:"Pacific/Honolulu",label:"Hawaii"},{value:"Europe/London",label:"London"},{value:"Europe/Paris",label:"Paris, Berlin, Rome"},{value:"Asia/Tokyo",label:"Tokyo"},{value:"Asia/Shanghai",label:"Beijing, Shanghai"},{value:"Asia/Kolkata",label:"Mumbai, New Delhi"},{value:"Australia/Sydney",label:"Sydney"},{value:"UTC",label:"UTC"}],M=[{value:0,label:"Sunday"},{value:1,label:"Monday"},{value:6,label:"Saturday"}];function G(){try{const s=Intl;if(s.supportedValuesOf)return s.supportedValuesOf("timeZone")}catch{}return I.map(s=>s.value)}function V(s){switch(s){case"tenant":return"tenant";case"organization":return"organization";case"system":return"system";default:return"default"}}function L(s){const r=I.find(i=>i.value===s);return r?r.label:s}function X(s){const r=M.find(i=>i.value===s);return r?r.label:String(s)}function q({open:s,onOpenChange:r}){var E,P,A;const{preferences:i,isLoading:S,isSaving:x,isClearing:v,updatePreferences:j,clearPreferences:b}=W(),p=i.tz||((E=i.inherited)==null?void 0:E.tz)||Intl.DateTimeFormat().resolvedOptions().timeZone,u=i.weekStart??((P=i.inherited)==null?void 0:P.weekStart)??1,[m,n]=l.useState(!i.userHasPrefs),[g,d]=l.useState(!1),[f,w]=l.useState(p),[N,C]=l.useState(u),[T,y]=l.useState(!1),c=l.useMemo(()=>G(),[]),o=l.useMemo(()=>c.filter(t=>!I.some(R=>R.value===t)),[c]),h=l.useMemo(()=>L(f),[f]),F=i.inherited?L(i.inherited.tz):"UTC",H=i.inherited?X(i.inherited.weekStart):"Monday",B=V((A=i.inherited)==null?void 0:A.source);l.useEffect(()=>{if(!s){d(!1);return}g||(i.userHasPrefs!==void 0&&n(!i.userHasPrefs),w(p),C(u))},[s,g,i.userHasPrefs,p,u]);const _=async()=>{if(S){a.ue.error("Preferences are still loading. Please try again.");return}m?await b()?(a.ue.success("Now using default settings. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again."):await j({tz:f,weekStart:N})?(a.ue.success("Preferences saved. Please refresh the page to apply changes.",{duration:5e3}),r(!1)):a.ue.error("Failed to save preferences. Please try again.")},$=()=>{r(!1)},D=x||v,O=D||S;return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Calendar Preferences"}),e.jsx(a.DialogDescription,{children:"Set your timezone and week start preferences for date calculations and displays."})]}),e.jsxs("div",{className:"space-y-6 py-4",children:[e.jsxs(a.RadioGroup,{value:m?"defaults":"custom",onValueChange:t=>{d(!0),n(t==="defaults")},className:"space-y-3",children:[e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-primary bg-primary/5":"border-border hover:border-muted-foreground/50"),onClick:()=>{d(!0),n(!0)},children:[e.jsx(a.RadioGroupItem,{value:"defaults",id:"mode-defaults"}),e.jsxs("div",{className:"flex-1 space-y-1",children:[e.jsxs(a.Label,{htmlFor:"mode-defaults",className:"cursor-pointer font-medium",children:["Use ",B," defaults"]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[F,", Week starts ",H]})]})]}),e.jsxs("div",{className:a.cn("flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",m?"border-border hover:border-muted-foreground/50":"border-primary bg-primary/5"),onClick:()=>{d(!0),n(!1)},children:[e.jsx(a.RadioGroupItem,{value:"custom",id:"mode-custom"}),e.jsx(a.Label,{htmlFor:"mode-custom",className:"cursor-pointer font-medium",children:"Use custom settings"})]})]}),e.jsxs("div",{className:a.cn("space-y-6 transition-opacity",m&&"opacity-50 pointer-events-none"),children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{children:"Timezone"}),e.jsxs(a.Popover,{open:T,onOpenChange:y,modal:!0,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(a.Button,{variant:"outline",role:"combobox","aria-expanded":T,className:"w-full justify-between",disabled:m,children:[h,e.jsx(a.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"z-50 w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(a.Command,{className:"overflow-visible",children:[e.jsx(a.CommandInput,{placeholder:"Search timezones..."}),e.jsxs(a.CommandList,{children:[e.jsx(a.CommandEmpty,{children:"No timezone found."}),e.jsx(a.CommandGroup,{heading:"Common",children:I.map(t=>e.jsxs(a.CommandItem,{value:`${t.value} ${t.label}`,onSelect:()=>{d(!0),w(t.value),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t.value?"opacity-100":"opacity-0")}),e.jsx("span",{className:"flex-1",children:t.label}),e.jsx("span",{className:"text-xs text-muted-foreground",children:t.value})]},t.value))}),e.jsx(a.CommandSeparator,{}),e.jsx(a.CommandGroup,{heading:"All Timezones",children:o.map(t=>e.jsxs(a.CommandItem,{value:t,onSelect:()=>{d(!0),w(t),y(!1)},children:[e.jsx(a.Check,{className:a.cn("mr-2 h-4 w-4",f===t?"opacity-100":"opacity-0")}),t]},t))})]})]})})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{children:"Week Starts On"}),e.jsx(a.RadioGroup,{value:String(N),onValueChange:t=>{d(!0),C(Number(t))},className:"flex gap-4",disabled:m,children:M.map(t=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(a.RadioGroupItem,{value:String(t.value),id:`week-start-${t.value}`,disabled:m}),e.jsx(a.Label,{htmlFor:`week-start-${t.value}`,className:a.cn("cursor-pointer font-normal",m&&"cursor-not-allowed"),children:t.label})]},t.value))})]})]})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:$,disabled:D,children:"Cancel"}),e.jsx(a.Button,{onClick:_,disabled:O,children:D?e.jsxs(e.Fragment,{children:[e.jsx(a.LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving..."]}):"Save"})]})]})})}const k=6,z=1,U=20;function Z(s){return Number.isNaN(s)?k:Math.min(U,Math.max(z,s))}function J({open:s,onOpenChange:r,dashboard:i,onApply:S,disabled:x=!1}){const[v,j]=l.useState(!1),[b,p]=l.useState("top"),[u,m]=l.useState(String(k)),n=i.summary;l.useEffect(()=>{s&&(j((n==null?void 0:n.enabled)===!0),p((n==null?void 0:n.position)==="bottom"?"bottom":"top"),m(String((n==null?void 0:n.maxItems)??k)))},[s,n==null?void 0:n.enabled,n==null?void 0:n.position,n==null?void 0:n.maxItems]);const g=l.useMemo(()=>Z(Number.parseInt(u||`${k}`,10)),[u]),d=()=>{S({enabled:v,position:b,maxItems:g}),r(!1)};return e.jsx(a.Dialog,{open:s,onOpenChange:r,children:e.jsxs(a.DialogContent,{className:"sm:max-w-[420px]",children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:"Summary Settings"}),e.jsx(a.DialogDescription,{children:"Configure dashboard-level summary display. Card-level summary settings still control which cards contribute."})]}),e.jsxs("div",{className:"space-y-4 py-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-enabled",children:"Enable Dashboard Summary"}),e.jsx(a.SmallSwitch,{id:"dashboard-summary-enabled",checked:v,disabled:x,onCheckedChange:j})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-position",children:"Position"}),e.jsxs(a.Select,{value:b,disabled:x,onValueChange:f=>p(f),children:[e.jsx(a.SelectTrigger,{id:"dashboard-summary-position",children:e.jsx(a.SelectValue,{placeholder:"Select position"})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"top",children:"Top"}),e.jsx(a.SelectItem,{value:"bottom",children:"Bottom"})]})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(a.Label,{htmlFor:"dashboard-summary-max-items",children:"Max Items"}),e.jsx(a.Input,{id:"dashboard-summary-max-items",type:"number",min:z,max:U,disabled:x,value:u,onChange:f=>m(f.target.value),onBlur:()=>m(String(g))}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Display limit only. Computation is unchanged."})]}),x&&e.jsx("p",{className:"text-xs text-amber-700",children:"Enter dashboard edit mode to modify summary settings."})]}),e.jsxs(a.DialogFooter,{children:[e.jsx(a.Button,{variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(a.Button,{onClick:d,disabled:x,children:"Apply"})]})]})})}exports.CalendarPreferencesDialog=q;exports.DashboardSummarySettingsDialog=J;
|
|
@@ -1,544 +0,0 @@
|
|
|
1
|
-
import { jsx as e, jsxs as s, Fragment as oe } from "react/jsx-runtime";
|
|
2
|
-
import de, { useState as h, useCallback as L, useEffect as G, useMemo as z } from "react";
|
|
3
|
-
import { b as ue, e as X, f as Z, g as J, h as K, i as q, R as $, c as C, j as F, L as b, P as me, k as he, B as P, C as fe, l as pe, m as ve, n as be, o as Se, p as ge, q as B, r as O, s as W, t as ye, v as Y, w as we, x as A, S as xe, y as Ne, z as Ce, A as Te, E as ke, F as R, I as Ie } from "./index-BNdZjo5d.js";
|
|
4
|
-
function Ee() {
|
|
5
|
-
var k, I, E, N;
|
|
6
|
-
const { authToken: a, tokenProps: r } = ue(), [l, S] = h(!1), [p, g] = h(!1), [x, y] = h(!1), [v, o] = h(null), [u, n] = h(null), w = u || {
|
|
7
|
-
tz: ((I = (k = r == null ? void 0 : r.params) == null ? void 0 : k.calendarContext) == null ? void 0 : I.tz) || null,
|
|
8
|
-
weekStart: ((N = (E = r == null ? void 0 : r.params) == null ? void 0 : E.calendarContext) == null ? void 0 : N.weekStart) ?? null
|
|
9
|
-
}, d = L(async () => {
|
|
10
|
-
if (!(!(a != null && a.accessToken) || !(r != null && r.apiServiceUrl))) {
|
|
11
|
-
S(!0), o(null);
|
|
12
|
-
try {
|
|
13
|
-
const c = await fetch(
|
|
14
|
-
`${r.apiServiceUrl}/v1/user-preferences/calendar`,
|
|
15
|
-
{
|
|
16
|
-
method: "GET",
|
|
17
|
-
headers: {
|
|
18
|
-
Authorization: `Bearer ${a.accessToken}`
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
if (!c.ok) {
|
|
23
|
-
const m = await c.json().catch(() => ({}));
|
|
24
|
-
throw new Error(m.error || "Failed to fetch preferences");
|
|
25
|
-
}
|
|
26
|
-
const i = await c.json();
|
|
27
|
-
n({
|
|
28
|
-
tz: i.tz,
|
|
29
|
-
weekStart: i.weekStart,
|
|
30
|
-
source: i.source,
|
|
31
|
-
isInherited: i.isInherited,
|
|
32
|
-
userHasPrefs: i.userHasPrefs,
|
|
33
|
-
inherited: i.inherited
|
|
34
|
-
});
|
|
35
|
-
} catch (c) {
|
|
36
|
-
const i = c instanceof Error ? c.message : "Unknown error";
|
|
37
|
-
o(i);
|
|
38
|
-
} finally {
|
|
39
|
-
S(!1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}, [a, r]);
|
|
43
|
-
G(() => {
|
|
44
|
-
d();
|
|
45
|
-
}, [d]);
|
|
46
|
-
const f = L(
|
|
47
|
-
async (c) => {
|
|
48
|
-
if (!(a != null && a.accessToken) || !(r != null && r.apiServiceUrl))
|
|
49
|
-
return o("Not authenticated"), !1;
|
|
50
|
-
g(!0), o(null);
|
|
51
|
-
try {
|
|
52
|
-
const i = await fetch(
|
|
53
|
-
`${r.apiServiceUrl}/v1/user-preferences/calendar`,
|
|
54
|
-
{
|
|
55
|
-
method: "PATCH",
|
|
56
|
-
headers: {
|
|
57
|
-
"Content-Type": "application/json",
|
|
58
|
-
Authorization: `Bearer ${a.accessToken}`
|
|
59
|
-
},
|
|
60
|
-
body: JSON.stringify(c)
|
|
61
|
-
}
|
|
62
|
-
);
|
|
63
|
-
if (!i.ok) {
|
|
64
|
-
const m = await i.json().catch(() => ({}));
|
|
65
|
-
throw new Error(m.error || "Failed to update preferences");
|
|
66
|
-
}
|
|
67
|
-
return await d(), !0;
|
|
68
|
-
} catch (i) {
|
|
69
|
-
const m = i instanceof Error ? i.message : "Unknown error";
|
|
70
|
-
return o(m), !1;
|
|
71
|
-
} finally {
|
|
72
|
-
g(!1);
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
[a, r, d]
|
|
76
|
-
), T = L(async () => {
|
|
77
|
-
if (!(a != null && a.accessToken) || !(r != null && r.apiServiceUrl))
|
|
78
|
-
return o("Not authenticated"), !1;
|
|
79
|
-
y(!0), o(null);
|
|
80
|
-
try {
|
|
81
|
-
const c = await fetch(
|
|
82
|
-
`${r.apiServiceUrl}/v1/user-preferences/calendar`,
|
|
83
|
-
{
|
|
84
|
-
method: "DELETE",
|
|
85
|
-
headers: {
|
|
86
|
-
Authorization: `Bearer ${a.accessToken}`
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
);
|
|
90
|
-
if (!c.ok) {
|
|
91
|
-
const m = await c.json().catch(() => ({}));
|
|
92
|
-
throw new Error(m.error || "Failed to clear preferences");
|
|
93
|
-
}
|
|
94
|
-
const i = await c.text();
|
|
95
|
-
if (i)
|
|
96
|
-
try {
|
|
97
|
-
const m = JSON.parse(i);
|
|
98
|
-
return n({
|
|
99
|
-
tz: m.tz,
|
|
100
|
-
weekStart: m.weekStart,
|
|
101
|
-
source: m.source,
|
|
102
|
-
isInherited: m.isInherited ?? !0,
|
|
103
|
-
userHasPrefs: !1,
|
|
104
|
-
inherited: m.inherited
|
|
105
|
-
}), !0;
|
|
106
|
-
} catch {
|
|
107
|
-
}
|
|
108
|
-
return await d(), !0;
|
|
109
|
-
} catch (c) {
|
|
110
|
-
const i = c instanceof Error ? c.message : "Unknown error";
|
|
111
|
-
return o(i), !1;
|
|
112
|
-
} finally {
|
|
113
|
-
y(!1);
|
|
114
|
-
}
|
|
115
|
-
}, [a, r, d]);
|
|
116
|
-
return {
|
|
117
|
-
preferences: w,
|
|
118
|
-
isLoading: l,
|
|
119
|
-
isSaving: p,
|
|
120
|
-
isClearing: x,
|
|
121
|
-
error: v,
|
|
122
|
-
updatePreferences: f,
|
|
123
|
-
clearPreferences: T,
|
|
124
|
-
refetch: d
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
const M = [
|
|
128
|
-
{ value: "America/New_York", label: "Eastern Time (US & Canada)" },
|
|
129
|
-
{ value: "America/Chicago", label: "Central Time (US & Canada)" },
|
|
130
|
-
{ value: "America/Denver", label: "Mountain Time (US & Canada)" },
|
|
131
|
-
{ value: "America/Los_Angeles", label: "Pacific Time (US & Canada)" },
|
|
132
|
-
{ value: "America/Phoenix", label: "Arizona" },
|
|
133
|
-
{ value: "America/Anchorage", label: "Alaska" },
|
|
134
|
-
{ value: "Pacific/Honolulu", label: "Hawaii" },
|
|
135
|
-
{ value: "Europe/London", label: "London" },
|
|
136
|
-
{ value: "Europe/Paris", label: "Paris, Berlin, Rome" },
|
|
137
|
-
{ value: "Asia/Tokyo", label: "Tokyo" },
|
|
138
|
-
{ value: "Asia/Shanghai", label: "Beijing, Shanghai" },
|
|
139
|
-
{ value: "Asia/Kolkata", label: "Mumbai, New Delhi" },
|
|
140
|
-
{ value: "Australia/Sydney", label: "Sydney" },
|
|
141
|
-
{ value: "UTC", label: "UTC" }
|
|
142
|
-
], Q = [
|
|
143
|
-
{ value: 0, label: "Sunday" },
|
|
144
|
-
{ value: 1, label: "Monday" },
|
|
145
|
-
{ value: 6, label: "Saturday" }
|
|
146
|
-
];
|
|
147
|
-
function Ae() {
|
|
148
|
-
try {
|
|
149
|
-
const a = Intl;
|
|
150
|
-
if (a.supportedValuesOf)
|
|
151
|
-
return a.supportedValuesOf("timeZone");
|
|
152
|
-
} catch {
|
|
153
|
-
}
|
|
154
|
-
return M.map((a) => a.value);
|
|
155
|
-
}
|
|
156
|
-
function Pe(a) {
|
|
157
|
-
switch (a) {
|
|
158
|
-
case "tenant":
|
|
159
|
-
return "tenant";
|
|
160
|
-
case "organization":
|
|
161
|
-
return "organization";
|
|
162
|
-
case "system":
|
|
163
|
-
return "system";
|
|
164
|
-
default:
|
|
165
|
-
return "default";
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
function V(a) {
|
|
169
|
-
const r = M.find((l) => l.value === a);
|
|
170
|
-
return r ? r.label : a;
|
|
171
|
-
}
|
|
172
|
-
function ze(a) {
|
|
173
|
-
const r = Q.find((l) => l.value === a);
|
|
174
|
-
return r ? r.label : String(a);
|
|
175
|
-
}
|
|
176
|
-
function Fe({
|
|
177
|
-
open: a,
|
|
178
|
-
onOpenChange: r
|
|
179
|
-
}) {
|
|
180
|
-
var _, H, j;
|
|
181
|
-
const {
|
|
182
|
-
preferences: l,
|
|
183
|
-
isLoading: S,
|
|
184
|
-
isSaving: p,
|
|
185
|
-
isClearing: g,
|
|
186
|
-
updatePreferences: x,
|
|
187
|
-
clearPreferences: y
|
|
188
|
-
} = Ee(), v = l.tz || ((_ = l.inherited) == null ? void 0 : _.tz) || Intl.DateTimeFormat().resolvedOptions().timeZone, o = l.weekStart ?? ((H = l.inherited) == null ? void 0 : H.weekStart) ?? 1, [u, n] = h(!l.userHasPrefs), [w, d] = h(!1), [f, T] = h(
|
|
189
|
-
v
|
|
190
|
-
), [k, I] = h(
|
|
191
|
-
o
|
|
192
|
-
), [E, N] = h(!1), c = z(() => Ae(), []), i = z(
|
|
193
|
-
() => c.filter(
|
|
194
|
-
(t) => !M.some((ce) => ce.value === t)
|
|
195
|
-
),
|
|
196
|
-
[c]
|
|
197
|
-
), m = z(() => V(f), [f]), re = l.inherited ? V(l.inherited.tz) : "UTC", se = l.inherited ? ze(l.inherited.weekStart) : "Monday", te = Pe(
|
|
198
|
-
(j = l.inherited) == null ? void 0 : j.source
|
|
199
|
-
);
|
|
200
|
-
de.useEffect(() => {
|
|
201
|
-
if (!a) {
|
|
202
|
-
d(!1);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
w || (l.userHasPrefs !== void 0 && n(!l.userHasPrefs), T(v), I(o));
|
|
206
|
-
}, [
|
|
207
|
-
a,
|
|
208
|
-
w,
|
|
209
|
-
l.userHasPrefs,
|
|
210
|
-
v,
|
|
211
|
-
o
|
|
212
|
-
]);
|
|
213
|
-
const ne = async () => {
|
|
214
|
-
if (S) {
|
|
215
|
-
A.error("Preferences are still loading. Please try again.");
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
u ? await y() ? (A.success(
|
|
219
|
-
"Now using default settings. Please refresh the page to apply changes.",
|
|
220
|
-
{ duration: 5e3 }
|
|
221
|
-
), r(!1)) : A.error("Failed to save preferences. Please try again.") : await x({
|
|
222
|
-
tz: f,
|
|
223
|
-
weekStart: k
|
|
224
|
-
}) ? (A.success(
|
|
225
|
-
"Preferences saved. Please refresh the page to apply changes.",
|
|
226
|
-
{ duration: 5e3 }
|
|
227
|
-
), r(!1)) : A.error("Failed to save preferences. Please try again.");
|
|
228
|
-
}, le = () => {
|
|
229
|
-
r(!1);
|
|
230
|
-
}, U = p || g, ie = U || S;
|
|
231
|
-
return /* @__PURE__ */ e(X, { open: a, onOpenChange: r, children: /* @__PURE__ */ s(Z, { className: "sm:max-w-[425px]", children: [
|
|
232
|
-
/* @__PURE__ */ s(J, { children: [
|
|
233
|
-
/* @__PURE__ */ e(K, { children: "Calendar Preferences" }),
|
|
234
|
-
/* @__PURE__ */ e(q, { children: "Set your timezone and week start preferences for date calculations and displays." })
|
|
235
|
-
] }),
|
|
236
|
-
/* @__PURE__ */ s("div", { className: "space-y-6 py-4", children: [
|
|
237
|
-
/* @__PURE__ */ s(
|
|
238
|
-
$,
|
|
239
|
-
{
|
|
240
|
-
value: u ? "defaults" : "custom",
|
|
241
|
-
onValueChange: (t) => {
|
|
242
|
-
d(!0), n(t === "defaults");
|
|
243
|
-
},
|
|
244
|
-
className: "space-y-3",
|
|
245
|
-
children: [
|
|
246
|
-
/* @__PURE__ */ s(
|
|
247
|
-
"div",
|
|
248
|
-
{
|
|
249
|
-
className: C(
|
|
250
|
-
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
251
|
-
u ? "border-primary bg-primary/5" : "border-border hover:border-muted-foreground/50"
|
|
252
|
-
),
|
|
253
|
-
onClick: () => {
|
|
254
|
-
d(!0), n(!0);
|
|
255
|
-
},
|
|
256
|
-
children: [
|
|
257
|
-
/* @__PURE__ */ e(F, { value: "defaults", id: "mode-defaults" }),
|
|
258
|
-
/* @__PURE__ */ s("div", { className: "flex-1 space-y-1", children: [
|
|
259
|
-
/* @__PURE__ */ s(
|
|
260
|
-
b,
|
|
261
|
-
{
|
|
262
|
-
htmlFor: "mode-defaults",
|
|
263
|
-
className: "cursor-pointer font-medium",
|
|
264
|
-
children: [
|
|
265
|
-
"Use ",
|
|
266
|
-
te,
|
|
267
|
-
" defaults"
|
|
268
|
-
]
|
|
269
|
-
}
|
|
270
|
-
),
|
|
271
|
-
/* @__PURE__ */ s("p", { className: "text-sm text-muted-foreground", children: [
|
|
272
|
-
re,
|
|
273
|
-
", Week starts ",
|
|
274
|
-
se
|
|
275
|
-
] })
|
|
276
|
-
] })
|
|
277
|
-
]
|
|
278
|
-
}
|
|
279
|
-
),
|
|
280
|
-
/* @__PURE__ */ s(
|
|
281
|
-
"div",
|
|
282
|
-
{
|
|
283
|
-
className: C(
|
|
284
|
-
"flex items-start space-x-3 rounded-lg border p-4 cursor-pointer transition-colors",
|
|
285
|
-
u ? "border-border hover:border-muted-foreground/50" : "border-primary bg-primary/5"
|
|
286
|
-
),
|
|
287
|
-
onClick: () => {
|
|
288
|
-
d(!0), n(!1);
|
|
289
|
-
},
|
|
290
|
-
children: [
|
|
291
|
-
/* @__PURE__ */ e(F, { value: "custom", id: "mode-custom" }),
|
|
292
|
-
/* @__PURE__ */ e(
|
|
293
|
-
b,
|
|
294
|
-
{
|
|
295
|
-
htmlFor: "mode-custom",
|
|
296
|
-
className: "cursor-pointer font-medium",
|
|
297
|
-
children: "Use custom settings"
|
|
298
|
-
}
|
|
299
|
-
)
|
|
300
|
-
]
|
|
301
|
-
}
|
|
302
|
-
)
|
|
303
|
-
]
|
|
304
|
-
}
|
|
305
|
-
),
|
|
306
|
-
/* @__PURE__ */ s(
|
|
307
|
-
"div",
|
|
308
|
-
{
|
|
309
|
-
className: C(
|
|
310
|
-
"space-y-6 transition-opacity",
|
|
311
|
-
u && "opacity-50 pointer-events-none"
|
|
312
|
-
),
|
|
313
|
-
children: [
|
|
314
|
-
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
315
|
-
/* @__PURE__ */ e(b, { children: "Timezone" }),
|
|
316
|
-
/* @__PURE__ */ s(
|
|
317
|
-
me,
|
|
318
|
-
{
|
|
319
|
-
open: E,
|
|
320
|
-
onOpenChange: N,
|
|
321
|
-
modal: !0,
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ e(he, { asChild: !0, children: /* @__PURE__ */ s(
|
|
324
|
-
P,
|
|
325
|
-
{
|
|
326
|
-
variant: "outline",
|
|
327
|
-
role: "combobox",
|
|
328
|
-
"aria-expanded": E,
|
|
329
|
-
className: "w-full justify-between",
|
|
330
|
-
disabled: u,
|
|
331
|
-
children: [
|
|
332
|
-
m,
|
|
333
|
-
/* @__PURE__ */ e(fe, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
|
|
334
|
-
]
|
|
335
|
-
}
|
|
336
|
-
) }),
|
|
337
|
-
/* @__PURE__ */ e(
|
|
338
|
-
pe,
|
|
339
|
-
{
|
|
340
|
-
className: "z-50 w-[--radix-popover-trigger-width] p-0",
|
|
341
|
-
align: "start",
|
|
342
|
-
children: /* @__PURE__ */ s(ve, { className: "overflow-visible", children: [
|
|
343
|
-
/* @__PURE__ */ e(be, { placeholder: "Search timezones..." }),
|
|
344
|
-
/* @__PURE__ */ s(Se, { children: [
|
|
345
|
-
/* @__PURE__ */ e(ge, { children: "No timezone found." }),
|
|
346
|
-
/* @__PURE__ */ e(B, { heading: "Common", children: M.map((t) => /* @__PURE__ */ s(
|
|
347
|
-
O,
|
|
348
|
-
{
|
|
349
|
-
value: `${t.value} ${t.label}`,
|
|
350
|
-
onSelect: () => {
|
|
351
|
-
d(!0), T(t.value), N(!1);
|
|
352
|
-
},
|
|
353
|
-
children: [
|
|
354
|
-
/* @__PURE__ */ e(
|
|
355
|
-
W,
|
|
356
|
-
{
|
|
357
|
-
className: C(
|
|
358
|
-
"mr-2 h-4 w-4",
|
|
359
|
-
f === t.value ? "opacity-100" : "opacity-0"
|
|
360
|
-
)
|
|
361
|
-
}
|
|
362
|
-
),
|
|
363
|
-
/* @__PURE__ */ e("span", { className: "flex-1", children: t.label }),
|
|
364
|
-
/* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: t.value })
|
|
365
|
-
]
|
|
366
|
-
},
|
|
367
|
-
t.value
|
|
368
|
-
)) }),
|
|
369
|
-
/* @__PURE__ */ e(ye, {}),
|
|
370
|
-
/* @__PURE__ */ e(B, { heading: "All Timezones", children: i.map((t) => /* @__PURE__ */ s(
|
|
371
|
-
O,
|
|
372
|
-
{
|
|
373
|
-
value: t,
|
|
374
|
-
onSelect: () => {
|
|
375
|
-
d(!0), T(t), N(!1);
|
|
376
|
-
},
|
|
377
|
-
children: [
|
|
378
|
-
/* @__PURE__ */ e(
|
|
379
|
-
W,
|
|
380
|
-
{
|
|
381
|
-
className: C(
|
|
382
|
-
"mr-2 h-4 w-4",
|
|
383
|
-
f === t ? "opacity-100" : "opacity-0"
|
|
384
|
-
)
|
|
385
|
-
}
|
|
386
|
-
),
|
|
387
|
-
t
|
|
388
|
-
]
|
|
389
|
-
},
|
|
390
|
-
t
|
|
391
|
-
)) })
|
|
392
|
-
] })
|
|
393
|
-
] })
|
|
394
|
-
}
|
|
395
|
-
)
|
|
396
|
-
]
|
|
397
|
-
}
|
|
398
|
-
)
|
|
399
|
-
] }),
|
|
400
|
-
/* @__PURE__ */ s("div", { className: "space-y-3", children: [
|
|
401
|
-
/* @__PURE__ */ e(b, { children: "Week Starts On" }),
|
|
402
|
-
/* @__PURE__ */ e(
|
|
403
|
-
$,
|
|
404
|
-
{
|
|
405
|
-
value: String(k),
|
|
406
|
-
onValueChange: (t) => {
|
|
407
|
-
d(!0), I(Number(t));
|
|
408
|
-
},
|
|
409
|
-
className: "flex gap-4",
|
|
410
|
-
disabled: u,
|
|
411
|
-
children: Q.map((t) => /* @__PURE__ */ s(
|
|
412
|
-
"div",
|
|
413
|
-
{
|
|
414
|
-
className: "flex items-center space-x-2",
|
|
415
|
-
children: [
|
|
416
|
-
/* @__PURE__ */ e(
|
|
417
|
-
F,
|
|
418
|
-
{
|
|
419
|
-
value: String(t.value),
|
|
420
|
-
id: `week-start-${t.value}`,
|
|
421
|
-
disabled: u
|
|
422
|
-
}
|
|
423
|
-
),
|
|
424
|
-
/* @__PURE__ */ e(
|
|
425
|
-
b,
|
|
426
|
-
{
|
|
427
|
-
htmlFor: `week-start-${t.value}`,
|
|
428
|
-
className: C(
|
|
429
|
-
"cursor-pointer font-normal",
|
|
430
|
-
u && "cursor-not-allowed"
|
|
431
|
-
),
|
|
432
|
-
children: t.label
|
|
433
|
-
}
|
|
434
|
-
)
|
|
435
|
-
]
|
|
436
|
-
},
|
|
437
|
-
t.value
|
|
438
|
-
))
|
|
439
|
-
}
|
|
440
|
-
)
|
|
441
|
-
] })
|
|
442
|
-
]
|
|
443
|
-
}
|
|
444
|
-
)
|
|
445
|
-
] }),
|
|
446
|
-
/* @__PURE__ */ s(Y, { children: [
|
|
447
|
-
/* @__PURE__ */ e(P, { variant: "outline", onClick: le, disabled: U, children: "Cancel" }),
|
|
448
|
-
/* @__PURE__ */ e(P, { onClick: ne, disabled: ie, children: U ? /* @__PURE__ */ s(oe, { children: [
|
|
449
|
-
/* @__PURE__ */ e(we, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
450
|
-
"Saving..."
|
|
451
|
-
] }) : "Save" })
|
|
452
|
-
] })
|
|
453
|
-
] }) });
|
|
454
|
-
}
|
|
455
|
-
const D = 6, ee = 1, ae = 20;
|
|
456
|
-
function De(a) {
|
|
457
|
-
return Number.isNaN(a) ? D : Math.min(ae, Math.max(ee, a));
|
|
458
|
-
}
|
|
459
|
-
function _e({
|
|
460
|
-
open: a,
|
|
461
|
-
onOpenChange: r,
|
|
462
|
-
dashboard: l,
|
|
463
|
-
onApply: S,
|
|
464
|
-
disabled: p = !1
|
|
465
|
-
}) {
|
|
466
|
-
const [g, x] = h(!1), [y, v] = h("top"), [o, u] = h(String(D)), n = l.summary;
|
|
467
|
-
G(() => {
|
|
468
|
-
a && (x((n == null ? void 0 : n.enabled) === !0), v((n == null ? void 0 : n.position) === "bottom" ? "bottom" : "top"), u(String((n == null ? void 0 : n.maxItems) ?? D)));
|
|
469
|
-
}, [a, n == null ? void 0 : n.enabled, n == null ? void 0 : n.position, n == null ? void 0 : n.maxItems]);
|
|
470
|
-
const w = z(
|
|
471
|
-
() => De(Number.parseInt(o || `${D}`, 10)),
|
|
472
|
-
[o]
|
|
473
|
-
);
|
|
474
|
-
return /* @__PURE__ */ e(X, { open: a, onOpenChange: r, children: /* @__PURE__ */ s(Z, { className: "sm:max-w-[420px]", children: [
|
|
475
|
-
/* @__PURE__ */ s(J, { children: [
|
|
476
|
-
/* @__PURE__ */ e(K, { children: "Summary Settings" }),
|
|
477
|
-
/* @__PURE__ */ e(q, { children: "Configure dashboard-level summary display. Card-level summary settings still control which cards contribute." })
|
|
478
|
-
] }),
|
|
479
|
-
/* @__PURE__ */ s("div", { className: "space-y-4 py-2", children: [
|
|
480
|
-
/* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
|
|
481
|
-
/* @__PURE__ */ e(b, { htmlFor: "dashboard-summary-enabled", children: "Enable Dashboard Summary" }),
|
|
482
|
-
/* @__PURE__ */ e(
|
|
483
|
-
xe,
|
|
484
|
-
{
|
|
485
|
-
id: "dashboard-summary-enabled",
|
|
486
|
-
checked: g,
|
|
487
|
-
disabled: p,
|
|
488
|
-
onCheckedChange: x
|
|
489
|
-
}
|
|
490
|
-
)
|
|
491
|
-
] }),
|
|
492
|
-
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
493
|
-
/* @__PURE__ */ e(b, { htmlFor: "dashboard-summary-position", children: "Position" }),
|
|
494
|
-
/* @__PURE__ */ s(
|
|
495
|
-
Ne,
|
|
496
|
-
{
|
|
497
|
-
value: y,
|
|
498
|
-
disabled: p,
|
|
499
|
-
onValueChange: (f) => v(f),
|
|
500
|
-
children: [
|
|
501
|
-
/* @__PURE__ */ e(Ce, { id: "dashboard-summary-position", children: /* @__PURE__ */ e(Te, { placeholder: "Select position" }) }),
|
|
502
|
-
/* @__PURE__ */ s(ke, { children: [
|
|
503
|
-
/* @__PURE__ */ e(R, { value: "top", children: "Top" }),
|
|
504
|
-
/* @__PURE__ */ e(R, { value: "bottom", children: "Bottom" })
|
|
505
|
-
] })
|
|
506
|
-
]
|
|
507
|
-
}
|
|
508
|
-
)
|
|
509
|
-
] }),
|
|
510
|
-
/* @__PURE__ */ s("div", { className: "space-y-2", children: [
|
|
511
|
-
/* @__PURE__ */ e(b, { htmlFor: "dashboard-summary-max-items", children: "Max Items" }),
|
|
512
|
-
/* @__PURE__ */ e(
|
|
513
|
-
Ie,
|
|
514
|
-
{
|
|
515
|
-
id: "dashboard-summary-max-items",
|
|
516
|
-
type: "number",
|
|
517
|
-
min: ee,
|
|
518
|
-
max: ae,
|
|
519
|
-
disabled: p,
|
|
520
|
-
value: o,
|
|
521
|
-
onChange: (f) => u(f.target.value),
|
|
522
|
-
onBlur: () => u(String(w))
|
|
523
|
-
}
|
|
524
|
-
),
|
|
525
|
-
/* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: "Display limit only. Computation is unchanged." })
|
|
526
|
-
] }),
|
|
527
|
-
p && /* @__PURE__ */ e("p", { className: "text-xs text-amber-700", children: "Enter dashboard edit mode to modify summary settings." })
|
|
528
|
-
] }),
|
|
529
|
-
/* @__PURE__ */ s(Y, { children: [
|
|
530
|
-
/* @__PURE__ */ e(P, { variant: "outline", onClick: () => r(!1), children: "Cancel" }),
|
|
531
|
-
/* @__PURE__ */ e(P, { onClick: () => {
|
|
532
|
-
S({
|
|
533
|
-
enabled: g,
|
|
534
|
-
position: y,
|
|
535
|
-
maxItems: w
|
|
536
|
-
}), r(!1);
|
|
537
|
-
}, disabled: p, children: "Apply" })
|
|
538
|
-
] })
|
|
539
|
-
] }) });
|
|
540
|
-
}
|
|
541
|
-
export {
|
|
542
|
-
Fe as C,
|
|
543
|
-
_e as D
|
|
544
|
-
};
|