@burdenoff/microfe-calendar 2026.525.3 → 2026.610.1
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/CalendarRoutes.js +1 -1
- package/dist/CalendarRoutes.js.map +1 -1
- package/dist/components/AgendaView.js +52 -42
- package/dist/components/AgendaView.js.map +1 -1
- package/dist/components/CalendarErrorState.js +40 -0
- package/dist/components/CalendarErrorState.js.map +1 -0
- package/dist/components/ConfirmDialog.js +3 -0
- package/dist/components/ConfirmDialog.js.map +1 -1
- package/dist/components/DayView.js +43 -32
- package/dist/components/DayView.js.map +1 -1
- package/dist/components/EventBlock.js +14 -26
- package/dist/components/EventBlock.js.map +1 -1
- package/dist/components/EventFormModal.js +464 -443
- package/dist/components/EventFormModal.js.map +1 -1
- package/dist/components/MiniCalendar.js +3 -0
- package/dist/components/MiniCalendar.js.map +1 -1
- package/dist/components/MonthView.js +37 -26
- package/dist/components/MonthView.js.map +1 -1
- package/dist/components/TimelineView.js +51 -35
- package/dist/components/TimelineView.js.map +1 -1
- package/dist/components/ViewSwitcher.js +1 -0
- package/dist/components/ViewSwitcher.js.map +1 -1
- package/dist/components/WeekView.js +54 -35
- package/dist/components/WeekView.js.map +1 -1
- package/dist/components/YearView.js +73 -51
- package/dist/components/YearView.js.map +1 -1
- package/dist/hooks/useEvents.js +23 -17
- package/dist/hooks/useEvents.js.map +1 -1
- package/dist/hooks/useOpenEvent.js +24 -0
- package/dist/hooks/useOpenEvent.js.map +1 -0
- package/dist/hooks/useSafePermissions.js +1 -9
- package/dist/hooks/useSafePermissions.js.map +1 -1
- package/dist/pages/CalendarPage.js +31 -14
- package/dist/pages/CalendarPage.js.map +1 -1
- package/dist/pages/EventDetailsPage.js +12 -3
- package/dist/pages/EventDetailsPage.js.map +1 -1
- package/dist/pages/ResourcesPage.js +192 -182
- package/dist/pages/ResourcesPage.js.map +1 -1
- package/dist/pages/SettingsPage.js +26 -10
- package/dist/pages/SettingsPage.js.map +1 -1
- package/dist/pages/SubscriptionsPage.js +2 -0
- package/dist/pages/SubscriptionsPage.js.map +1 -1
- package/dist/providers/CalendarProvider.js +1 -1
- package/dist/providers/CalendarProvider.js.map +1 -1
- package/dist/store/calendarStore.js +11 -4
- package/dist/store/calendarStore.js.map +1 -1
- package/dist/utils/dateHelpers.js +2 -5
- package/dist/utils/dateHelpers.js.map +1 -1
- package/package.json +3 -4
package/dist/CalendarRoutes.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CalendarRoutes.js","names":[],"sources":["../src/CalendarRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router-dom';\nimport { CalendarPage } from './pages/CalendarPage';\n\n// Lazy-loaded pages for code splitting\nconst EventDetailsPage = lazy(() =>\n import('./pages/EventDetailsPage').then((m) => ({ default: m.EventDetailsPage }))\n);\nconst ResourcesPage = lazy(() =>\n import('./pages/ResourcesPage').then((m) => ({ default: m.ResourcesPage }))\n);\nconst SettingsPage = lazy(() =>\n import('./pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))\n);\nconst SubscriptionsPage = lazy(() =>\n import('./pages/SubscriptionsPage').then((m) => ({ default: m.SubscriptionsPage }))\n);\n\n/**\n * Fallback component for lazy-loaded pages\n */\nfunction PageLoadingFallback() {\n return (\n <div className=\"min-h-screen bg-bg-canvas flex items-center justify-center\">\n <div className=\"text-text-secondary font-text-md\">Loading
|
|
1
|
+
{"version":3,"file":"CalendarRoutes.js","names":[],"sources":["../src/CalendarRoutes.tsx"],"sourcesContent":["import { lazy, Suspense } from 'react';\nimport { Navigate, Route, Routes } from 'react-router-dom';\nimport { CalendarPage } from './pages/CalendarPage';\n\n// Lazy-loaded pages for code splitting\nconst EventDetailsPage = lazy(() =>\n import('./pages/EventDetailsPage').then((m) => ({ default: m.EventDetailsPage }))\n);\nconst ResourcesPage = lazy(() =>\n import('./pages/ResourcesPage').then((m) => ({ default: m.ResourcesPage }))\n);\nconst SettingsPage = lazy(() =>\n import('./pages/SettingsPage').then((m) => ({ default: m.SettingsPage }))\n);\nconst SubscriptionsPage = lazy(() =>\n import('./pages/SubscriptionsPage').then((m) => ({ default: m.SubscriptionsPage }))\n);\n\n/**\n * Fallback component for lazy-loaded pages\n */\nfunction PageLoadingFallback() {\n return (\n <div className=\"min-h-screen bg-bg-canvas flex items-center justify-center\">\n <div className=\"text-text-secondary font-text-md\">Loading…</div>\n </div>\n );\n}\n\n/**\n * Internal routing for the Calendar microfrontend.\n *\n * All routes are relative to the basePath provided by the host.\n * Example: If basePath=\"/calendar\", then:\n * - /calendar → redirects to /calendar/view/week\n * - /calendar/view/week → CalendarPage (week view)\n * - /calendar/event/:eventId → EventDetailsPage\n * - /calendar/resources → ResourcesPage\n * - /calendar/settings → SettingsPage\n * - /calendar/subscriptions → SubscriptionsPage\n *\n * Lazy Loading Strategy:\n * - CalendarPage: Eager (main entry point, most frequently accessed)\n * - EventDetailsPage: Lazy (accessed on-demand)\n * - ResourcesPage: Lazy (secondary feature)\n * - SettingsPage: Lazy (infrequently accessed)\n * - SubscriptionsPage: Lazy (infrequently accessed)\n */\nexport function CalendarRoutes() {\n return (\n <Routes>\n {/* Default redirect to week view */}\n <Route index element={<Navigate to=\"view/week\" replace />} />\n\n {/* Calendar views - Eager loaded (primary entry point) */}\n <Route path=\"view/:viewType\" element={<CalendarPage />} />\n {/* viewType: day | week | month | year | agenda | timeline */}\n\n {/* Event details - Lazy loaded */}\n <Route\n path=\"event/:eventId\"\n element={\n <Suspense fallback={<PageLoadingFallback />}>\n <EventDetailsPage />\n </Suspense>\n }\n />\n\n {/* Resources - Lazy loaded */}\n <Route\n path=\"resources\"\n element={\n <Suspense fallback={<PageLoadingFallback />}>\n <ResourcesPage />\n </Suspense>\n }\n />\n\n {/* Settings - Lazy loaded */}\n <Route\n path=\"settings\"\n element={\n <Suspense fallback={<PageLoadingFallback />}>\n <SettingsPage />\n </Suspense>\n }\n />\n\n {/* Subscriptions - Lazy loaded */}\n <Route\n path=\"subscriptions\"\n element={\n <Suspense fallback={<PageLoadingFallback />}>\n <SubscriptionsPage />\n </Suspense>\n }\n />\n\n {/* Catch-all: redirect to default view */}\n <Route path=\"*\" element={<Navigate to=\"view/week\" replace />} />\n </Routes>\n );\n}\n"],"mappings":";;;;;AAKA,IAAM,IAAmB,QACvB,OAAO,+BAA4B,MAAM,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAClF,EACK,IAAgB,QACpB,OAAO,4BAAyB,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CAC5E,EACK,IAAe,QACnB,OAAO,2BAAwB,MAAM,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAC1E,EACK,IAAoB,QACxB,OAAO,gCAA6B,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CACpF;AAKD,SAAS,IAAsB;AAC7B,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;GAAK,WAAU;aAAmC;GAAc,CAAA;EAC5D,CAAA;;AAuBV,SAAgB,IAAiB;AAC/B,QACE,kBAAC,GAAD,EAAA,UAAA;EAEE,kBAAC,GAAD;GAAO,OAAA;GAAM,SAAS,kBAAC,GAAD;IAAU,IAAG;IAAY,SAAA;IAAU,CAAA;GAAI,CAAA;EAG7D,kBAAC,GAAD;GAAO,MAAK;GAAiB,SAAS,kBAAC,GAAD,EAAgB,CAAA;GAAI,CAAA;EAI1D,kBAAC,GAAD;GACE,MAAK;GACL,SACE,kBAAC,GAAD;IAAU,UAAU,kBAAC,GAAD,EAAuB,CAAA;cACzC,kBAAC,GAAD,EAAoB,CAAA;IACX,CAAA;GAEb,CAAA;EAGF,kBAAC,GAAD;GACE,MAAK;GACL,SACE,kBAAC,GAAD;IAAU,UAAU,kBAAC,GAAD,EAAuB,CAAA;cACzC,kBAAC,GAAD,EAAiB,CAAA;IACR,CAAA;GAEb,CAAA;EAGF,kBAAC,GAAD;GACE,MAAK;GACL,SACE,kBAAC,GAAD;IAAU,UAAU,kBAAC,GAAD,EAAuB,CAAA;cACzC,kBAAC,GAAD,EAAgB,CAAA;IACP,CAAA;GAEb,CAAA;EAGF,kBAAC,GAAD;GACE,MAAK;GACL,SACE,kBAAC,GAAD;IAAU,UAAU,kBAAC,GAAD,EAAuB,CAAA;cACzC,kBAAC,GAAD,EAAqB,CAAA;IACZ,CAAA;GAEb,CAAA;EAGF,kBAAC,GAAD;GAAO,MAAK;GAAI,SAAS,kBAAC,GAAD;IAAU,IAAG;IAAY,SAAA;IAAU,CAAA;GAAI,CAAA;EACzD,EAAA,CAAA"}
|
|
@@ -2,85 +2,95 @@ import { useCalendarStore as e } from "../store/calendarStore.js";
|
|
|
2
2
|
import { addDays as t, formatTime as n, isSameDay as r, startOfDay as i } from "../utils/dateHelpers.js";
|
|
3
3
|
import { useEvents as a } from "../hooks/useEvents.js";
|
|
4
4
|
import { EventBlock as o } from "./EventBlock.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CalendarErrorState as s } from "./CalendarErrorState.js";
|
|
6
|
+
import { useEffect as c, useState as l } from "react";
|
|
7
|
+
import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
8
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
7
9
|
//#region src/components/AgendaView.tsx
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
let n =
|
|
10
|
+
function p() {
|
|
11
|
+
let p = e((e) => e.currentDate), { t: m } = u(), h = (e, t) => {
|
|
12
|
+
let n = m(e);
|
|
11
13
|
return n === e ? t : n;
|
|
12
|
-
},
|
|
13
|
-
startDate:
|
|
14
|
-
endDate: t(
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, g = i(p), { events: _, isLoading: v, error: y, refetch: b } = a({
|
|
15
|
+
startDate: g,
|
|
16
|
+
endDate: t(g, 30)
|
|
17
|
+
}), [x, S] = l(null);
|
|
18
|
+
c(() => {
|
|
19
|
+
Promise.resolve().then(() => S(/* @__PURE__ */ new Date()));
|
|
20
|
+
}, []);
|
|
21
|
+
let C = /* @__PURE__ */ new Map();
|
|
22
|
+
_.sort((e, t) => e.startTime.getTime() - t.startTime.getTime()).forEach((e) => {
|
|
23
|
+
let t = e.startTime.toISOString().split("T")[0], n = C.get(t) ?? [];
|
|
24
|
+
n.push(e), C.set(t, n);
|
|
19
25
|
});
|
|
20
|
-
let
|
|
21
|
-
return /* @__PURE__ */
|
|
26
|
+
let w = Array.from(C.entries());
|
|
27
|
+
return /* @__PURE__ */ d("div", {
|
|
22
28
|
className: "@container",
|
|
23
|
-
children: /* @__PURE__ */
|
|
29
|
+
children: /* @__PURE__ */ f("div", {
|
|
24
30
|
className: "max-w-3xl mx-auto",
|
|
25
31
|
children: [
|
|
26
|
-
|
|
32
|
+
y && /* @__PURE__ */ d(s, {
|
|
33
|
+
message: y,
|
|
34
|
+
onRetry: () => void b()
|
|
35
|
+
}),
|
|
36
|
+
v && /* @__PURE__ */ d("div", {
|
|
27
37
|
className: "text-center py-2 text-text-tertiary font-text-xs mb-2",
|
|
28
|
-
children:
|
|
38
|
+
children: h("calendar.loadingEvents", "Loading events...")
|
|
29
39
|
}),
|
|
30
|
-
|
|
40
|
+
w.length === 0 && !v && /* @__PURE__ */ d("div", {
|
|
31
41
|
className: "bg-bg-surface border border-border-default rounded-radius-lg p-card-padding",
|
|
32
|
-
children: /* @__PURE__ */
|
|
42
|
+
children: /* @__PURE__ */ d("p", {
|
|
33
43
|
className: "font-text-md text-text-secondary text-center py-12",
|
|
34
|
-
children:
|
|
44
|
+
children: h("calendar.noUpcomingEvents", "No upcoming events in the next 30 days")
|
|
35
45
|
})
|
|
36
46
|
}),
|
|
37
|
-
/* @__PURE__ */
|
|
47
|
+
/* @__PURE__ */ d("div", {
|
|
38
48
|
className: "space-y-4",
|
|
39
|
-
children:
|
|
40
|
-
let i = /* @__PURE__ */ new Date(e + "T00:00:00"), a = r(i,
|
|
41
|
-
return /* @__PURE__ */
|
|
49
|
+
children: w.map(([e, t]) => {
|
|
50
|
+
let i = /* @__PURE__ */ new Date(e + "T00:00:00"), a = x !== null && r(i, x);
|
|
51
|
+
return /* @__PURE__ */ f("div", {
|
|
42
52
|
className: "bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
53
|
+
children: [/* @__PURE__ */ d("div", {
|
|
44
54
|
className: `px-4 py-2 border-b border-border-default ${a ? "bg-blue-50 dark:bg-blue-950/20" : "bg-bg-elevated"}`,
|
|
45
|
-
children: /* @__PURE__ */
|
|
55
|
+
children: /* @__PURE__ */ f("h3", {
|
|
46
56
|
className: `font-text-sm font-weight-semibold ${a ? "text-blue-600 dark:text-blue-400" : "text-text-primary"}`,
|
|
47
|
-
children: [a ? `${
|
|
57
|
+
children: [a ? `${h("calendar.today", "Today")} - ` : "", i.toLocaleDateString("en-US", {
|
|
48
58
|
weekday: "long",
|
|
49
59
|
month: "long",
|
|
50
60
|
day: "numeric"
|
|
51
61
|
})]
|
|
52
62
|
})
|
|
53
|
-
}), /* @__PURE__ */
|
|
63
|
+
}), /* @__PURE__ */ d("div", {
|
|
54
64
|
className: "divide-y divide-border-subtle",
|
|
55
|
-
children: t.map((e) => /* @__PURE__ */
|
|
65
|
+
children: t.map((e) => /* @__PURE__ */ d("div", {
|
|
56
66
|
className: "px-4 py-3 hover:bg-bg-elevated transition-colors",
|
|
57
|
-
children: /* @__PURE__ */
|
|
67
|
+
children: /* @__PURE__ */ f("div", {
|
|
58
68
|
className: "flex items-start gap-3",
|
|
59
|
-
children: [/* @__PURE__ */
|
|
69
|
+
children: [/* @__PURE__ */ d("div", {
|
|
60
70
|
className: "w-20 shrink-0",
|
|
61
|
-
children: e.isAllDay ? /* @__PURE__ */
|
|
71
|
+
children: e.isAllDay ? /* @__PURE__ */ d("span", {
|
|
62
72
|
className: "font-text-xs text-text-tertiary",
|
|
63
|
-
children:
|
|
64
|
-
}) : /* @__PURE__ */
|
|
65
|
-
/* @__PURE__ */
|
|
73
|
+
children: h("calendar.allDay", "All day")
|
|
74
|
+
}) : /* @__PURE__ */ f("div", { children: [
|
|
75
|
+
/* @__PURE__ */ d("span", {
|
|
66
76
|
className: "font-text-sm font-weight-medium text-text-primary",
|
|
67
77
|
children: n(e.startTime)
|
|
68
78
|
}),
|
|
69
|
-
/* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
79
|
+
/* @__PURE__ */ d("br", {}),
|
|
80
|
+
/* @__PURE__ */ d("span", {
|
|
71
81
|
className: "font-text-xs text-text-tertiary",
|
|
72
82
|
children: n(e.endTime)
|
|
73
83
|
})
|
|
74
84
|
] })
|
|
75
|
-
}), /* @__PURE__ */
|
|
85
|
+
}), /* @__PURE__ */ f("div", {
|
|
76
86
|
className: "flex-1 min-w-0",
|
|
77
87
|
children: [
|
|
78
|
-
/* @__PURE__ */
|
|
79
|
-
e.location && /* @__PURE__ */
|
|
88
|
+
/* @__PURE__ */ d(o, { event: e }),
|
|
89
|
+
e.location && /* @__PURE__ */ d("p", {
|
|
80
90
|
className: "mt-1 font-text-xs text-text-tertiary truncate",
|
|
81
91
|
children: e.location
|
|
82
92
|
}),
|
|
83
|
-
e.description && /* @__PURE__ */
|
|
93
|
+
e.description && /* @__PURE__ */ d("p", {
|
|
84
94
|
className: "mt-1 font-text-xs text-text-tertiary line-clamp-2",
|
|
85
95
|
children: e.description
|
|
86
96
|
})
|
|
@@ -97,6 +107,6 @@ function u() {
|
|
|
97
107
|
});
|
|
98
108
|
}
|
|
99
109
|
//#endregion
|
|
100
|
-
export {
|
|
110
|
+
export { p as AgendaView };
|
|
101
111
|
|
|
102
112
|
//# sourceMappingURL=AgendaView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgendaView.js","names":[],"sources":["../../src/components/AgendaView.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport { addDays, formatTime, isSameDay, startOfDay } from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport type { CalendarEvent } from '../types';\n\n/**\n * Agenda view component\n * Shows upcoming events in a chronological list format grouped by date\n */\nexport function AgendaView() {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Show 30 days of upcoming events\n const rangeStart = startOfDay(currentDate);\n const rangeEnd = addDays(rangeStart, 30);\n const { events, isLoading } = useEvents({
|
|
1
|
+
{"version":3,"file":"AgendaView.js","names":[],"sources":["../../src/components/AgendaView.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport { addDays, formatTime, isSameDay, startOfDay } from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport { CalendarErrorState } from './CalendarErrorState';\nimport type { CalendarEvent } from '../types';\n\n/**\n * Agenda view component\n * Shows upcoming events in a chronological list format grouped by date\n */\nexport function AgendaView() {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Show 30 days of upcoming events\n const rangeStart = startOfDay(currentDate);\n const rangeEnd = addDays(rangeStart, 30);\n const { events, isLoading, error, refetch } = useEvents({\n startDate: rangeStart,\n endDate: rangeEnd,\n });\n const [now, setNow] = useState<Date | null>(null);\n useEffect(() => {\n void Promise.resolve().then(() => setNow(new Date()));\n }, []);\n\n // Group events by date\n const groupedEvents: Map<string, CalendarEvent[]> = new Map();\n events\n .sort((a, b) => a.startTime.getTime() - b.startTime.getTime())\n .forEach((event) => {\n const dateKey = event.startTime.toISOString().split('T')[0];\n const existing = groupedEvents.get(dateKey) ?? [];\n existing.push(event);\n groupedEvents.set(dateKey, existing);\n });\n\n const dateGroups = Array.from(groupedEvents.entries());\n\n return (\n <div className=\"@container\">\n <div className=\"max-w-3xl mx-auto\">\n {error && <CalendarErrorState message={error} onRetry={() => void refetch()} />}\n\n {/* Loading indicator */}\n {isLoading && (\n <div className=\"text-center py-2 text-text-tertiary font-text-xs mb-2\">\n {tr('calendar.loadingEvents', 'Loading events...')}\n </div>\n )}\n\n {dateGroups.length === 0 && !isLoading && (\n <div className=\"bg-bg-surface border border-border-default rounded-radius-lg p-card-padding\">\n <p className=\"font-text-md text-text-secondary text-center py-12\">\n {tr('calendar.noUpcomingEvents', 'No upcoming events in the next 30 days')}\n </p>\n </div>\n )}\n\n <div className=\"space-y-4\">\n {dateGroups.map(([dateKey, dayEvents]) => {\n const date = new Date(dateKey + 'T00:00:00');\n const today = now !== null && isSameDay(date, now);\n\n return (\n <div\n key={dateKey}\n className=\"bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden\"\n >\n {/* Date header */}\n <div\n className={`px-4 py-2 border-b border-border-default ${today ? 'bg-blue-50 dark:bg-blue-950/20' : 'bg-bg-elevated'}`}\n >\n <h3\n className={`font-text-sm font-weight-semibold ${today ? 'text-blue-600 dark:text-blue-400' : 'text-text-primary'}`}\n >\n {today ? `${tr('calendar.today', 'Today')} - ` : ''}\n {date.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n })}\n </h3>\n </div>\n\n {/* Events list */}\n <div className=\"divide-y divide-border-subtle\">\n {dayEvents.map((event) => (\n <div\n key={event.id}\n className=\"px-4 py-3 hover:bg-bg-elevated transition-colors\"\n >\n <div className=\"flex items-start gap-3\">\n {/* Time */}\n <div className=\"w-20 shrink-0\">\n {event.isAllDay ? (\n <span className=\"font-text-xs text-text-tertiary\">\n {tr('calendar.allDay', 'All day')}\n </span>\n ) : (\n <div>\n <span className=\"font-text-sm font-weight-medium text-text-primary\">\n {formatTime(event.startTime)}\n </span>\n <br />\n <span className=\"font-text-xs text-text-tertiary\">\n {formatTime(event.endTime)}\n </span>\n </div>\n )}\n </div>\n\n {/* Event details */}\n <div className=\"flex-1 min-w-0\">\n <EventBlock event={event} />\n {event.location && (\n <p className=\"mt-1 font-text-xs text-text-tertiary truncate\">\n {event.location}\n </p>\n )}\n {event.description && (\n <p className=\"mt-1 font-text-xs text-text-tertiary line-clamp-2\">\n {event.description}\n </p>\n )}\n </div>\n </div>\n </div>\n ))}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAaA,SAAgB,IAAa;CAC3B,IAAM,IAAc,GAAkB,MAAU,EAAM,YAAY,EAC5D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAQ,EAAE,EAAI;AACpB,SAAO,MAAU,IAAM,IAAW;IAI9B,IAAa,EAAW,EAAY,EAEpC,EAAE,WAAQ,cAAW,UAAO,eAAY,EAAU;EACtD,WAAW;EACX,SAHe,EAAQ,GAAY,GAAG;EAIvC,CAAC,EACI,CAAC,GAAK,KAAU,EAAsB,KAAK;AACjD,SAAgB;AACT,UAAQ,SAAS,CAAC,WAAW,kBAAO,IAAI,MAAM,CAAC,CAAC;IACpD,EAAE,CAAC;CAGN,IAAM,oBAA8C,IAAI,KAAK;AAC7D,GACG,MAAM,GAAG,MAAM,EAAE,UAAU,SAAS,GAAG,EAAE,UAAU,SAAS,CAAC,CAC7D,SAAS,MAAU;EAClB,IAAM,IAAU,EAAM,UAAU,aAAa,CAAC,MAAM,IAAI,CAAC,IACnD,IAAW,EAAc,IAAI,EAAQ,IAAI,EAAE;AAEjD,EADA,EAAS,KAAK,EAAM,EACpB,EAAc,IAAI,GAAS,EAAS;GACpC;CAEJ,IAAM,IAAa,MAAM,KAAK,EAAc,SAAS,CAAC;AAEtD,QACE,kBAAC,OAAD;EAAK,WAAU;YACb,kBAAC,OAAD;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A,EAGN,kBAAC,OAAD;WAAK,WAAU;qBAAf;YACE,kBAAC,GAAD,EAAmB,UAAS,CAAA;YAC3B,EAAM,YACL,kBAAC,KAAD;aAAG,WAAU;uBACV,EAAM;aACL,CAAA;YAEL,EAAM,eACL,kBAAC,KAAD;aAAG,WAAU;uBACV,EAAM;aACL,CAAA;YAEF;aACF;;SACF,EAtCC,EAAM,GAsCP,CACN;QACE,CAAA,CACF;SAhEC,EAgED;OAER;KACE,CAAA;IACF;;EACF,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useI18n as e } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
2
|
+
import { AlertTriangle as t } from "lucide-react";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/CalendarErrorState.tsx
|
|
5
|
+
function i({ message: i, onRetry: a }) {
|
|
6
|
+
let { t: o } = e(), s = (e, t) => {
|
|
7
|
+
let n = o(e);
|
|
8
|
+
return n === e ? t : n;
|
|
9
|
+
};
|
|
10
|
+
return /* @__PURE__ */ n("div", {
|
|
11
|
+
role: "alert",
|
|
12
|
+
className: "mb-3 rounded-radius-lg border border-status-error-border bg-status-error-bg-subtle p-card-padding",
|
|
13
|
+
children: /* @__PURE__ */ r("div", {
|
|
14
|
+
className: "flex items-start gap-3",
|
|
15
|
+
children: [
|
|
16
|
+
/* @__PURE__ */ n(t, { className: "size-5 shrink-0 text-status-error-text" }),
|
|
17
|
+
/* @__PURE__ */ r("div", {
|
|
18
|
+
className: "min-w-0 flex-1",
|
|
19
|
+
children: [/* @__PURE__ */ n("p", {
|
|
20
|
+
className: "font-text-sm font-weight-semibold text-text-primary",
|
|
21
|
+
children: s("calendar.eventsLoadError", "Couldn't load events")
|
|
22
|
+
}), /* @__PURE__ */ n("p", {
|
|
23
|
+
className: "mt-1 break-words font-text-xs text-text-secondary",
|
|
24
|
+
children: i
|
|
25
|
+
})]
|
|
26
|
+
}),
|
|
27
|
+
a && /* @__PURE__ */ n("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
onClick: a,
|
|
30
|
+
className: "shrink-0 inline-flex items-center rounded-radius-md border border-border-default bg-bg-surface px-element-padding py-element-padding-sm font-text-sm font-weight-medium text-text-primary transition-colors hover:bg-bg-elevated",
|
|
31
|
+
children: s("calendar.retry", "Try again")
|
|
32
|
+
})
|
|
33
|
+
]
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { i as CalendarErrorState };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=CalendarErrorState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CalendarErrorState.js","names":[],"sources":["../../src/components/CalendarErrorState.tsx"],"sourcesContent":["/**\n * CalendarErrorState — inline error banner for failed event loads.\n *\n * The grid/list views previously read only { events, isLoading } from\n * useEvents and ignored `error`, so a failed fetch rendered as a silent empty\n * calendar. This banner surfaces the failure with a retry, using semantic\n * status tokens (no raw colours).\n */\n\nimport { AlertTriangle } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface CalendarErrorStateProps {\n message: string;\n onRetry?: () => void;\n}\n\nexport function CalendarErrorState({ message, onRetry }: CalendarErrorStateProps) {\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n return (\n <div\n role=\"alert\"\n className=\"mb-3 rounded-radius-lg border border-status-error-border bg-status-error-bg-subtle p-card-padding\"\n >\n <div className=\"flex items-start gap-3\">\n <AlertTriangle className=\"size-5 shrink-0 text-status-error-text\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"font-text-sm font-weight-semibold text-text-primary\">\n {tr('calendar.eventsLoadError', \"Couldn't load events\")}\n </p>\n <p className=\"mt-1 break-words font-text-xs text-text-secondary\">{message}</p>\n </div>\n {onRetry && (\n <button\n type=\"button\"\n onClick={onRetry}\n className=\"shrink-0 inline-flex items-center rounded-radius-md border border-border-default bg-bg-surface px-element-padding py-element-padding-sm font-text-sm font-weight-medium text-text-primary transition-colors hover:bg-bg-elevated\"\n >\n {tr('calendar.retry', 'Try again')}\n </button>\n )}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;AAiBA,SAAgB,EAAmB,EAAE,YAAS,cAAoC;CAChF,IAAM,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAQ,EAAE,EAAI;AACpB,SAAO,MAAU,IAAM,IAAW;;AAGpC,QACE,kBAAC,OAAD;EACE,MAAK;EACL,WAAU;YAEV,kBAAC,OAAD;GAAK,WAAU;aAAf;IACE,kBAAC,GAAD,EAAe,WAAU,0CAA2C,CAAA;IACpE,kBAAC,OAAD;KAAK,WAAU;eAAf,CACE,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAG,4BAA4B,uBAAuB;MACrD,CAAA,EACJ,kBAAC,KAAD;MAAG,WAAU;gBAAqD;MAAY,CAAA,CAC1E;;IACL,KACC,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,WAAU;eAET,EAAG,kBAAkB,YAAY;KAC3B,CAAA;IAEP;;EACF,CAAA"}
|
|
@@ -50,6 +50,7 @@ var s = ({ open: s, title: c, message: l, confirmLabel: u = "Confirm", cancelLab
|
|
|
50
50
|
})]
|
|
51
51
|
}),
|
|
52
52
|
/* @__PURE__ */ a("button", {
|
|
53
|
+
type: "button",
|
|
53
54
|
onClick: h,
|
|
54
55
|
className: "size-8 inline-flex items-center justify-center rounded-radius-sm hover:bg-bg-elevated text-text-tertiary transition-colors shrink-0",
|
|
55
56
|
"aria-label": v("calendar.close", "Close"),
|
|
@@ -59,11 +60,13 @@ var s = ({ open: s, title: c, message: l, confirmLabel: u = "Confirm", cancelLab
|
|
|
59
60
|
}), /* @__PURE__ */ o("div", {
|
|
60
61
|
className: "mt-6 flex justify-end gap-3",
|
|
61
62
|
children: [/* @__PURE__ */ a("button", {
|
|
63
|
+
type: "button",
|
|
62
64
|
onClick: h,
|
|
63
65
|
disabled: p,
|
|
64
66
|
className: "px-4 py-2 rounded-radius-md border border-border-default bg-bg-surface hover:bg-bg-elevated font-text-sm font-weight-medium text-text-primary transition-colors disabled:opacity-50",
|
|
65
67
|
children: d
|
|
66
68
|
}), /* @__PURE__ */ a("button", {
|
|
69
|
+
type: "button",
|
|
67
70
|
onClick: m,
|
|
68
71
|
disabled: p,
|
|
69
72
|
className: `px-4 py-2 rounded-radius-md font-text-sm font-weight-medium transition-colors disabled:opacity-50 ${y.button}`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.js","names":[],"sources":["../../src/components/ConfirmDialog.tsx"],"sourcesContent":["/**\n * ConfirmDialog - Reusable confirmation dialog for destructive actions\n */\n\nimport { useEffect, useRef, type FC } from 'react';\nimport { AlertTriangle, X } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface ConfirmDialogProps {\n open: boolean;\n title: string;\n message: string;\n confirmLabel?: string;\n cancelLabel?: string;\n variant?: 'danger' | 'warning' | 'info';\n loading?: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport const ConfirmDialog: FC<ConfirmDialogProps> = ({\n open,\n title,\n message,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n variant = 'danger',\n loading = false,\n onConfirm,\n onCancel,\n}) => {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open && !dialog.open) {\n dialog.showModal();\n } else if (!open && dialog.open) {\n dialog.close();\n }\n }, [open]);\n\n if (!open) return null;\n\n const variantStyles = {\n danger: {\n icon: 'text-red-500',\n button: 'bg-red-600 hover:bg-red-700 text-white',\n },\n warning: {\n icon: 'text-amber-500',\n button: 'bg-amber-600 hover:bg-amber-700 text-white',\n },\n info: {\n icon: 'text-blue-500',\n button: 'bg-blue-600 hover:bg-blue-700 text-white',\n },\n };\n\n const styles = variantStyles[variant];\n\n return (\n <dialog\n ref={dialogRef}\n className=\"fixed inset-0 z-50 m-auto rounded-radius-lg border border-border-default bg-bg-surface shadow-lg backdrop:bg-black/50 max-w-md w-full p-0\"\n onClose={onCancel}\n >\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-start gap-4\">\n <div\n className={`size-10 rounded-full bg-bg-neutral flex items-center justify-center shrink-0 ${styles.icon}`}\n >\n <AlertTriangle className=\"size-5\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-heading-sm text-text-primary\">{title}</h3>\n <p className=\"mt-2 font-text-sm text-text-secondary\">{message}</p>\n </div>\n <button\n onClick={onCancel}\n className=\"size-8 inline-flex items-center justify-center rounded-radius-sm hover:bg-bg-elevated text-text-tertiary transition-colors shrink-0\"\n aria-label={tr('calendar.close', 'Close')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n {/* Actions */}\n <div className=\"mt-6 flex justify-end gap-3\">\n <button\n onClick={onCancel}\n disabled={loading}\n className=\"px-4 py-2 rounded-radius-md border border-border-default bg-bg-surface hover:bg-bg-elevated font-text-sm font-weight-medium text-text-primary transition-colors disabled:opacity-50\"\n >\n {cancelLabel}\n </button>\n <button\n onClick={onConfirm}\n disabled={loading}\n className={`px-4 py-2 rounded-radius-md font-text-sm font-weight-medium transition-colors disabled:opacity-50 ${styles.button}`}\n >\n {loading ? tr('calendar.processing', 'Processing...') : confirmLabel}\n </button>\n </div>\n </div>\n </dialog>\n );\n};\n"],"mappings":";;;;;AAoBA,IAAa,KAAyC,EACpD,SACA,UACA,YACA,kBAAe,WACf,iBAAc,UACd,aAAU,UACV,aAAU,IACV,cACA,kBACI;CACJ,IAAM,IAAY,EAA0B,KAAK,EAC3C,EAAE,SAAM,GAAS,EACjB,KAAM,GAA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og.tsx"],"sourcesContent":["/**\n * ConfirmDialog - Reusable confirmation dialog for destructive actions\n */\n\nimport { useEffect, useRef, type FC } from 'react';\nimport { AlertTriangle, X } from 'lucide-react';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\n\ninterface ConfirmDialogProps {\n open: boolean;\n title: string;\n message: string;\n confirmLabel?: string;\n cancelLabel?: string;\n variant?: 'danger' | 'warning' | 'info';\n loading?: boolean;\n onConfirm: () => void;\n onCancel: () => void;\n}\n\nexport const ConfirmDialog: FC<ConfirmDialogProps> = ({\n open,\n title,\n message,\n confirmLabel = 'Confirm',\n cancelLabel = 'Cancel',\n variant = 'danger',\n loading = false,\n onConfirm,\n onCancel,\n}) => {\n const dialogRef = useRef<HTMLDialogElement>(null);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n useEffect(() => {\n const dialog = dialogRef.current;\n if (!dialog) return;\n\n if (open && !dialog.open) {\n dialog.showModal();\n } else if (!open && dialog.open) {\n dialog.close();\n }\n }, [open]);\n\n if (!open) return null;\n\n const variantStyles = {\n danger: {\n icon: 'text-red-500',\n button: 'bg-red-600 hover:bg-red-700 text-white',\n },\n warning: {\n icon: 'text-amber-500',\n button: 'bg-amber-600 hover:bg-amber-700 text-white',\n },\n info: {\n icon: 'text-blue-500',\n button: 'bg-blue-600 hover:bg-blue-700 text-white',\n },\n };\n\n const styles = variantStyles[variant];\n\n return (\n <dialog\n ref={dialogRef}\n className=\"fixed inset-0 z-50 m-auto rounded-radius-lg border border-border-default bg-bg-surface shadow-lg backdrop:bg-black/50 max-w-md w-full p-0\"\n onClose={onCancel}\n >\n <div className=\"p-6\">\n {/* Header */}\n <div className=\"flex items-start gap-4\">\n <div\n className={`size-10 rounded-full bg-bg-neutral flex items-center justify-center shrink-0 ${styles.icon}`}\n >\n <AlertTriangle className=\"size-5\" />\n </div>\n <div className=\"flex-1 min-w-0\">\n <h3 className=\"font-heading-sm text-text-primary\">{title}</h3>\n <p className=\"mt-2 font-text-sm text-text-secondary\">{message}</p>\n </div>\n <button\n type=\"button\"\n onClick={onCancel}\n className=\"size-8 inline-flex items-center justify-center rounded-radius-sm hover:bg-bg-elevated text-text-tertiary transition-colors shrink-0\"\n aria-label={tr('calendar.close', 'Close')}\n >\n <X className=\"size-4\" />\n </button>\n </div>\n\n {/* Actions */}\n <div className=\"mt-6 flex justify-end gap-3\">\n <button\n type=\"button\"\n onClick={onCancel}\n disabled={loading}\n className=\"px-4 py-2 rounded-radius-md border border-border-default bg-bg-surface hover:bg-bg-elevated font-text-sm font-weight-medium text-text-primary transition-colors disabled:opacity-50\"\n >\n {cancelLabel}\n </button>\n <button\n type=\"button\"\n onClick={onConfirm}\n disabled={loading}\n className={`px-4 py-2 rounded-radius-md font-text-sm font-weight-medium transition-colors disabled:opacity-50 ${styles.button}`}\n >\n {loading ? tr('calendar.processing', 'Processing...') : confirmLabel}\n </button>\n </div>\n </div>\n </dialog>\n );\n};\n"],"mappings":";;;;;AAoBA,IAAa,KAAyC,EACpD,SACA,UACA,YACA,kBAAe,WACf,iBAAc,UACd,aAAU,UACV,aAAU,IACV,cACA,kBACI;CACJ,IAAM,IAAY,EAA0B,KAAK,EAC3C,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IAAQ,EAAE,EAAI;AACpB,SAAO,MAAU,IAAM,IAAW;;AAcpC,KAXA,QAAgB;EACd,IAAM,IAAS,EAAU;AACpB,QAED,KAAQ,CAAC,EAAO,OAClB,EAAO,WAAW,GACT,CAAC,KAAQ,EAAO,QACzB,EAAO,OAAO;IAEf,CAAC,EAAK,CAAC,EAEN,CAAC,EAAM,QAAO;CAiBlB,IAAM,IAfgB;EACpB,QAAQ;GACN,MAAM;GACN,QAAQ;GACT;EACD,SAAS;GACP,MAAM;GACN,QAAQ;GACT;EACD,MAAM;GACJ,MAAM;GACN,QAAQ;GACT;EACF,CAE4B;AAE7B,QACE,kBAAC,UAAD;EACE,KAAK;EACL,WAAU;EACV,SAAS;YAET,kBAAC,OAAD;GAAK,WAAU;aAAf,CAEE,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,OAAD;MACE,WAAW,gFAAgF,EAAO;gBAElG,kBAAC,GAAD,EAAe,WAAU,UAAW,CAAA;MAChC,CAAA;KACN,kBAAC,OAAD;MAAK,WAAU;gBAAf,CACE,kBAAC,MAAD;OAAI,WAAU;iBAAqC;OAAW,CAAA,EAC9D,kBAAC,KAAD;OAAG,WAAU;iBAAyC;OAAY,CAAA,CAC9D;;KACN,kBAAC,UAAD;MACE,MAAK;MACL,SAAS;MACT,WAAU;MACV,cAAY,EAAG,kBAAkB,QAAQ;gBAEzC,kBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MACjB,CAAA;KACL;OAGN,kBAAC,OAAD;IAAK,WAAU;cAAf,CACE,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU;KACV,WAAU;eAET;KACM,CAAA,EACT,kBAAC,UAAD;KACE,MAAK;KACL,SAAS;KACT,UAAU;KACV,WAAW,qGAAqG,EAAO;eAEtH,IAAU,EAAG,uBAAuB,gBAAgB,GAAG;KACjD,CAAA,CACL;MACF;;EACC,CAAA"}
|
|
@@ -2,27 +2,31 @@ import { useCalendarStore as e } from "../store/calendarStore.js";
|
|
|
2
2
|
import { endOfDay as t, isSameDay as n, startOfDay as r } from "../utils/dateHelpers.js";
|
|
3
3
|
import { useEvents as i } from "../hooks/useEvents.js";
|
|
4
4
|
import { EventBlock as a } from "./EventBlock.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { CalendarErrorState as o } from "./CalendarErrorState.js";
|
|
6
|
+
import { useI18n as s } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
8
|
//#region src/components/DayView.tsx
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
let n =
|
|
9
|
+
function u({ onCreateSlot: u }) {
|
|
10
|
+
let d = e((e) => e.currentDate), { t: f } = s(), p = (e, t) => {
|
|
11
|
+
let n = f(e);
|
|
11
12
|
return n === e ? t : n;
|
|
12
|
-
}, { events:
|
|
13
|
-
startDate: r(
|
|
14
|
-
endDate: t(
|
|
15
|
-
}),
|
|
16
|
-
return /* @__PURE__ */
|
|
13
|
+
}, { events: m, isLoading: h, error: g, refetch: _ } = i({
|
|
14
|
+
startDate: r(d),
|
|
15
|
+
endDate: t(d)
|
|
16
|
+
}), v = Array.from({ length: 24 }, (e, t) => t), y = (e) => m.filter((t) => t.isAllDay ? !1 : n(t.startTime, d) && t.startTime.getHours() === e), b = m.filter((e) => e.isAllDay && n(e.startTime, d));
|
|
17
|
+
return /* @__PURE__ */ l("div", {
|
|
17
18
|
className: "@container",
|
|
18
|
-
children: /* @__PURE__ */ c(
|
|
19
|
+
children: [g && /* @__PURE__ */ c(o, {
|
|
20
|
+
message: g,
|
|
21
|
+
onRetry: () => void _()
|
|
22
|
+
}), /* @__PURE__ */ l("div", {
|
|
19
23
|
className: "bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden",
|
|
20
24
|
children: [
|
|
21
|
-
/* @__PURE__ */
|
|
25
|
+
/* @__PURE__ */ c("div", {
|
|
22
26
|
className: "border-b border-border-default bg-bg-elevated p-4",
|
|
23
|
-
children: /* @__PURE__ */
|
|
27
|
+
children: /* @__PURE__ */ c("h2", {
|
|
24
28
|
className: "font-heading-md text-text-primary",
|
|
25
|
-
children:
|
|
29
|
+
children: d.toLocaleDateString("en-US", {
|
|
26
30
|
weekday: "long",
|
|
27
31
|
month: "long",
|
|
28
32
|
day: "numeric",
|
|
@@ -30,44 +34,51 @@ function l() {
|
|
|
30
34
|
})
|
|
31
35
|
})
|
|
32
36
|
}),
|
|
33
|
-
|
|
37
|
+
h && /* @__PURE__ */ c("div", {
|
|
34
38
|
className: "text-center py-1 text-text-tertiary font-text-xs bg-bg-canvas border-b border-border-subtle",
|
|
35
|
-
children:
|
|
39
|
+
children: p("calendar.loadingEvents", "Loading events...")
|
|
36
40
|
}),
|
|
37
|
-
|
|
41
|
+
b.length > 0 && /* @__PURE__ */ l("div", {
|
|
38
42
|
className: "border-b border-border-default bg-bg-canvas p-2",
|
|
39
|
-
children: [/* @__PURE__ */
|
|
43
|
+
children: [/* @__PURE__ */ c("span", {
|
|
40
44
|
className: "font-text-xs text-text-tertiary mr-2",
|
|
41
|
-
children:
|
|
42
|
-
}), /* @__PURE__ */
|
|
45
|
+
children: p("calendar.allDay", "All day")
|
|
46
|
+
}), /* @__PURE__ */ c("div", {
|
|
43
47
|
className: "inline-flex flex-wrap gap-1",
|
|
44
|
-
children:
|
|
48
|
+
children: b.map((e) => /* @__PURE__ */ c(a, { event: e }, e.id))
|
|
45
49
|
})]
|
|
46
50
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
51
|
+
/* @__PURE__ */ c("div", {
|
|
48
52
|
className: "divide-y divide-border-subtle",
|
|
49
|
-
children:
|
|
50
|
-
let t =
|
|
51
|
-
return /* @__PURE__ */
|
|
53
|
+
children: v.map((e) => {
|
|
54
|
+
let t = y(e);
|
|
55
|
+
return /* @__PURE__ */ l("div", {
|
|
52
56
|
className: "flex",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
57
|
+
children: [/* @__PURE__ */ c("div", {
|
|
54
58
|
className: "w-24 p-2 text-right bg-bg-canvas",
|
|
55
|
-
children: /* @__PURE__ */
|
|
59
|
+
children: /* @__PURE__ */ c("span", {
|
|
56
60
|
className: "font-text-xs text-text-tertiary",
|
|
57
61
|
children: e === 0 ? "12 AM" : e < 12 ? `${e} AM` : e === 12 ? "12 PM" : `${e - 12} PM`
|
|
58
62
|
})
|
|
59
|
-
}), /* @__PURE__ */
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
}), /* @__PURE__ */ c("div", {
|
|
64
|
+
role: u ? "button" : void 0,
|
|
65
|
+
tabIndex: u ? 0 : void 0,
|
|
66
|
+
"aria-label": u ? p("calendar.createEventAtSlot", "Create event at this time") : void 0,
|
|
67
|
+
onClick: u ? () => u(d, e) : void 0,
|
|
68
|
+
onKeyDown: u ? (t) => {
|
|
69
|
+
t.target === t.currentTarget && (t.key === "Enter" || t.key === " ") && (t.preventDefault(), u(d, e));
|
|
70
|
+
} : void 0,
|
|
71
|
+
className: `flex-1 min-h-[60px] p-1 transition-colors relative ${u ? "cursor-pointer hover:bg-bg-elevated" : ""}`,
|
|
72
|
+
children: t.map((e) => /* @__PURE__ */ c(a, { event: e }, e.id))
|
|
62
73
|
})]
|
|
63
74
|
}, e);
|
|
64
75
|
})
|
|
65
76
|
})
|
|
66
77
|
]
|
|
67
|
-
})
|
|
78
|
+
})]
|
|
68
79
|
});
|
|
69
80
|
}
|
|
70
81
|
//#endregion
|
|
71
|
-
export {
|
|
82
|
+
export { u as DayView };
|
|
72
83
|
|
|
73
84
|
//# sourceMappingURL=DayView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayView.js","names":[],"sources":["../../src/components/DayView.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport { startOfDay, endOfDay, isSameDay } from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport type { CalendarEvent } from '../types';\n\n/**\n * Day view component\n * Shows a single day with hourly time slots and real events\n */\nexport function DayView() {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Fetch events for the visible day\n const dayStart = startOfDay(currentDate);\n const dayEnd = endOfDay(currentDate);\n const { events, isLoading } = useEvents({
|
|
1
|
+
{"version":3,"file":"DayView.js","names":[],"sources":["../../src/components/DayView.tsx"],"sourcesContent":["import { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { useCalendarStore } from '../store/calendarStore';\nimport { startOfDay, endOfDay, isSameDay } from '../utils/dateHelpers';\nimport { useEvents } from '../hooks/useEvents';\nimport { EventBlock } from './EventBlock';\nimport { CalendarErrorState } from './CalendarErrorState';\nimport type { CalendarEvent } from '../types';\n\ninterface DayViewProps {\n /** Open the create-event modal pre-filled with the clicked slot. Omitted when the user can't create events. */\n onCreateSlot?: (date: Date, hour?: number) => void;\n}\n\n/**\n * Day view component\n * Shows a single day with hourly time slots and real events\n */\nexport function DayView({ onCreateSlot }: DayViewProps) {\n const currentDate = useCalendarStore((state) => state.currentDate);\n const { t } = useI18n();\n const tr = (key: string, fallback: string): string => {\n const value = t(key);\n return value === key ? fallback : value;\n };\n\n // Fetch events for the visible day\n const dayStart = startOfDay(currentDate);\n const dayEnd = endOfDay(currentDate);\n const { events, isLoading, error, refetch } = useEvents({\n startDate: dayStart,\n endDate: dayEnd,\n });\n\n // Generate hours array (0-23)\n const hours = Array.from({ length: 24 }, (_, i) => i);\n\n const getEventsForHour = (hour: number): CalendarEvent[] => {\n return events.filter((event) => {\n if (event.isAllDay) return false;\n return isSameDay(event.startTime, currentDate) && event.startTime.getHours() === hour;\n });\n };\n\n const allDayEvents = events.filter(\n (event) => event.isAllDay && isSameDay(event.startTime, currentDate)\n );\n\n return (\n <div className=\"@container\">\n {error && <CalendarErrorState message={error} onRetry={() => void refetch()} />}\n <div className=\"bg-bg-surface border border-border-default rounded-radius-lg overflow-hidden\">\n {/* Day header */}\n <div className=\"border-b border-border-default bg-bg-elevated p-4\">\n <h2 className=\"font-heading-md text-text-primary\">\n {currentDate.toLocaleDateString('en-US', {\n weekday: 'long',\n month: 'long',\n day: 'numeric',\n year: 'numeric',\n })}\n </h2>\n </div>\n\n {/* Loading indicator */}\n {isLoading && (\n <div className=\"text-center py-1 text-text-tertiary font-text-xs bg-bg-canvas border-b border-border-subtle\">\n {tr('calendar.loadingEvents', 'Loading events...')}\n </div>\n )}\n\n {/* All-day events */}\n {allDayEvents.length > 0 && (\n <div className=\"border-b border-border-default bg-bg-canvas p-2\">\n <span className=\"font-text-xs text-text-tertiary mr-2\">\n {tr('calendar.allDay', 'All day')}\n </span>\n <div className=\"inline-flex flex-wrap gap-1\">\n {allDayEvents.map((event) => (\n <EventBlock key={event.id} event={event} />\n ))}\n </div>\n </div>\n )}\n\n {/* Time slots */}\n <div className=\"divide-y divide-border-subtle\">\n {hours.map((hour) => {\n const cellEvents = getEventsForHour(hour);\n return (\n <div key={hour} className=\"flex\">\n {/* Time label */}\n <div className=\"w-24 p-2 text-right bg-bg-canvas\">\n <span className=\"font-text-xs text-text-tertiary\">\n {hour === 0\n ? '12 AM'\n : hour < 12\n ? `${hour} AM`\n : hour === 12\n ? '12 PM'\n : `${hour - 12} PM`}\n </span>\n </div>\n\n {/* Event area */}\n <div\n role={onCreateSlot ? 'button' : undefined}\n tabIndex={onCreateSlot ? 0 : undefined}\n aria-label={\n onCreateSlot\n ? tr('calendar.createEventAtSlot', 'Create event at this time')\n : undefined\n }\n onClick={onCreateSlot ? () => onCreateSlot(currentDate, hour) : undefined}\n onKeyDown={\n onCreateSlot\n ? (e) => {\n // Ignore key events bubbling up from a focused\n // EventBlock inside the cell (it stops click, not\n // keydown) — only act when the cell itself is focused.\n if (e.target !== e.currentTarget) return;\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n onCreateSlot(currentDate, hour);\n }\n }\n : undefined\n }\n className={`flex-1 min-h-[60px] p-1 transition-colors relative ${\n onCreateSlot ? 'cursor-pointer hover:bg-bg-elevated' : ''\n }`}\n >\n {cellEvents.map((event) => (\n <EventBlock key={event.id} event={event} />\n ))}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,SAAgB,EAAQ,EAAE,mBAA8B;CACtD,IAAM,IAAc,GAAkB,MAAU,EAAM,YAAY,EAC5D,EAAE,SAAM,GAAS,EACjB,KAAM,GAAa,MAA6B;EACpD,IAAM,IA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AC,QAAD;SAAM,WAAU;mBACb,MAAS,IACN,UACA,IAAO,KACL,GAAG,EAAK,OACR,MAAS,KACP,UACA,GAAG,IAAO,GAAG;SAChB,CAAA;QACH,CAAA,EAGN,kBAAC,OAAD;QACE,MAAM,IAAe,WAAW,KAAA;QAChC,UAAU,IAAe,IAAI,KAAA;QAC7B,cACE,IACI,EAAG,8BAA8B,4BAA4B,GAC7D,KAAA;QAEN,SAAS,UAAqB,EAAa,GAAa,EAAK,GAAG,KAAA;QAChE,WACE,KACK,MAAM;AAID,WAAE,WAAW,EAAE,kBACf,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,EAAa,GAAa,EAAK;YAGnC,KAAA;QAEN,WAAW,sDACT,IAAe,wCAAwC;kBAGxD,EAAW,KAAK,MACf,kBAAC,GAAD,EAAkC,UAAS,EAA1B,EAAM,GAAoB,CAC3C;QACE,CAAA,CACF;SA9CI,EA8CJ;OAER;KACE,CAAA;IACF;KACF"}
|
|
@@ -1,38 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
1
|
+
import { formatTime as e } from "../utils/dateHelpers.js";
|
|
2
|
+
import { useOpenEvent as t } from "../hooks/useOpenEvent.js";
|
|
3
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
4
|
//#region src/components/EventBlock.tsx
|
|
6
|
-
function
|
|
7
|
-
let
|
|
8
|
-
return /* @__PURE__ */
|
|
5
|
+
function i({ event: i }) {
|
|
6
|
+
let a = t();
|
|
7
|
+
return /* @__PURE__ */ r("button", {
|
|
9
8
|
type: "button",
|
|
10
9
|
onClick: (e) => {
|
|
11
|
-
|
|
12
|
-
id: a.id,
|
|
13
|
-
title: a.title,
|
|
14
|
-
startTime: a.startTime,
|
|
15
|
-
endTime: a.endTime,
|
|
16
|
-
isAllDay: a.isAllDay,
|
|
17
|
-
calendarId: a.calendarId
|
|
18
|
-
}), a.sourceKind === "scheduler" && a.deepLink) {
|
|
19
|
-
c(a.deepLink);
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
c(`${s}/event/${a.id}`);
|
|
10
|
+
e.stopPropagation(), a(i);
|
|
23
11
|
},
|
|
24
|
-
className: `w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${
|
|
25
|
-
title: `${
|
|
26
|
-
children: [/* @__PURE__ */
|
|
12
|
+
className: `w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${i.sourceKind === "scheduler" ? "bg-bg-canvas text-text-primary border-border-strong hover:bg-bg-elevated" : "bg-bg-elevated text-text-primary border-border-default hover:bg-bg-canvas"}`,
|
|
13
|
+
title: `${i.title} (${e(i.startTime)} - ${e(i.endTime)})`,
|
|
14
|
+
children: [/* @__PURE__ */ n("span", {
|
|
27
15
|
className: "font-medium",
|
|
28
|
-
children:
|
|
29
|
-
}), !
|
|
16
|
+
children: i.title
|
|
17
|
+
}), !i.isAllDay && /* @__PURE__ */ n("span", {
|
|
30
18
|
className: "ml-1 opacity-70",
|
|
31
|
-
children:
|
|
19
|
+
children: e(i.startTime)
|
|
32
20
|
})]
|
|
33
21
|
});
|
|
34
22
|
}
|
|
35
23
|
//#endregion
|
|
36
|
-
export {
|
|
24
|
+
export { i as EventBlock };
|
|
37
25
|
|
|
38
26
|
//# sourceMappingURL=EventBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock — Renders a single event inside a time grid cell\n *\n * Displays the event title and time range. Clicking selects the event\n * in the calendar store for detail view.\n */\n\nimport {
|
|
1
|
+
{"version":3,"file":"EventBlock.js","names":[],"sources":["../../src/components/EventBlock.tsx"],"sourcesContent":["/**\n * EventBlock — Renders a single event inside a time grid cell\n *\n * Displays the event title and time range. Clicking selects the event\n * in the calendar store for detail view.\n */\n\nimport { useOpenEvent } from '../hooks/useOpenEvent';\nimport { formatTime } from '../utils/dateHelpers';\nimport type { CalendarEvent } from '../types';\n\ninterface EventBlockProps {\n event: CalendarEvent;\n}\n\nexport function EventBlock({ event }: EventBlockProps) {\n const openEvent = useOpenEvent();\n\n const handleClick = (e: React.MouseEvent) => {\n e.stopPropagation();\n openEvent(event);\n };\n\n const isSchedulerEvent = event.sourceKind === 'scheduler';\n const baseClasses = isSchedulerEvent\n ? 'bg-bg-canvas text-text-primary border-border-strong hover:bg-bg-elevated'\n : 'bg-bg-elevated text-text-primary border-border-default hover:bg-bg-canvas';\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n className={`w-full text-left px-1.5 py-0.5 rounded text-xs border transition-colors cursor-pointer truncate ${baseClasses}`}\n title={`${event.title} (${formatTime(event.startTime)} - ${formatTime(event.endTime)})`}\n >\n <span className=\"font-medium\">{event.title}</span>\n {!event.isAllDay && <span className=\"ml-1 opacity-70\">{formatTime(event.startTime)}</span>}\n </button>\n );\n}\n"],"mappings":";;;;AAeA,SAAgB,EAAW,EAAE,YAA0B;CACrD,IAAM,IAAY,GAAc;AAYhC,QACE,kBAAC,UAAD;EACE,MAAK;EACL,UAbiB,MAAwB;AAE3C,GADA,EAAE,iBAAiB,EACnB,EAAU,EAAM;;EAYd,WAAW,mGATU,EAAM,eAAe,cAE1C,6EACA;EAOA,OAAO,GAAG,EAAM,MAAM,IAAI,EAAW,EAAM,UAAU,CAAC,KAAK,EAAW,EAAM,QAAQ,CAAC;YAJvF,CAME,kBAAC,QAAD;GAAM,WAAU;aAAe,EAAM;GAAa,CAAA,EACjD,CAAC,EAAM,YAAY,kBAAC,QAAD;GAAM,WAAU;aAAmB,EAAW,EAAM,UAAU;GAAQ,CAAA,CACnF"}
|