@burdenoff/microfe-calendar 2026.1124.2 → 2026.1124.4
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/generated/wspace-operations.d.ts +811 -69
- package/dist/generated/wspace-operations.js +173 -19
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +405 -6
- package/dist/pages/ResourcesPage.js.map +1 -1
- package/dist/translations/en.d.ts +250 -1
- package/dist/v2/CalendarPageV2.js +45 -41
- package/dist/v2/CalendarPageV2.js.map +1 -1
- package/dist/v2/CalendarRoutesV2.js +64 -64
- package/dist/v2/CalendarRoutesV2.js.map +1 -1
- package/dist/v2/data/enums.d.ts +1 -0
- package/dist/v2/data/enums.js +6 -2
- package/dist/v2/data/enums.js.map +1 -1
- package/dist/v2/data/errors.d.ts +5 -0
- package/dist/v2/data/errors.js +6 -2
- package/dist/v2/data/errors.js.map +1 -1
- package/dist/v2/data/normalize.d.ts +31 -3
- package/dist/v2/data/normalize.js +57 -13
- package/dist/v2/data/normalize.js.map +1 -1
- package/dist/v2/data/seriesDateLookup.d.ts +9 -0
- package/dist/v2/data/seriesDateLookup.js +12 -0
- package/dist/v2/data/seriesDateLookup.js.map +1 -0
- package/dist/v2/data/useEventActions.d.ts +9 -3
- package/dist/v2/data/useEventActions.js +239 -186
- package/dist/v2/data/useEventActions.js.map +1 -1
- package/dist/v2/data/useEventForPeek.js +63 -21
- package/dist/v2/data/useEventForPeek.js.map +1 -1
- package/dist/v2/data/useEventsInRangeV2.d.ts +40 -2
- package/dist/v2/data/useEventsInRangeV2.js +76 -47
- package/dist/v2/data/useEventsInRangeV2.js.map +1 -1
- package/dist/v2/day/DayPanel.js +1 -1
- package/dist/v2/day/DayPanel.js.map +1 -1
- package/dist/v2/dialogs/CalendarDialogsV2.js +12 -9
- package/dist/v2/dialogs/CalendarDialogsV2.js.map +1 -1
- package/dist/v2/event/CustomRepeat.d.ts +5 -0
- package/dist/v2/event/CustomRepeat.js +246 -0
- package/dist/v2/event/CustomRepeat.js.map +1 -0
- package/dist/v2/event/EventDetailsTab.d.ts +6 -0
- package/dist/v2/event/EventDetailsTab.js +291 -0
- package/dist/v2/event/EventDetailsTab.js.map +1 -0
- package/dist/v2/event/EventDialog.d.ts +35 -0
- package/dist/v2/event/EventDialog.js +388 -0
- package/dist/v2/event/EventDialog.js.map +1 -0
- package/dist/v2/event/EventDialogs.d.ts +3 -0
- package/dist/v2/event/EventDialogs.js +118 -0
- package/dist/v2/event/EventDialogs.js.map +1 -0
- package/dist/v2/event/EventMoreTab.d.ts +4 -0
- package/dist/v2/event/EventMoreTab.js +215 -0
- package/dist/v2/event/EventMoreTab.js.map +1 -0
- package/dist/v2/event/EventPeopleTab.d.ts +8 -0
- package/dist/v2/event/EventPeopleTab.js +422 -0
- package/dist/v2/event/EventPeopleTab.js.map +1 -0
- package/dist/v2/event/EventPlaceTab.d.ts +6 -0
- package/dist/v2/event/EventPlaceTab.js +264 -0
- package/dist/v2/event/EventPlaceTab.js.map +1 -0
- package/dist/v2/event/FindTimeDialog.d.ts +26 -0
- package/dist/v2/event/FindTimeDialog.js +667 -0
- package/dist/v2/event/FindTimeDialog.js.map +1 -0
- package/dist/v2/event/RepeatField.d.ts +5 -0
- package/dist/v2/event/RepeatField.js +91 -0
- package/dist/v2/event/RepeatField.js.map +1 -0
- package/dist/v2/event/dialogLogic.d.ts +97 -0
- package/dist/v2/event/dialogLogic.js +120 -0
- package/dist/v2/event/dialogLogic.js.map +1 -0
- package/dist/v2/event/dialogModel.d.ts +51 -0
- package/dist/v2/event/dialogModel.js +13 -0
- package/dist/v2/event/dialogModel.js.map +1 -0
- package/dist/v2/event/eventForm.d.ts +235 -0
- package/dist/v2/event/eventForm.js +450 -0
- package/dist/v2/event/eventForm.js.map +1 -0
- package/dist/v2/event/findTime.d.ts +120 -0
- package/dist/v2/event/findTime.js +149 -0
- package/dist/v2/event/findTime.js.map +1 -0
- package/dist/v2/event/findTimeSource.d.ts +102 -0
- package/dist/v2/event/findTimeSource.js +107 -0
- package/dist/v2/event/findTimeSource.js.map +1 -0
- package/dist/v2/event/parts.d.ts +46 -0
- package/dist/v2/event/parts.js +124 -0
- package/dist/v2/event/parts.js.map +1 -0
- package/dist/v2/event/place.d.ts +64 -0
- package/dist/v2/event/place.js +48 -0
- package/dist/v2/event/place.js.map +1 -0
- package/dist/v2/event/repeatWords.d.ts +19 -0
- package/dist/v2/event/repeatWords.js +130 -0
- package/dist/v2/event/repeatWords.js.map +1 -0
- package/dist/v2/event/rrule.d.ts +90 -0
- package/dist/v2/event/rrule.js +368 -0
- package/dist/v2/event/rrule.js.map +1 -0
- package/dist/v2/event/savePlan.d.ts +160 -0
- package/dist/v2/event/savePlan.js +219 -0
- package/dist/v2/event/savePlan.js.map +1 -0
- package/dist/v2/event/useEventData.d.ts +96 -0
- package/dist/v2/event/useEventData.js +229 -0
- package/dist/v2/event/useEventData.js.map +1 -0
- package/dist/v2/event/useEventDialogModel.d.ts +50 -0
- package/dist/v2/event/useEventDialogModel.js +144 -0
- package/dist/v2/event/useEventDialogModel.js.map +1 -0
- package/dist/v2/event/useEventSave.d.ts +57 -0
- package/dist/v2/event/useEventSave.js +276 -0
- package/dist/v2/event/useEventSave.js.map +1 -0
- package/dist/v2/events/eventLook.js +16 -16
- package/dist/v2/events/eventLook.js.map +1 -1
- package/dist/v2/events/eventModel.d.ts +17 -4
- package/dist/v2/events/eventModel.js +46 -34
- package/dist/v2/events/eventModel.js.map +1 -1
- package/dist/v2/events/localChanges.d.ts +4 -1
- package/dist/v2/events/localChanges.js +4 -2
- package/dist/v2/events/localChanges.js.map +1 -1
- package/dist/v2/format.d.ts +2 -0
- package/dist/v2/format.js +4 -0
- package/dist/v2/format.js.map +1 -1
- package/dist/v2/page/CalendarPageContext.d.ts +2 -2
- package/dist/v2/page/CalendarPageContext.js.map +1 -1
- package/dist/v2/page/useCalendarPageModel.js +141 -139
- package/dist/v2/page/useCalendarPageModel.js.map +1 -1
- package/dist/v2/page/viewState.d.ts +9 -1
- package/dist/v2/page/viewState.js +5 -3
- package/dist/v2/page/viewState.js.map +1 -1
- package/dist/v2/peek/EventPeek.js.map +1 -1
- package/dist/v2/peek/PeekEvent.js +210 -204
- package/dist/v2/peek/PeekEvent.js.map +1 -1
- package/dist/v2/rail/CalendarRail.js.map +1 -1
- package/dist/v2/rail/useMonthEventDates.js +1 -1
- package/dist/v2/rail/useMonthEventDates.js.map +1 -1
- package/dist/v2/runs/RunPeek.js.map +1 -1
- package/dist/v2/states/CalendarStates.d.ts +15 -0
- package/dist/v2/states/CalendarStates.js +42 -11
- package/dist/v2/states/CalendarStates.js.map +1 -1
- package/dist/v2/types.d.ts +32 -2
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FindTimeDialog.js","names":["SEARCH_DAYS","STEP","KEY_STEP","FindTimeDialog","handlers","source","basis","FindTimeReady","event","FindTimeState","FindTimeHeader","useCalendarPage","TabbedDialogHeader","IconTile","Users","tr","subtitle","body","edited","Button","TabbedDialog","open","onClose","TabbedDialogContent","TabbedDialogFooter","useUserIds","idsKey","participants","person","useMemo","useParticipants","useCalendar","youName","currentUser","participantsOf","me","busyReader","ownTime","owners","guest","userId","participant","identities","answer","freeBusy","personBusySpans","timeZone","loadStatus","rooms","peopleKnown","roomsReady","hasRoom","useFindTimeData","userIds","useIdentities","range","daysToInstants","day","addDays","useFreeBusy","roomId","roomIdOf","useRoomsForEvent","room","findTimeRoomOf","bookedRoomNameOf","myRules","workingHoursOn","date","useClashWords","clashes","data","key","item","name","useSubtitle","count","who","formatDuration","length","durationWords","page","setLength","useState","startLengthOf","setDay","startDayOf","pick","setPick","clashWords","people","busy","suggestions","suggestTimes","first","chosen","pickStart","zonedTimeToInstant","pickClashes","clashesAt","moving","movesDirectly","leave","onBack","FindTimeControls","next","SuggestionCards","FindTimeTimeline","PickSummary","onUse","lengths","LENGTH_CHIPS","a","b","Segmented","onLength","value","minutes","today","onDay","ChevronLeft","DatePicker","format","ChevronRight","SuggestionCard","checked","onPick","cn","FOCUS_RING","formatDay","suggestion","formatMinuteRange","instantToZoned","CircleCheck","AlertTriangle","SuggestionList","Notice","firstFree","outsiders","useBlockWord","kind","STRIPES","BLOCK_LOOK","TimelineBar","blockWord","geometry","place","pct","start","end","blocks","spans","blocksOnDay","block","window","showNow","row","off","part","pickEndClock","TimelineName","Building2","EntityAvatar","role","keyedMinute","steps","rtl","last","step","ready","hours","timelineWindow","minute","offHours","hourMarks","hour","rows","formatMinutes","Fragment","index","box","click","fraction","minuteAt","verdict"],"sources":["../../../src/v2/event/FindTimeDialog.tsx"],"sourcesContent":["/**\n * Find a time (BOFF-15698 A2): a viewer (fe-libs' dialog frame, at most 760 px wide; a sheet on\n * phones). Length and day; suggested times (everyone free first, then near misses naming who\n * can't make it; the room counts); and a timeline with a row per person and for the room, with\n * the working hours, the busy time and a now line. The timeline is also a slider: a click, or\n * the arrow keys, pick a time on it.\n *\n * Who it looks at depends on where it opened:\n * - from the event dialog: the person, the guests and the room picked there, and \"Use this time\"\n * goes back to the dialog with that time;\n * - from an event's peek (\"Find a better time\"): the event's people and room, and the event moves\n * there (with Undo, as a drag does) when a drag could move it; anything else opens the event\n * dialog with the time (`movesDirectly`);\n * - from ⋯ Find a time: the person alone, and the time starts a new event.\n *\n * Busy time comes from free/busy (people) and bookings (the room); someone outside the\n * workspace has none to show (\"No free/busy\"), which is never read as free.\n */\nimport { Fragment, useMemo, useState, type KeyboardEvent, type MouseEvent } from 'react';\nimport {\n AlertTriangle,\n Building2,\n ChevronLeft,\n ChevronRight,\n CircleCheck,\n Users,\n} from 'lucide-react';\nimport {\n addDays,\n Button,\n DatePicker,\n EntityAvatar,\n IconTile,\n Notice,\n Segmented,\n TabbedDialog,\n TabbedDialogContent,\n TabbedDialogFooter,\n TabbedDialogHeader,\n type DateValue,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendar } from '../../providers/CalendarProvider';\nimport { useFreeBusy, type FreeBusyV2 } from '../data/useFreeBusy';\nimport { formatDay, formatDuration, formatMinuteRange, formatMinutes } from '../format';\nimport { offHours, workingHoursOn, type DayHours } from '../grid/workingHours';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport { daysToInstants, instantToZoned, zonedTimeToInstant } from '../time/calendarTime';\nimport type { CalendarEventV2, WorkingHoursV2 } from '../types';\nimport { LENGTH_CHIPS } from './eventForm';\nimport type { EventSession } from './EventDialog';\nimport {\n blocksOnDay,\n clashesAt,\n minuteAt,\n movesDirectly,\n personBusySpans,\n suggestTimes,\n timelineWindow,\n type BusySpan,\n type FindTimePerson,\n type Suggestion,\n} from './findTime';\nimport {\n bookedRoomNameOf,\n findTimeRoomOf,\n participantsOf,\n pickEndClock,\n roomIdOf,\n startDayOf,\n startLengthOf,\n type FindTimeBasis,\n type FindTimeRoom,\n type Participant,\n type PickedTime,\n} from './findTimeSource';\nimport {\n useIdentities,\n useRoomsForEvent,\n type EditedEvent,\n type Identities,\n type RoomsForEvent,\n} from './useEventData';\n\n/** Where Find a time opened, and so whose time it looks at. */\nexport type FindTimeSource =\n | { kind: 'form'; session: EventSession; event: CalendarEventV2 | null }\n | { kind: 'event'; edited: EditedEvent }\n | { kind: 'none' };\n\n/** Days searched from the chosen one. */\nconst SEARCH_DAYS = 7;\n/** Minutes between suggested starts. */\nconst STEP = 30;\n/** Minutes a timeline key press moves the pick. */\nconst KEY_STEP = 15;\n\ninterface Handlers {\n /** \"Use this time\", with what Find a time was looking at. */\n onUse: (time: PickedTime, basis: FindTimeBasis) => void;\n /** Back to the event dialog (when it opened from there). */\n onBack: (() => void) | null;\n onClose: () => void;\n}\n\nexport function FindTimeDialog({ source, ...handlers }: { source: FindTimeSource } & Handlers) {\n if (source.kind === 'form') {\n const basis: FindTimeBasis = { kind: 'form', form: source.session.form, event: source.event };\n return <FindTimeReady basis={basis} {...handlers} />;\n }\n if (source.kind === 'none') return <FindTimeReady basis={{ kind: 'none' }} {...handlers} />;\n if (source.edited.status === 'ready') {\n // Keyed by the event, so its day and length start the search.\n const event = source.edited.event;\n return <FindTimeReady key={event.id} basis={{ kind: 'event', event }} {...handlers} />;\n }\n return <FindTimeState edited={source.edited} onClose={handlers.onClose} />;\n}\n\n/** The frame's header. */\nfunction FindTimeHeader({ subtitle }: { subtitle?: string }) {\n const { tr } = useCalendarPage();\n return (\n <TabbedDialogHeader\n icon={\n <IconTile size=\"sm\" aria-hidden=\"true\">\n <Users />\n </IconTile>\n }\n title={tr('calendar.v2.findTime', 'Find a time')}\n description={subtitle}\n closeLabel={tr('calendar.v2.close', 'Close')}\n />\n );\n}\n\n/** While the event to move loads, or when it can't be read. */\nfunction FindTimeState({ edited, onClose }: { edited: EditedEvent; onClose: () => void }) {\n const { tr } = useCalendarPage();\n let body = (\n <div className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.openingEvent', 'Opening the event…')}\n </div>\n );\n if (edited.status === 'missing') {\n body = (\n <div className=\"flex max-w-sm flex-col gap-2\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekMissing', 'This event isn’t available')}\n </b>\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.actionGone', 'It may have been deleted or moved by someone else.')}\n </p>\n </div>\n );\n } else if (edited.status === 'error') {\n body = (\n <div className=\"flex max-w-sm flex-col items-center gap-3\">\n <b className=\"text-base text-text-primary\">\n {tr('calendar.v2.peekFailed', 'Couldn’t open the event')}\n </b>\n <Button type=\"button\" variant=\"outline\" onClick={edited.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n </div>\n );\n }\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : onClose())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader />\n <div className=\"grid min-h-0 flex-1 place-items-center p-6 text-center\">{body}</div>\n <TabbedDialogFooter>\n <Button type=\"button\" variant=\"outline\" onClick={onClose}>\n {tr('calendar.v2.close', 'Close')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** What the dialog has read about everyone's time over the searched week. */\ninterface FindTimeData {\n participants: Participant[];\n /** A participant's busy time; null when it can't be known (someone outside the workspace). */\n busyOf: (participant: Participant) => BusySpan[] | null;\n room: FindTimeRoom | null;\n /** The person's working hours on a day; null for a day off or while they load. */\n hoursOn: (date: DateValue) => DayHours | null;\n status: 'loading' | 'ready' | 'error';\n retry: () => void;\n /** People whose free/busy may be missing some busy time. */\n truncated: Participant[];\n nameOf: (participant: Participant) => string;\n}\n\n/** The participants' user ids: the same array while they are the same people. */\nfunction useUserIds(participants: readonly Participant[]): string[] {\n const idsKey = participants\n .flatMap((person) => (person.userId ? [person.userId] : []))\n .join('\\n');\n return useMemo(() => (idsKey ? idsKey.split('\\n') : []), [idsKey]);\n}\n\n/** The people Find a time looks at, the person first, with their roles. */\nfunction useParticipants(basis: FindTimeBasis): Participant[] {\n const { tr, me } = useCalendarPage();\n const { currentUser } = useCalendar();\n const youName = currentUser?.name?.trim() || currentUser?.email || tr('calendar.v2.evYou', 'You');\n return participantsOf(basis, me, {\n you: `${youName} ${tr('calendar.v2.youSuffix', '(you)')}`,\n organiser: tr('calendar.v2.organiser', 'Organiser'),\n required: tr('calendar.v2.evRequired', 'Required'),\n optional: tr('calendar.v2.evOptional', 'Optional'),\n guest: tr('calendar.v2.guest', 'Guest'),\n });\n}\n\n/**\n * A participant's busy time from free/busy; null for someone with none to show (outside the\n * workspace). The event's own time doesn't count against its organiser and guests.\n */\nfunction busyReader(\n event: CalendarEventV2 | null,\n me: string | null,\n identities: Identities,\n freeBusy: FreeBusyV2,\n timeZone: string\n): (participant: Participant) => BusySpan[] | null {\n const ownTime = event && !event.allDay ? { start: event.start, end: event.end } : null;\n const owners = new Set(\n (event?.guests ?? [])\n .filter((guest) => guest.response !== 'DECLINED')\n .map((guest) => guest.userId)\n );\n if (event) owners.add(event.organizerId);\n return (participant) => {\n const userId = participant.userId;\n const member =\n userId !== null &&\n (userId === me || identities.status !== 'ready' || identities.byUserId.has(userId));\n if (!member) return null;\n const answer = freeBusy.byUserId.get(userId);\n if (!answer) return [];\n return personBusySpans(answer, timeZone, owners.has(userId) ? ownTime : null);\n };\n}\n\n/**\n * Loading, ready, or failed: free/busy, who of the people is a member (anyone else has no\n * free/busy, which must never read as free), and the room's bookings when there is a room.\n */\nfunction loadStatus(\n freeBusy: FreeBusyV2,\n identities: Identities,\n rooms: RoomsForEvent,\n hasRoom: boolean\n): FindTimeData['status'] {\n if ([freeBusy.status, identities.status, rooms.status].includes('error')) return 'error';\n const peopleKnown = identities.status === 'ready' || identities.status === 'idle';\n const roomsReady = !hasRoom || rooms.status === 'ready';\n return freeBusy.status === 'ready' && peopleKnown && roomsReady ? 'ready' : 'loading';\n}\n\nfunction useFindTimeData(basis: FindTimeBasis, day: DateValue): FindTimeData {\n const { tr, timeZone, me } = useCalendarPage();\n const event = basis.kind === 'none' ? null : basis.event;\n const participants = useParticipants(basis);\n const userIds = useUserIds(participants);\n const identities = useIdentities(userIds);\n const range = daysToInstants(day, addDays(day, SEARCH_DAYS - 1), timeZone);\n const freeBusy = useFreeBusy(userIds, range.from, range.to);\n const roomId = roomIdOf(basis);\n const rooms = useRoomsForEvent(range.to, { skip: roomId === null });\n const room = findTimeRoomOf(\n roomId,\n rooms,\n bookedRoomNameOf(basis) ?? tr('calendar.v2.theRoom', 'The room'),\n range,\n event?.eventId ?? null\n );\n const myRules: readonly WorkingHoursV2[] | null =\n me && freeBusy.status === 'ready' ? (freeBusy.byUserId.get(me)?.workingHours ?? []) : null;\n return {\n participants,\n busyOf: busyReader(event, me, identities, freeBusy, timeZone),\n room,\n hoursOn: (date) => (myRules ? workingHoursOn(date, myRules, timeZone) : null),\n status: loadStatus(freeBusy, identities, rooms, roomId !== null),\n retry: () => {\n freeBusy.refetch();\n identities.retry();\n rooms.retry();\n },\n truncated: participants.filter(\n (person) => person.userId !== null && freeBusy.byUserId.get(person.userId)?.truncated\n ),\n nameOf: (participant) =>\n participant.userId && participant.userId !== me\n ? (identities.byUserId.get(participant.userId)?.name ?? participant.name)\n : participant.name,\n };\n}\n\n/** \"Priya is busy · Atlas is booked\". */\nfunction useClashWords(data: FindTimeData): (clashes: readonly string[]) => string {\n const { tr, me } = useCalendarPage();\n return (clashes) =>\n clashes\n .map((key) => {\n if (data.room && key === data.room.id) {\n return tr('calendar.v2.ftRoomBooked', '{{room}} is booked', { room: data.room.name });\n }\n if (me && key === `u:${me}`) return tr('calendar.v2.ftYouBusy', 'You’re busy');\n const person = data.participants.find((item) => item.key === key);\n const name = person ? data.nameOf(person) : key;\n return tr('calendar.v2.ftPersonBusy', '{{name}} is busy', {\n name: name.split(' ')[0] ?? name,\n });\n })\n .join(' · ');\n}\n\n/** \"1 h · 4 people and Atlas\". */\nfunction useSubtitle(data: FindTimeData, length: number): string {\n const { tr, durationWords } = useCalendarPage();\n const count = data.participants.length;\n const who =\n count === 1\n ? tr('calendar.v2.peopleOne', '1 person')\n : tr('calendar.v2.peopleMany', '{{count}} people', { count });\n return [\n formatDuration(length, durationWords),\n data.room\n ? tr('calendar.v2.ftWhoAndRoom', '{{who}} and {{room}}', { who, room: data.room.name })\n : who,\n ].join(' · ');\n}\n\nfunction FindTimeReady({ basis, onUse, onBack, onClose }: { basis: FindTimeBasis } & Handlers) {\n const page = useCalendarPage();\n const { tr, timeZone, me } = page;\n const [length, setLength] = useState(() => startLengthOf(basis));\n const [day, setDay] = useState<DateValue>(() => startDayOf(basis, timeZone, page.today));\n const [pick, setPick] = useState<{ date: DateValue; start: number } | null>(null);\n const data = useFindTimeData(basis, day);\n const clashWords = useClashWords(data);\n\n const people: FindTimePerson[] = data.participants.flatMap((person) => {\n const busy = data.busyOf(person);\n return busy === null ? [] : [{ id: person.key, required: person.required, busy }];\n });\n const suggestions: Suggestion[] =\n data.status === 'ready'\n ? suggestTimes({\n day,\n days: SEARCH_DAYS,\n timeZone,\n length,\n now: page.now,\n step: STEP,\n workingHours: data.hoursOn,\n people,\n room: data.room,\n })\n : [];\n const first = suggestions[0];\n const chosen = pick ?? (first ? { date: first.date, start: first.start } : null);\n\n // The picked time's clashes (a time picked on the timeline needn't be a suggestion).\n const pickStart = chosen ? zonedTimeToInstant(chosen.date, chosen.start, timeZone) : null;\n const pickClashes = pickStart\n ? clashesAt(people, data.room, pickStart, new Date(pickStart.getTime() + length * 60_000))\n .clashes\n : [];\n\n const event = basis.kind === 'event' ? basis.event : null;\n const moving =\n event !== null && movesDirectly(event, page.calendarsById.get(event.calendarId), me, timeZone);\n const subtitle = useSubtitle(data, length);\n const leave = () => (onBack ? onBack() : onClose());\n\n return (\n <TabbedDialog open onOpenChange={(open) => (open ? undefined : leave())}>\n <TabbedDialogContent size=\"viewer\" className=\"sm:max-w-[760px]\" aria-describedby={undefined}>\n <FindTimeHeader subtitle={subtitle} />\n <div className=\"min-h-0 flex-1 overflow-y-auto overscroll-contain p-5\">\n <div className=\"flex flex-col gap-5\">\n <FindTimeControls\n length={length}\n onLength={(next) => {\n setLength(next);\n setPick(null);\n }}\n day={day}\n onDay={(next) => {\n setDay(next);\n setPick(null);\n }}\n />\n <SuggestionCards\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={setPick}\n day={day}\n clashWords={clashWords}\n />\n <FindTimeTimeline\n data={data}\n day={day}\n length={length}\n chosen={chosen}\n onPick={(start) => setPick({ date: day, start })}\n />\n </div>\n </div>\n <TabbedDialogFooter className=\"gap-2\">\n <PickSummary\n chosen={chosen}\n length={length}\n ready={data.status === 'ready'}\n clashes={pickClashes}\n clashWords={clashWords}\n />\n <Button type=\"button\" variant=\"outline\" onClick={leave}>\n {onBack ? tr('calendar.v2.ftBack', 'Back') : tr('calendar.v2.evCancel', 'Cancel')}\n </Button>\n <Button\n type=\"button\"\n disabled={!chosen || data.status !== 'ready'}\n onClick={() => (chosen ? onUse({ ...chosen, length }, basis) : undefined)}\n >\n {moving\n ? tr('calendar.v2.ftMoveHere', 'Move the event here')\n : tr('calendar.v2.ftUse', 'Use this time')}\n </Button>\n </TabbedDialogFooter>\n </TabbedDialogContent>\n </TabbedDialog>\n );\n}\n\n/** Length and day. */\nfunction FindTimeControls({\n length,\n onLength,\n day,\n onDay,\n}: {\n length: number;\n onLength: (minutes: number) => void;\n day: DateValue;\n onDay: (day: DateValue) => void;\n}) {\n const page = useCalendarPage();\n const { tr, format, today } = page;\n const lengths = [...new Set([...LENGTH_CHIPS, length])].sort((a, b) => a - b);\n return (\n <div className=\"flex flex-wrap items-end gap-x-6 gap-y-3\">\n {/* Full width on phones, where the chips fill the row (fe-libs' Segmented). */}\n <div className=\"flex flex-col gap-1.5 max-md:w-full\">\n <span id=\"calendar-ft-length\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.evLength', 'Length')}\n </span>\n <Segmented<string>\n aria-labelledby=\"calendar-ft-length\"\n value={String(length)}\n onValueChange={(value) => onLength(Number(value))}\n options={lengths.map((minutes) => ({\n value: String(minutes),\n label: formatDuration(minutes, page.durationWords),\n }))}\n />\n </div>\n <div className=\"flex flex-col gap-1.5\">\n <span id=\"calendar-ft-day\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.day', 'Day')}\n </span>\n <div className=\"flex items-center gap-1.5\" role=\"group\" aria-labelledby=\"calendar-ft-day\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftPrevDay', 'Previous day')}\n disabled={day <= today}\n onClick={() => onDay(addDays(day, -1))}\n >\n <ChevronLeft aria-hidden=\"true\" />\n </Button>\n <DatePicker\n value={day}\n onChange={onDay}\n label={tr('calendar.v2.day', 'Day')}\n weekStartsOn={page.prefs.weekStart}\n locale={format.locale}\n timeZone={page.timeZone}\n min={today}\n format={{ weekday: 'long', day: 'numeric', month: 'short' }}\n />\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"icon-sm\"\n aria-label={tr('calendar.v2.ftNextDay', 'Next day')}\n onClick={() => onDay(addDays(day, 1))}\n >\n <ChevronRight aria-hidden=\"true\" />\n </Button>\n </div>\n </div>\n </div>\n );\n}\n\n/** One suggested time, as a radio card. */\nfunction SuggestionCard({\n suggestion,\n checked,\n onPick,\n clashWords,\n}: {\n suggestion: Suggestion;\n checked: boolean;\n onPick: () => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n return (\n <button\n type=\"button\"\n role=\"radio\"\n aria-checked={checked}\n onClick={onPick}\n className={cn(\n 'flex min-w-0 flex-col gap-1 rounded-card border p-3 text-start motion-safe:transition-colors',\n checked\n ? 'border-action-primary-bg bg-accent-soft shadow-[inset_0_0_0_1px_var(--color-action-primary-bg)]'\n : 'border-border-default bg-bg-surface hover:border-border-strong',\n FOCUS_RING\n )}\n >\n <b className=\"text-sm font-semibold text-text-primary\">\n {formatDay(suggestion.date, format, 'short')} ·{' '}\n {formatMinuteRange(\n suggestion.start,\n instantToZoned(suggestion.endAt, timeZone).minutes,\n format\n )}\n </b>\n {suggestion.clashes.length === 0 ? (\n <span className=\"inline-flex items-center gap-1 text-xs font-semibold text-status-success-text\">\n <CircleCheck className=\"size-3.5\" aria-hidden=\"true\" />\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n ) : (\n <span className=\"inline-flex items-start gap-1 text-xs font-semibold text-status-warning-text\">\n <AlertTriangle className=\"mt-px size-3.5 shrink-0\" aria-hidden=\"true\" />\n {clashWords(suggestion.clashes)}\n </span>\n )}\n </button>\n );\n}\n\n/** The suggested times, or why there are none yet. */\nfunction SuggestionList({\n data,\n suggestions,\n chosen,\n onPick,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr } = useCalendarPage();\n if (data.status === 'error') {\n return (\n <Notice\n tone=\"bad\"\n action={\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={data.retry}>\n {tr('calendar.v2.tryAgain', 'Try again')}\n </Button>\n }\n >\n {tr(\n 'calendar.v2.evFreeBusyFailed',\n 'Couldn’t check who’s free. That isn’t the same as free.'\n )}\n </Notice>\n );\n }\n if (data.status === 'loading') {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr('calendar.v2.ftLooking', 'Looking at everyone’s time…')}\n </p>\n );\n }\n if (suggestions.length === 0) {\n return (\n <p className=\"text-sm text-text-secondary\">\n {tr(\n 'calendar.v2.ftNothing',\n 'No time in your working hours this week. Try a shorter length or another day.'\n )}\n </p>\n );\n }\n return (\n <div\n role=\"radiogroup\"\n aria-labelledby=\"calendar-ft-suggested\"\n className=\"grid gap-2 sm:grid-cols-3\"\n >\n {suggestions.map((suggestion) => (\n <SuggestionCard\n key={`${suggestion.date}|${suggestion.start}`}\n suggestion={suggestion}\n checked={chosen?.date === suggestion.date && chosen.start === suggestion.start}\n onPick={() => onPick({ date: suggestion.date, start: suggestion.start })}\n clashWords={clashWords}\n />\n ))}\n </div>\n );\n}\n\n/** \"Suggested times\", the list, and the notes under it. */\nfunction SuggestionCards({\n data,\n suggestions,\n chosen,\n onPick,\n day,\n clashWords,\n}: {\n data: FindTimeData;\n suggestions: readonly Suggestion[];\n chosen: { date: DateValue; start: number } | null;\n onPick: (pick: { date: DateValue; start: number }) => void;\n day: DateValue;\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format } = useCalendarPage();\n const firstFree = suggestions.find((item) => item.clashes.length === 0);\n const outsiders = data.participants.filter((person) => data.busyOf(person) === null);\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-suggested\" className=\"text-sm font-semibold text-text-primary\">\n {tr('calendar.v2.ftSuggested', 'Suggested times')}\n </span>\n <SuggestionList\n data={data}\n suggestions={suggestions}\n chosen={chosen}\n onPick={onPick}\n clashWords={clashWords}\n />\n {firstFree && firstFree.date !== day ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftLaterDays',\n 'Nothing on {{day}} works for everyone; the first such times are on later days.',\n { day: formatDay(day, format, 'short') }\n )}\n </p>\n ) : null}\n {outsiders.length > 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftOutsiders',\n 'Not counted: {{names}}. People outside the workspace have no free/busy to show.',\n { names: outsiders.map((person) => person.name).join(', ') }\n )}\n </p>\n ) : null}\n {data.truncated.length > 0 ? (\n <p className=\"text-xs text-status-warning-text\">\n {tr(\n 'calendar.v2.ftTruncated',\n 'Some busy time couldn’t all be read for {{names}}: check with them.',\n { names: data.truncated.map((person) => data.nameOf(person)).join(', ') }\n )}\n </p>\n ) : null}\n </div>\n );\n}\n\n/** What a busy block on the timeline says. */\nfunction useBlockWord(): (kind: BusySpan['kind']) => string {\n const { tr } = useCalendarPage();\n return (kind) => {\n switch (kind) {\n case 'away':\n return tr('calendar.v2.evAway', 'Away');\n case 'closed':\n return tr('calendar.v2.roomPaused', 'Closed');\n case 'booked':\n return tr('calendar.v2.ftBooked', 'Booked');\n default:\n return tr('calendar.v2.busy', 'Busy');\n }\n };\n}\n\nconst STRIPES =\n 'bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,var(--color-border-subtle)_6px_9px)]';\n\nconst BLOCK_LOOK: Readonly<Record<BusySpan['kind'], string>> = {\n tentative: 'border-dashed border-border-strong bg-bg-sunken text-text-secondary',\n busy: 'border-border-strong bg-bg-sunken text-text-primary',\n booked: 'border-border-strong bg-bg-sunken text-text-primary',\n away: cn('border-border-strong text-text-secondary', STRIPES),\n closed: cn('border-border-strong text-text-secondary', STRIPES),\n};\n\ninterface TimelineGeometry {\n day: DateValue;\n window: { start: number; end: number };\n /** Where a minute of the day sits across the bar, in percent. */\n pct: (minute: number) => number;\n}\n\n/** One row's bar: off hours striped, busy blocks, the now line and the pick. */\nfunction TimelineBar({\n row,\n spans,\n geometry,\n off,\n chosen,\n length,\n}: {\n /** Its grid row (the slider lies over the bars, so every cell is placed). */\n row: number;\n spans: BusySpan[] | null;\n geometry: TimelineGeometry;\n off: readonly { start: number; end: number }[];\n chosen: { date: DateValue; start: number } | null;\n length: number;\n}) {\n const page = useCalendarPage();\n const { tr, timeZone } = page;\n const blockWord = useBlockWord();\n const { day, window, pct } = geometry;\n const place = (start: number, end: number) => ({\n insetInlineStart: `${pct(start)}%`,\n width: `${pct(end) - pct(start)}%`,\n });\n const blocks = spans\n ? blocksOnDay(spans, day, timeZone).filter(\n (block) => block.end > window.start && block.start < window.end\n )\n : [];\n const showNow =\n day === page.today && page.nowMinute > window.start && page.nowMinute < window.end;\n return (\n <div\n className=\"relative col-start-2 min-h-11 border-b border-border-subtle\"\n style={{ gridRow: row }}\n >\n {off.map((part) => (\n <i\n key={`${part.start}-${part.end}`}\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 bg-[repeating-linear-gradient(135deg,var(--color-bg-sunken)_0_6px,transparent_6px_10px)]\"\n style={place(part.start, part.end)}\n />\n ))}\n {spans === null ? (\n <span className=\"absolute inset-0 grid place-items-center text-xs text-text-secondary\">\n {tr('calendar.v2.evNoFreeBusy', 'No free/busy')}\n </span>\n ) : null}\n {blocks.map((block) => (\n <i\n key={`${block.start}-${block.end}-${block.kind}`}\n aria-hidden=\"true\"\n className={cn(\n 'absolute inset-y-2 overflow-hidden rounded-md border px-1 text-[11px] leading-6 not-italic',\n BLOCK_LOOK[block.kind]\n )}\n style={place(block.start, block.end)}\n >\n {blockWord(block.kind)}\n </i>\n ))}\n {showNow ? (\n <i\n aria-hidden=\"true\"\n className=\"absolute inset-y-0 w-0.5 bg-action-primary-bg\"\n style={{ insetInlineStart: `${pct(page.nowMinute)}%` }}\n />\n ) : null}\n {chosen?.date === day ? (\n <i\n aria-hidden=\"true\"\n className=\"absolute inset-y-1 rounded-md border-2 border-action-primary-bg bg-[color-mix(in_oklab,var(--color-action-primary-bg)_14%,transparent)]\"\n style={place(chosen.start, pickEndClock({ ...chosen, length }, timeZone))}\n />\n ) : null}\n </div>\n );\n}\n\n/** A timeline row's name: an avatar (or a room tile), the name and the role. */\nfunction TimelineName({\n row,\n name,\n role,\n room,\n}: {\n row: number;\n name: string;\n role: string;\n room: boolean;\n}) {\n return (\n <div\n className=\"col-start-1 flex min-w-0 items-center gap-2 border-b border-border-subtle px-3 py-2\"\n style={{ gridRow: row }}\n >\n {room ? (\n <span className=\"grid size-6 shrink-0 place-items-center rounded-md bg-bg-sunken text-text-secondary\">\n <Building2 className=\"size-3.5\" aria-hidden=\"true\" />\n </span>\n ) : (\n <EntityAvatar name={name} size={24} />\n )}\n <span className=\"min-w-0\">\n <b className=\"block truncate text-xs font-semibold text-text-primary\">{name}</b>\n <small className=\"block truncate text-[11px] text-text-secondary\">{role}</small>\n </span>\n </div>\n );\n}\n\n/** The minute a timeline key moves the pick to; null for a key it doesn't take. */\nfunction keyedMinute(\n key: string,\n rtl: boolean,\n value: number,\n window: { start: number; end: number },\n last: number\n): number | null {\n const steps: Readonly<Record<string, number>> = {\n ArrowRight: rtl ? -KEY_STEP : KEY_STEP,\n ArrowLeft: rtl ? KEY_STEP : -KEY_STEP,\n ArrowUp: KEY_STEP,\n ArrowDown: -KEY_STEP,\n PageUp: 60,\n PageDown: -60,\n };\n if (key === 'Home') return window.start;\n if (key === 'End') return last;\n const step = steps[key];\n return step === undefined ? null : Math.max(window.start, Math.min(value + step, last));\n}\n\n/**\n * The day's timeline: a row per person and for the room. Over the bars lies a slider: a click\n * picks the quarter hour under the pointer; the arrow keys move the pick 15 minutes, Page Up and\n * Page Down an hour, Home and End to the ends of the day shown.\n */\nfunction FindTimeTimeline({\n data,\n day,\n length,\n chosen,\n onPick,\n}: {\n data: FindTimeData;\n day: DateValue;\n length: number;\n chosen: { date: DateValue; start: number } | null;\n onPick: (start: number) => void;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n // No time is picked before everyone's busy time is in hand: it would read as free.\n const ready = data.status === 'ready';\n const hours = data.hoursOn(day);\n const window = timelineWindow(hours);\n const geometry: TimelineGeometry = {\n day,\n window,\n pct: (minute) =>\n ((Math.min(Math.max(minute, window.start), window.end) - window.start) /\n (window.end - window.start)) *\n 100,\n };\n const off = offHours(hours).filter((part) => part.end > window.start && part.start < window.end);\n const last = window.end - length;\n const value = chosen?.date === day ? chosen.start : (hours?.start ?? window.start);\n // Hours inside the window: a label at either edge would hang outside it.\n const hourMarks: number[] = [];\n for (let hour = Math.floor(window.start / 60) + 1; hour * 60 < window.end; hour += 1) {\n hourMarks.push(hour);\n }\n const rows = data.participants.map((person) => ({\n key: person.key,\n name: data.nameOf(person),\n role: person.role,\n room: false,\n spans: data.busyOf(person),\n }));\n if (data.room) {\n rows.push({\n key: data.room.id,\n name: data.room.name,\n role: tr('calendar.v2.ftRoom', 'Room'),\n room: true,\n spans: data.room.busy,\n });\n }\n const onClick = (click: MouseEvent<HTMLDivElement>) => {\n const box = click.currentTarget.getBoundingClientRect();\n if (!ready || box.width <= 0) return;\n const rtl = getComputedStyle(click.currentTarget).direction === 'rtl';\n const fraction = (rtl ? box.right - click.clientX : click.clientX - box.left) / box.width;\n onPick(minuteAt(fraction, window, length));\n };\n const onKeyDown = (key: KeyboardEvent<HTMLDivElement>) => {\n const rtl = getComputedStyle(key.currentTarget).direction === 'rtl';\n const next = ready ? keyedMinute(key.key, rtl, value, window, last) : null;\n if (next === null) return;\n key.preventDefault();\n onPick(next);\n };\n return (\n <div className=\"flex flex-col gap-2\">\n <span id=\"calendar-ft-timeline\" className=\"text-sm font-semibold text-text-primary\">\n {formatDay(day, format, 'mid')} · {formatMinuteRange(window.start, window.end, format)}\n </span>\n <div className=\"overflow-x-auto rounded-card border border-border-default bg-bg-surface\">\n <div className=\"grid min-w-[560px] grid-cols-[minmax(120px,160px)_minmax(0,1fr)]\">\n <span className=\"col-start-1 row-start-1 border-b border-border-subtle\" />\n <div\n className=\"relative col-start-2 row-start-1 h-6 border-b border-border-subtle\"\n aria-hidden=\"true\"\n >\n {hourMarks.map((hour) => (\n <span\n key={hour}\n className=\"absolute top-1 -translate-x-1/2 text-[11px] text-text-muted rtl:translate-x-1/2\"\n style={{ insetInlineStart: `${geometry.pct(hour * 60)}%` }}\n >\n {formatMinutes(hour * 60, format)}\n </span>\n ))}\n </div>\n {rows.map((row, index) => (\n <Fragment key={row.key}>\n <TimelineName row={index + 2} name={row.name} role={row.role} room={row.room} />\n <TimelineBar\n row={index + 2}\n spans={row.spans}\n geometry={geometry}\n off={off}\n chosen={chosen}\n length={length}\n />\n </Fragment>\n ))}\n <div\n role=\"slider\"\n tabIndex={0}\n aria-labelledby=\"calendar-ft-timeline\"\n aria-valuemin={window.start}\n aria-valuemax={last}\n aria-valuenow={value}\n aria-valuetext={formatMinuteRange(\n value,\n pickEndClock({ date: day, start: value, length }, timeZone),\n format\n )}\n aria-disabled={ready ? undefined : true}\n onClick={onClick}\n onKeyDown={onKeyDown}\n className={cn(\n 'relative z-10 col-start-2 rounded-md',\n ready ? 'cursor-pointer' : 'cursor-progress',\n FOCUS_RING\n )}\n style={{ gridRow: `2 / span ${rows.length}` }}\n />\n </div>\n </div>\n <p className=\"text-xs text-text-secondary\">\n {tr(\n 'calendar.v2.ftTimelineHint',\n 'Click a free spot, or use the arrow keys, to pick a time. Striped: outside your working hours.'\n )}\n </p>\n </div>\n );\n}\n\n/** The footer's words: the picked time and who can't make it. */\nfunction PickSummary({\n chosen,\n length,\n ready,\n clashes,\n clashWords,\n}: {\n chosen: { date: DateValue; start: number } | null;\n length: number;\n /** Everyone's busy time (and the room's) is in hand; until then nothing is called free. */\n ready: boolean;\n clashes: readonly string[];\n clashWords: (clashes: readonly string[]) => string;\n}) {\n const { tr, format, timeZone } = useCalendarPage();\n if (!chosen) {\n return (\n <span className=\"min-w-0 flex-1 text-xs text-text-secondary max-sm:basis-full\">\n {tr('calendar.v2.ftPick', 'Pick a time')}\n </span>\n );\n }\n let verdict = (\n <span className=\"text-text-secondary\">\n {tr('calendar.v2.ftCheckingFree', 'Checking who’s free…')}\n </span>\n );\n if (ready && clashes.length === 0) {\n verdict = (\n <span className=\"font-semibold text-status-success-text\">\n {tr('calendar.v2.ftEveryoneFree', 'Everyone’s free')}\n </span>\n );\n } else if (ready) {\n verdict = <span className=\"font-semibold text-status-warning-text\">{clashWords(clashes)}</span>;\n }\n return (\n <span className=\"min-w-0 flex-1 text-xs max-sm:basis-full\">\n <span className=\"text-text-secondary\">\n {formatDay(chosen.date, format, 'short')} ·{' '}\n {formatMinuteRange(chosen.start, pickEndClock({ ...chosen, length }, timeZone), format)}{' '}\n ·{' '}\n </span>\n {verdict}\n </span>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AA4FA,IAAMA,IAAc,GAEdC,IAAO,IAEPC,IAAW;AAUjB,SAAgBC,GAAe,EAAE,WAAQ,GAAGC,KAAmD;CAC7F,IAAIC,EAAO,SAAS,QAAQ;EAC1B,IAAMC,IAAuB;GAAE,MAAM;GAAQ,MAAMD,EAAO,QAAQ;GAAM,OAAOA,EAAO;EAAM;EAC5F,OAAO,kBAACE,GAAD;GAAsB;GAAO,GAAIH;EAAW,CAAA;CACrD;CACA,IAAIC,EAAO,SAAS,QAAQ,OAAO,kBAACE,GAAD;EAAe,OAAO,EAAE,MAAM,OAAO;EAAG,GAAIH;CAAW,CAAA;CAC1F,IAAIC,EAAO,OAAO,WAAW,SAAS;EAEpC,IAAMG,IAAQH,EAAO,OAAO;EAC5B,OAAO,kBAACE,GAAD;GAA8B,OAAO;IAAE,MAAM;IAAS;GAAM;GAAG,GAAIH;EAAW,GAA1DI,EAAM,EAAoD;CACvF;CACA,OAAO,kBAACC,IAAD;EAAe,QAAQJ,EAAO;EAAQ,SAASD,EAAS;CAAU,CAAA;AAC3E;AAGA,SAASM,EAAe,EAAE,eAAmC;CAC3D,IAAM,EAAE,UAAOC,EAAgB;CAC/B,OACE,kBAACC,GAAD;EACE,MACE,kBAACC,IAAD;GAAU,MAAK;GAAK,e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EAAG,sBAAsB,aAAa;CACnC,CAAA;CAGV,IAAIyK,IACF,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAzK,EAAG,8BAA8B,sBAAsB;CACpD,CAAA;CAWR,OATI0J,KAASnG,EAAQ,WAAW,IAC9B,IACE,kBAAC,QAAD;EAAM,WAAU;EACb,UAAAvD,EAAG,8BAA8B,iBAAiB;CAC/C,CAAA,IAEC0J,MACT,IAAU,kBAAC,QAAD;EAAM,WAAU;EAA0C,UAAAhF,EAAWnB,CAAO;CAAQ,CAAA,IAG9F,kBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,kBAAC,QAAD;GAAM,WAAU;GAAhB,UAAA;IACG2D,EAAUlC,EAAO,MAAM2B,GAAQ,OAAO;IAAE;IAAG;IAC3CS,EAAkBpC,EAAO,OAAOgE,EAAa;KAAE,GAAGhE;KAAQ;IAAO,GAAGjD,CAAQ,GAAG4E,CAAM;IAAG;IAAI;IAC3F;GACE;EACL,CAAA,GAAA8D,CACG;;AAEV"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { useCalendarPage as e } from "../page/CalendarPageContext.js";
|
|
2
|
+
import { FOCUS_RING as t } from "../styles.js";
|
|
3
|
+
import { anchorOf as n, repeatRuleOf as r } from "./eventForm.js";
|
|
4
|
+
import { Field as i, SoonNote as a } from "./parts.js";
|
|
5
|
+
import { describeRule as o, isMenuValue as s, menuValueOf as c, repeatFor as l, repeatLabel as u } from "./repeatWords.js";
|
|
6
|
+
import { presetRule as d, presetsFor as f } from "./rrule.js";
|
|
7
|
+
import { ChevronDown as p, Repeat as m } from "lucide-react";
|
|
8
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
9
|
+
import { DropdownMenu as _, DropdownMenuContent as v, DropdownMenuRadioGroup as y, DropdownMenuRadioItem as b, DropdownMenuSeparator as x, DropdownMenuTrigger as S } from "@burdenoff/fe-libs/ui";
|
|
10
|
+
import { cn as C } from "@burdenoff/fe-libs/utils";
|
|
11
|
+
// src/v2/event/RepeatField.tsx
|
|
12
|
+
function w({ model: w }) {
|
|
13
|
+
let { tr: T, format: E } = e(), { form: D, update: O, event: k } = w, A = n(D), j = k !== null && !k.isRecurring, M = w.scope === "this", N = w.readOnly || j || M, P = r(D), F = u(D, T, E), I = (j || M) && !w.readOnly ? "calendar-event-repeat-note" : void 0;
|
|
14
|
+
return /* @__PURE__ */ h(i, {
|
|
15
|
+
label: T("calendar.v2.evRepeat", "Repeat"),
|
|
16
|
+
labelId: "calendar-event-repeat-label",
|
|
17
|
+
hint: I && j ? /* @__PURE__ */ h(a, {
|
|
18
|
+
id: I,
|
|
19
|
+
children: T("calendar.v2.rrLockedSingle", "An existing event can’t start repeating yet. Make a new repeating event instead.")
|
|
20
|
+
}) : I ? /* @__PURE__ */ h(a, {
|
|
21
|
+
id: I,
|
|
22
|
+
children: T("calendar.v2.rrLockedDate", "The repeat belongs to the series. To change it, pick This and later events or Every event below.")
|
|
23
|
+
}) : void 0,
|
|
24
|
+
children: /* @__PURE__ */ g(_, { children: [/* @__PURE__ */ h(S, {
|
|
25
|
+
asChild: !0,
|
|
26
|
+
disabled: N,
|
|
27
|
+
children: /* @__PURE__ */ g("button", {
|
|
28
|
+
type: "button",
|
|
29
|
+
"aria-labelledby": "calendar-event-repeat-label calendar-event-repeat-value",
|
|
30
|
+
"aria-describedby": I,
|
|
31
|
+
className: C("flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-60", t),
|
|
32
|
+
children: [
|
|
33
|
+
/* @__PURE__ */ h(m, {
|
|
34
|
+
className: "size-4 shrink-0 text-text-muted",
|
|
35
|
+
"aria-hidden": "true"
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ h("span", {
|
|
38
|
+
id: "calendar-event-repeat-value",
|
|
39
|
+
className: "min-w-0 flex-1 truncate",
|
|
40
|
+
children: F
|
|
41
|
+
}),
|
|
42
|
+
/* @__PURE__ */ h(p, {
|
|
43
|
+
className: "size-4 shrink-0 text-text-muted",
|
|
44
|
+
"aria-hidden": "true"
|
|
45
|
+
})
|
|
46
|
+
]
|
|
47
|
+
})
|
|
48
|
+
}), /* @__PURE__ */ h(v, {
|
|
49
|
+
align: "start",
|
|
50
|
+
className: "w-[min(22rem,calc(100vw-2rem))]",
|
|
51
|
+
children: /* @__PURE__ */ g(y, {
|
|
52
|
+
value: c(D.repeat),
|
|
53
|
+
onValueChange: (e) => {
|
|
54
|
+
s(e) && O((t) => ({
|
|
55
|
+
...t,
|
|
56
|
+
repeat: l(e, t)
|
|
57
|
+
}));
|
|
58
|
+
},
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ h(b, {
|
|
61
|
+
value: "none",
|
|
62
|
+
disabled: k?.isRecurring === !0,
|
|
63
|
+
children: /* @__PURE__ */ g("span", {
|
|
64
|
+
className: "flex flex-col",
|
|
65
|
+
children: [T("calendar.v2.rrNone", "Doesn’t repeat"), k?.isRecurring ? /* @__PURE__ */ h("span", {
|
|
66
|
+
className: "text-xs text-text-secondary",
|
|
67
|
+
children: T("calendar.v2.rrCantStop", "A series can’t stop repeating here yet.")
|
|
68
|
+
}) : null]
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
f(A).map((e) => /* @__PURE__ */ h(b, {
|
|
72
|
+
value: e,
|
|
73
|
+
children: o(d(e, A), A, T, E)
|
|
74
|
+
}, e)),
|
|
75
|
+
D.repeat.kind === "kept" ? /* @__PURE__ */ h(b, {
|
|
76
|
+
value: "kept",
|
|
77
|
+
children: T("calendar.v2.rrKept", "A rule from another app (kept)")
|
|
78
|
+
}) : null,
|
|
79
|
+
/* @__PURE__ */ h(x, {}),
|
|
80
|
+
/* @__PURE__ */ h(b, {
|
|
81
|
+
value: "custom",
|
|
82
|
+
children: D.repeat.kind === "custom" && P ? o(P, A, T, E) : T("calendar.v2.rrCustom", "Custom…")
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
})
|
|
86
|
+
})] })
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { w as RepeatField };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=RepeatField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RepeatField.js","names":["RepeatField","useCalendarPage","model","anchor","anchorOf","form","existingSingle","event","oneDate","locked","rule","repeatRuleOf","label","repeatLabel","tr","format","noteId","Field","SoonNote","DropdownMenu","DropdownMenuTrigger","cn","FOCUS_RING","Repeat","ChevronDown","DropdownMenuContent","DropdownMenuRadioGroup","menuValueOf","isMenuValue","value","update","current","repeatFor","DropdownMenuRadioItem","presetsFor","preset","describeRule","presetRule","DropdownMenuSeparator"],"sources":["../../../src/v2/event/RepeatField.tsx"],"sourcesContent":["/**\n * Repeat (BOFF-15698 A2): the menu (doesn't repeat, daily, weekly on the day, monthly on the\n * nth or last weekday, yearly, every weekday, Custom…). The Custom builder is `CustomRepeat`;\n * the rule is written by `rrule.ts`.\n *\n * The API can't turn an existing event into a series or a series back into one event\n * (`UpdateEventInput` has no `isRecurring`, B7): an existing event that doesn't repeat keeps\n * the menu locked, and a series can change its rule but not stop repeating. One date of a series\n * changed on its own (\"This event\", A4) doesn't repeat by itself: the menu shows the series'\n * rule, locked, while that is the answer.\n */\nimport { ChevronDown, Repeat } from 'lucide-react';\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuRadioGroup,\n DropdownMenuRadioItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from '@burdenoff/fe-libs/ui';\nimport { cn } from '@burdenoff/fe-libs/utils';\nimport { useCalendarPage } from '../page/CalendarPageContext';\nimport { FOCUS_RING } from '../styles';\nimport type { EventDialogModel } from './dialogModel';\nimport { anchorOf, repeatRuleOf } from './eventForm';\nimport { Field, SoonNote } from './parts';\nimport { describeRule, isMenuValue, menuValueOf, repeatFor, repeatLabel } from './repeatWords';\nimport { presetRule, presetsFor } from './rrule';\n\n/** The Repeat menu. */\nexport function RepeatField({ model }: { model: EventDialogModel }) {\n const page = useCalendarPage();\n const { tr, format } = page;\n const { form, update, event } = model;\n const anchor = anchorOf(form);\n const existingSingle = event !== null && !event.isRecurring;\n const oneDate = model.scope === 'this';\n const locked = model.readOnly || existingSingle || oneDate;\n const rule = repeatRuleOf(form);\n const label = repeatLabel(form, tr, format);\n const noteId =\n (existingSingle || oneDate) && !model.readOnly ? 'calendar-event-repeat-note' : undefined;\n return (\n <Field\n label={tr('calendar.v2.evRepeat', 'Repeat')}\n labelId=\"calendar-event-repeat-label\"\n hint={\n noteId && existingSingle ? (\n <SoonNote id={noteId}>\n {tr(\n 'calendar.v2.rrLockedSingle',\n 'An existing event can’t start repeating yet. Make a new repeating event instead.'\n )}\n </SoonNote>\n ) : noteId ? (\n <SoonNote id={noteId}>\n {tr(\n 'calendar.v2.rrLockedDate',\n 'The repeat belongs to the series. To change it, pick This and later events or Every event below.'\n )}\n </SoonNote>\n ) : undefined\n }\n >\n <DropdownMenu>\n <DropdownMenuTrigger asChild disabled={locked}>\n <button\n type=\"button\"\n aria-labelledby=\"calendar-event-repeat-label calendar-event-repeat-value\"\n aria-describedby={noteId}\n className={cn(\n 'flex h-10 w-full items-center gap-2 rounded-input border border-border-default bg-bg-surface px-3 text-start text-sm text-text-primary hover:border-border-strong disabled:cursor-not-allowed disabled:opacity-60',\n FOCUS_RING\n )}\n >\n <Repeat className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n <span id=\"calendar-event-repeat-value\" className=\"min-w-0 flex-1 truncate\">\n {label}\n </span>\n <ChevronDown className=\"size-4 shrink-0 text-text-muted\" aria-hidden=\"true\" />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"start\" className=\"w-[min(22rem,calc(100vw-2rem))]\">\n <DropdownMenuRadioGroup\n value={menuValueOf(form.repeat)}\n onValueChange={(value) => {\n if (isMenuValue(value)) {\n update((current) => ({ ...current, repeat: repeatFor(value, current) }));\n }\n }}\n >\n <DropdownMenuRadioItem value=\"none\" disabled={event?.isRecurring === true}>\n <span className=\"flex flex-col\">\n {tr('calendar.v2.rrNone', 'Doesn’t repeat')}\n {event?.isRecurring ? (\n <span className=\"text-xs text-text-secondary\">\n {tr('calendar.v2.rrCantStop', 'A series can’t stop repeating here yet.')}\n </span>\n ) : null}\n </span>\n </DropdownMenuRadioItem>\n {presetsFor(anchor).map((preset) => (\n <DropdownMenuRadioItem key={preset} value={preset}>\n {describeRule(presetRule(preset, anchor), anchor, tr, format)}\n </DropdownMenuRadioItem>\n ))}\n {form.repeat.kind === 'kept' ? (\n <DropdownMenuRadioItem value=\"kept\">\n {tr('calendar.v2.rrKept', 'A rule from another app (kept)')}\n </DropdownMenuRadioItem>\n ) : null}\n <DropdownMenuSeparator />\n <DropdownMenuRadioItem value=\"custom\">\n {form.repeat.kind === 'custom' && rule\n ? describeRule(rule, anchor, tr, format)\n : tr('calendar.v2.rrCustom', 'Custom…')}\n </DropdownMenuRadioItem>\n </DropdownMenuRadioGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n </Field>\n );\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBA,EAAY,EAAE,YAAsC;CAElE,IAAM,EAAE,OAAI,cADCC,EACU,GACjB,EAAE,SAAM,WAAQ,aAAUC,GAC1BC,IAASC,EAASC,CAAI,GACtBC,IAAiBC,MAAU,QAAQ,CAACA,EAAM,aAC1CC,IAAUN,EAAM,UAAU,QAC1BO,IAASP,EAAM,YAAYI,KAAkBE,GAC7CE,IAAOC,EAAaN,CAAI,GACxBO,IAAQC,EAAYR,GAAMS,GAAIC,CAAM,GACpCC,KACHV,KAAkBE,MAAY,CAACN,EAAM,WAAW,+BAA+B,KAAA;CAClF,OACE,kBAACe,GAAD;EACE,OAAOH,EAAG,wBAAwB,QAAQ;EAC1C,SAAQ;EACR,MACEE,KAAUV,IACR,kBAACY,GAAD;GAAU,IAAIF;GACX,UAAAF,EACC,8BACA,kFACF;EACQ,C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UAAAnB,EAAG,sBAAsB,gCAAgC;KACrC,CAAA,IACrB;KACJ,kBAACwB,GAAD,CAAwB,CAAA;KACxB,kBAACL,GAAD;MAAuB,OAAM;MAC1B,UAAA5B,EAAK,OAAO,SAAS,YAAYK,IAC9B0B,EAAa1B,GAAMP,GAAQW,GAAIC,CAAM,IACrCD,EAAG,wBAAwB,SAAS;KACnB,CAAA;IACD;;EACL,CAAA,CACT,EAAA,CAAA;CACT,CAAA;AAEX"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Tr } from '../data/useEventActions';
|
|
2
|
+
import { CalendarFormat } from '../format';
|
|
3
|
+
import { CalendarEventV2, CalendarV2, PersonFreeBusyV2 } from '../types';
|
|
4
|
+
import { EventTab, PersonStatus } from './dialogModel';
|
|
5
|
+
import { EventForm, FormIssues } from './eventForm';
|
|
6
|
+
import { RoomState } from './place';
|
|
7
|
+
import { EditedEvent } from './useEventData';
|
|
8
|
+
export declare const TITLE_INPUT_ID = "calendar-event-title";
|
|
9
|
+
export declare const VIDEO_INPUT_ID = "calendar-event-video";
|
|
10
|
+
/** The tab where a problem is named, and the field to focus. */
|
|
11
|
+
export declare function issueTarget(issues: FormIssues): {
|
|
12
|
+
tab: EventTab;
|
|
13
|
+
field: string | null;
|
|
14
|
+
} | null;
|
|
15
|
+
/** What free/busy has said about one person so far. */
|
|
16
|
+
export type FreeBusyAnswer = {
|
|
17
|
+
kind: 'loading';
|
|
18
|
+
} | {
|
|
19
|
+
kind: 'error';
|
|
20
|
+
} | {
|
|
21
|
+
kind: 'ready';
|
|
22
|
+
person: PersonFreeBusyV2 | undefined;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A person's time while the event happens. `exclude`: the event's own time, which keeps its
|
|
26
|
+
* organiser and its guests busy and mustn't count against it. On an all-day event only time off
|
|
27
|
+
* counts.
|
|
28
|
+
*/
|
|
29
|
+
export declare function statusFrom(answer: FreeBusyAnswer, event: {
|
|
30
|
+
start: Date;
|
|
31
|
+
end: Date;
|
|
32
|
+
allDay: boolean;
|
|
33
|
+
}, timeZone: string, exclude: {
|
|
34
|
+
start: Date;
|
|
35
|
+
end: Date;
|
|
36
|
+
} | null): PersonStatus;
|
|
37
|
+
/** "Friday 20 Nov · 13:00 – 14:00 · Acme rollout check-in". */
|
|
38
|
+
export declare function headerDescription(form: EventForm, tr: Tr, format: CalendarFormat): string;
|
|
39
|
+
/** The dialog's title: a new event, an edit (a new event that saved in part too), or a locked one. */
|
|
40
|
+
export declare function dialogHeading(eventId: string | null, readOnly: boolean, tr: Tr): string;
|
|
41
|
+
/** Why the person can't change an event: a followed calendar, or someone else organises it. */
|
|
42
|
+
export declare function lockReason(event: Pick<CalendarEventV2, 'guests'>, calendar: Pick<CalendarV2, 'isReadOnly' | 'name'> | undefined, organizerName: string | null, tr: Tr): string;
|
|
43
|
+
export interface FooterNote {
|
|
44
|
+
tone: 'info' | 'warn' | 'bad';
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
export interface FooterFacts {
|
|
48
|
+
/** A save was tried and something stops it. */
|
|
49
|
+
blocked: boolean;
|
|
50
|
+
/** No calendar to put a new event on. */
|
|
51
|
+
noCalendar: boolean;
|
|
52
|
+
title: string;
|
|
53
|
+
room: {
|
|
54
|
+
name: string;
|
|
55
|
+
state: RoomState | null;
|
|
56
|
+
needsApproval: boolean;
|
|
57
|
+
} | null;
|
|
58
|
+
/** The person is busy or away then. */
|
|
59
|
+
busy: boolean;
|
|
60
|
+
guestCount: number;
|
|
61
|
+
}
|
|
62
|
+
/** The footer's note: what stops a save, else a warning, else the guests and the room. */
|
|
63
|
+
export declare function footerNote(facts: FooterFacts, tr: Tr): FooterNote;
|
|
64
|
+
/**
|
|
65
|
+
* Where reading the edited event back stands: null once the dialog holds it as the service has
|
|
66
|
+
* it now; else reading it (first, or again after a save), it couldn't be read, or it is gone.
|
|
67
|
+
* Nothing saves until it is null: a save planned on an older copy would send again what saved.
|
|
68
|
+
*/
|
|
69
|
+
export type ReadBack = 'loading' | 'failed' | 'missing';
|
|
70
|
+
export declare function readBackOf(edited: {
|
|
71
|
+
status: Exclude<EditedEvent['status'], 'ready'>;
|
|
72
|
+
} | {
|
|
73
|
+
status: 'ready';
|
|
74
|
+
refresh: Extract<EditedEvent, {
|
|
75
|
+
status: 'ready';
|
|
76
|
+
}>['refresh'];
|
|
77
|
+
}): ReadBack | null;
|
|
78
|
+
/**
|
|
79
|
+
* What the person's changes are told from (A4): the form as the dialog opened, or once a save
|
|
80
|
+
* stopped part way (`partlySaved`), the event as read back, which holds what saved. Told from
|
|
81
|
+
* the form as it opened, Save again would move a series (or the later part of one) a second
|
|
82
|
+
* time, and take a repeat or room that didn't save for one that did.
|
|
83
|
+
*/
|
|
84
|
+
export declare function baselineOf(session: {
|
|
85
|
+
initial: EventForm;
|
|
86
|
+
partlySaved: boolean;
|
|
87
|
+
}, edited: EditedEvent, timeZone: string): EventForm;
|
|
88
|
+
/** The footer while the edited event is read back: reading, or it can't be. */
|
|
89
|
+
export declare function reloadNote(readBack: ReadBack, tr: Tr): FooterNote;
|
|
90
|
+
/** The part of a busy span inside the event, on the calendar's clock: "13:00 – 13:30". */
|
|
91
|
+
export declare function overlapWords(span: {
|
|
92
|
+
start: number;
|
|
93
|
+
end: number;
|
|
94
|
+
}, event: {
|
|
95
|
+
start: Date;
|
|
96
|
+
end: Date;
|
|
97
|
+
}, timeZone: string, format: CalendarFormat): string;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { formatDay as e, formatInstantRange as t } from "../format.js";
|
|
2
|
+
import { endInstant as n, firstDayOf as r, formFromEvent as i, startInstant as a } from "./eventForm.js";
|
|
3
|
+
import { busyDuring as o, personBusySpans as s } from "./findTime.js";
|
|
4
|
+
// src/v2/event/dialogLogic.ts
|
|
5
|
+
var c = "calendar-event-title", l = "calendar-event-video";
|
|
6
|
+
function u(e) {
|
|
7
|
+
return e.title || e.when || e.repeat ? {
|
|
8
|
+
tab: "details",
|
|
9
|
+
field: e.title ? c : null
|
|
10
|
+
} : e.video ? {
|
|
11
|
+
tab: "place",
|
|
12
|
+
field: l
|
|
13
|
+
} : null;
|
|
14
|
+
}
|
|
15
|
+
function d(e, t, n, r) {
|
|
16
|
+
if (e.kind === "loading") return {
|
|
17
|
+
kind: "loading",
|
|
18
|
+
span: null,
|
|
19
|
+
truncated: !1
|
|
20
|
+
};
|
|
21
|
+
if (e.kind === "error") return {
|
|
22
|
+
kind: "error",
|
|
23
|
+
span: null,
|
|
24
|
+
truncated: !1
|
|
25
|
+
};
|
|
26
|
+
if (!e.person) return {
|
|
27
|
+
kind: "free",
|
|
28
|
+
span: null,
|
|
29
|
+
truncated: !1
|
|
30
|
+
};
|
|
31
|
+
let i = s(e.person, n, r).filter((e) => !t.allDay || e.kind === "away"), a = o(i, t.start, t.end), c = e.person.truncated;
|
|
32
|
+
return a ? {
|
|
33
|
+
kind: a.kind === "away" ? "away" : a.kind === "tentative" ? "tentative" : "busy",
|
|
34
|
+
span: a,
|
|
35
|
+
truncated: c
|
|
36
|
+
} : {
|
|
37
|
+
kind: "free",
|
|
38
|
+
span: null,
|
|
39
|
+
truncated: c
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function f(i, o, s) {
|
|
43
|
+
let c = e(r(i), s, "mid"), l = t(a(i), n(i), i.timeZone, s);
|
|
44
|
+
return i.allDay && (l = i.lastDay > i.firstDay ? o("calendar.v2.evUntilDay", "until {{day}}", { day: e(i.lastDay, s, "short") }) : o("calendar.v2.allDayLower", "all day")), [
|
|
45
|
+
c,
|
|
46
|
+
l,
|
|
47
|
+
i.title.trim()
|
|
48
|
+
].filter(Boolean).join(" · ");
|
|
49
|
+
}
|
|
50
|
+
function p(e, t, n) {
|
|
51
|
+
return t ? n("calendar.v2.evViewTitle", "Event") : e ? n("calendar.v2.evEditTitle", "Edit event") : n("calendar.v2.newEvent", "New event");
|
|
52
|
+
}
|
|
53
|
+
function m(e, t, n, r) {
|
|
54
|
+
if (t?.isReadOnly) return r("calendar.v2.lockedFollowed", "It comes from {{calendar}}, a calendar you follow. Change it where it lives.", { calendar: t.name });
|
|
55
|
+
let i = n ?? e.guests.find((e) => e.organizer)?.name ?? null;
|
|
56
|
+
return i ? r("calendar.v2.lockedOrganiser", "Only {{name}}, the organiser, can change this event.", { name: i }) : r("calendar.v2.lockedOrganiserOnly", "Only the organiser can change this event.");
|
|
57
|
+
}
|
|
58
|
+
function h(e, t) {
|
|
59
|
+
let n = e.room;
|
|
60
|
+
if (e.blocked) return {
|
|
61
|
+
tone: "bad",
|
|
62
|
+
text: e.noCalendar ? t("calendar.v2.noWritableCalendar", "You don’t have a calendar you can add events to.") : t("calendar.v2.evFixToSave", "Fix what’s marked to save.")
|
|
63
|
+
};
|
|
64
|
+
if (!e.title) return {
|
|
65
|
+
tone: "info",
|
|
66
|
+
text: t("calendar.v2.evAddTitleToSave", "Add a title to save")
|
|
67
|
+
};
|
|
68
|
+
if (n?.state?.kind === "booked") return {
|
|
69
|
+
tone: "warn",
|
|
70
|
+
text: t("calendar.v2.evRoomBookedThen", "{{room}} is booked then", { room: n.name })
|
|
71
|
+
};
|
|
72
|
+
if (n?.state?.kind === "closed") return {
|
|
73
|
+
tone: "warn",
|
|
74
|
+
text: t("calendar.v2.evRoomClosedThen", "{{room}} is closed", { room: n.name })
|
|
75
|
+
};
|
|
76
|
+
if (e.busy) return {
|
|
77
|
+
tone: "warn",
|
|
78
|
+
text: t("calendar.v2.evYouBusyThen", "You’re busy then")
|
|
79
|
+
};
|
|
80
|
+
if (n?.needsApproval) return {
|
|
81
|
+
tone: "info",
|
|
82
|
+
text: t("calendar.v2.evRoomNeedsApproval", "{{room}} needs approval", { room: n.name })
|
|
83
|
+
};
|
|
84
|
+
let r = e.guestCount === 1 ? t("calendar.v2.evOneGuest", "1 guest") : t("calendar.v2.evGuestCount", "{{count}} guests", { count: e.guestCount });
|
|
85
|
+
return {
|
|
86
|
+
tone: "info",
|
|
87
|
+
text: n ? `${r} · ${n.name}` : r
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function g(e) {
|
|
91
|
+
switch (e.status) {
|
|
92
|
+
case "none": return null;
|
|
93
|
+
case "loading": return "loading";
|
|
94
|
+
case "missing": return "missing";
|
|
95
|
+
case "error": return "failed";
|
|
96
|
+
case "ready": return e.refresh === "current" ? null : e.refresh;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function _(e, t, n) {
|
|
100
|
+
return !e.partlySaved || t.status !== "ready" || t.refresh !== "current" ? e.initial : i(t.event, n);
|
|
101
|
+
}
|
|
102
|
+
function v(e, t) {
|
|
103
|
+
return e === "loading" ? {
|
|
104
|
+
tone: "info",
|
|
105
|
+
text: t("calendar.v2.evReloading", "Reading the saved event…")
|
|
106
|
+
} : e === "missing" ? {
|
|
107
|
+
tone: "bad",
|
|
108
|
+
text: t("calendar.v2.evSavedGoneShort", "The event isn’t available.")
|
|
109
|
+
} : {
|
|
110
|
+
tone: "bad",
|
|
111
|
+
text: t("calendar.v2.evReloadFailed", "Couldn’t read the saved event.")
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function y(e, n, r, i) {
|
|
115
|
+
let a = new Date(Math.max(e.start, n.start.getTime())), o = new Date(Math.min(e.end, n.end.getTime()));
|
|
116
|
+
return t(a, o, r, i);
|
|
117
|
+
}
|
|
118
|
+
export { c as TITLE_INPUT_ID, l as VIDEO_INPUT_ID, _ as baselineOf, p as dialogHeading, h as footerNote, f as headerDescription, u as issueTarget, m as lockReason, y as overlapWords, g as readBackOf, v as reloadNote, d as statusFrom };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=dialogLogic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogLogic.js","names":["TITLE_INPUT_ID","VIDEO_INPUT_ID","issueTarget","issues","statusFrom","answer","spans","personBusySpans","timeZone","exclude","event","span","busyDuring","truncated","headerDescription","day","formatDay","firstDayOf","form","format","when","formatInstantRange","startInstant","endInstant","tr","dialogHeading","readOnly","eventId","lockReason","calendar","name","organizerName","guest","footerNote","room","facts","guests","readBackOf","edited","baselineOf","session","formFromEvent","reloadNote","readBack","overlapWords","from","to"],"sources":["../../../src/v2/event/dialogLogic.ts"],"sourcesContent":["/**\n * The event dialog's decisions that don't need React (BOFF-15698 A2): each person's time while\n * the event happens, where a problem is named, and the words of the header, the lock and the\n * footer. Pure.\n */\nimport type { Tr } from '../data/useEventActions';\nimport { formatDay, formatInstantRange, type CalendarFormat } from '../format';\nimport type { CalendarEventV2, CalendarV2, PersonFreeBusyV2 } from '../types';\nimport type { EventTab, PersonStatus } from './dialogModel';\nimport {\n endInstant,\n firstDayOf,\n formFromEvent,\n startInstant,\n type EventForm,\n type FormIssues,\n} from './eventForm';\nimport { busyDuring, personBusySpans } from './findTime';\nimport type { RoomState } from './place';\nimport type { EditedEvent } from './useEventData';\n\nexport const TITLE_INPUT_ID = 'calendar-event-title';\nexport const VIDEO_INPUT_ID = 'calendar-event-video';\n\n/** The tab where a problem is named, and the field to focus. */\nexport function issueTarget(issues: FormIssues): { tab: EventTab; field: string | null } | null {\n if (issues.title || issues.when || issues.repeat) {\n return { tab: 'details', field: issues.title ? TITLE_INPUT_ID : null };\n }\n if (issues.video) return { tab: 'place', field: VIDEO_INPUT_ID };\n return null;\n}\n\n/** What free/busy has said about one person so far. */\nexport type FreeBusyAnswer =\n { kind: 'loading' } | { kind: 'error' } | { kind: 'ready'; person: PersonFreeBusyV2 | undefined };\n\n/**\n * A person's time while the event happens. `exclude`: the event's own time, which keeps its\n * organiser and its guests busy and mustn't count against it. On an all-day event only time off\n * counts.\n */\nexport function statusFrom(\n answer: FreeBusyAnswer,\n event: { start: Date; end: Date; allDay: boolean },\n timeZone: string,\n exclude: { start: Date; end: Date } | null\n): PersonStatus {\n if (answer.kind === 'loading') return { kind: 'loading', span: null, truncated: false };\n if (answer.kind === 'error') return { kind: 'error', span: null, truncated: false };\n if (!answer.person) return { kind: 'free', span: null, truncated: false };\n const spans = personBusySpans(answer.person, timeZone, exclude).filter(\n (span) => !event.allDay || span.kind === 'away'\n );\n const span = busyDuring(spans, event.start, event.end);\n const truncated = answer.person.truncated;\n if (!span) return { kind: 'free', span: null, truncated };\n const kind = span.kind === 'away' ? 'away' : span.kind === 'tentative' ? 'tentative' : 'busy';\n return { kind, span, truncated };\n}\n\n/** \"Friday 20 Nov · 13:00 – 14:00 · Acme rollout check-in\". */\nexport function headerDescription(form: EventForm, tr: Tr, format: CalendarFormat): string {\n const day = formatDay(firstDayOf(form), format, 'mid');\n let when = formatInstantRange(startInstant(form), endInstant(form), form.timeZone, format);\n if (form.allDay) {\n when =\n form.lastDay > form.firstDay\n ? tr('calendar.v2.evUntilDay', 'until {{day}}', {\n day: formatDay(form.lastDay, format, 'short'),\n })\n : tr('calendar.v2.allDayLower', 'all day');\n }\n return [day, when, form.title.trim()].filter(Boolean).join(' · ');\n}\n\n/** The dialog's title: a new event, an edit (a new event that saved in part too), or a locked one. */\nexport function dialogHeading(eventId: string | null, readOnly: boolean, tr: Tr): string {\n if (readOnly) return tr('calendar.v2.evViewTitle', 'Event');\n return eventId\n ? tr('calendar.v2.evEditTitle', 'Edit event')\n : tr('calendar.v2.newEvent', 'New event');\n}\n\n/** Why the person can't change an event: a followed calendar, or someone else organises it. */\nexport function lockReason(\n event: Pick<CalendarEventV2, 'guests'>,\n calendar: Pick<CalendarV2, 'isReadOnly' | 'name'> | undefined,\n organizerName: string | null,\n tr: Tr\n): string {\n if (calendar?.isReadOnly) {\n return tr(\n 'calendar.v2.lockedFollowed',\n 'It comes from {{calendar}}, a calendar you follow. Change it where it lives.',\n { calendar: calendar.name }\n );\n }\n const name = organizerName ?? event.guests.find((guest) => guest.organizer)?.name ?? null;\n return name\n ? tr('calendar.v2.lockedOrganiser', 'Only {{name}}, the organiser, can change this event.', {\n name,\n })\n : tr('calendar.v2.lockedOrganiserOnly', 'Only the organiser can change this event.');\n}\n\nexport interface FooterNote {\n tone: 'info' | 'warn' | 'bad';\n text: string;\n}\n\nexport interface FooterFacts {\n /** A save was tried and something stops it. */\n blocked: boolean;\n /** No calendar to put a new event on. */\n noCalendar: boolean;\n title: string;\n room: { name: string; state: RoomState | null; needsApproval: boolean } | null;\n /** The person is busy or away then. */\n busy: boolean;\n guestCount: number;\n}\n\n/** The footer's note: what stops a save, else a warning, else the guests and the room. */\nexport function footerNote(facts: FooterFacts, tr: Tr): FooterNote {\n const room = facts.room;\n if (facts.blocked) {\n return {\n tone: 'bad',\n text: facts.noCalendar\n ? tr('calendar.v2.noWritableCalendar', 'You don’t have a calendar you can add events to.')\n : tr('calendar.v2.evFixToSave', 'Fix what’s marked to save.'),\n };\n }\n if (!facts.title) {\n return { tone: 'info', text: tr('calendar.v2.evAddTitleToSave', 'Add a title to save') };\n }\n if (room?.state?.kind === 'booked') {\n return {\n tone: 'warn',\n text: tr('calendar.v2.evRoomBookedThen', '{{room}} is booked then', { room: room.name }),\n };\n }\n if (room?.state?.kind === 'closed') {\n return {\n tone: 'warn',\n text: tr('calendar.v2.evRoomClosedThen', '{{room}} is closed', { room: room.name }),\n };\n }\n if (facts.busy)\n return { tone: 'warn', text: tr('calendar.v2.evYouBusyThen', 'You’re busy then') };\n if (room?.needsApproval) {\n return {\n tone: 'info',\n text: tr('calendar.v2.evRoomNeedsApproval', '{{room}} needs approval', { room: room.name }),\n };\n }\n const guests =\n facts.guestCount === 1\n ? tr('calendar.v2.evOneGuest', '1 guest')\n : tr('calendar.v2.evGuestCount', '{{count}} guests', { count: facts.guestCount });\n return { tone: 'info', text: room ? `${guests} · ${room.name}` : guests };\n}\n\n/**\n * Where reading the edited event back stands: null once the dialog holds it as the service has\n * it now; else reading it (first, or again after a save), it couldn't be read, or it is gone.\n * Nothing saves until it is null: a save planned on an older copy would send again what saved.\n */\nexport type ReadBack = 'loading' | 'failed' | 'missing';\n\nexport function readBackOf(\n edited:\n | { status: Exclude<EditedEvent['status'], 'ready'> }\n | { status: 'ready'; refresh: Extract<EditedEvent, { status: 'ready' }>['refresh'] }\n): ReadBack | null {\n switch (edited.status) {\n case 'none':\n return null;\n case 'loading':\n return 'loading';\n case 'missing':\n return 'missing';\n case 'error':\n return 'failed';\n case 'ready':\n return edited.refresh === 'current' ? null : edited.refresh;\n }\n}\n\n/**\n * What the person's changes are told from (A4): the form as the dialog opened, or once a save\n * stopped part way (`partlySaved`), the event as read back, which holds what saved. Told from\n * the form as it opened, Save again would move a series (or the later part of one) a second\n * time, and take a repeat or room that didn't save for one that did.\n */\nexport function baselineOf(\n session: { initial: EventForm; partlySaved: boolean },\n edited: EditedEvent,\n timeZone: string\n): EventForm {\n if (!session.partlySaved || edited.status !== 'ready' || edited.refresh !== 'current') {\n return session.initial;\n }\n return formFromEvent(edited.event, timeZone);\n}\n\n/** The footer while the edited event is read back: reading, or it can't be. */\nexport function reloadNote(readBack: ReadBack, tr: Tr): FooterNote {\n if (readBack === 'loading') {\n return { tone: 'info', text: tr('calendar.v2.evReloading', 'Reading the saved event…') };\n }\n return readBack === 'missing'\n ? { tone: 'bad', text: tr('calendar.v2.evSavedGoneShort', 'The event isn’t available.') }\n : { tone: 'bad', text: tr('calendar.v2.evReloadFailed', 'Couldn’t read the saved event.') };\n}\n\n/** The part of a busy span inside the event, on the calendar's clock: \"13:00 – 13:30\". */\nexport function overlapWords(\n span: { start: number; end: number },\n event: { start: Date; end: Date },\n timeZone: string,\n format: CalendarFormat\n): string {\n const from = new Date(Math.max(span.start, event.start.getTime()));\n const to = new Date(Math.min(span.end, event.end.getTime()));\n return formatInstantRange(from, to, timeZone, format);\n}\n"],"mappings":";;;;AAqBA,IAAaA,IAAiB,wBACjBC,IAAiB;AAG9B,SAAgBC,EAAY,GAAoE;CAK9F,OAJIC,EAAO,SAASA,EAAO,QAAQA,EAAO,SACjC;EAAE,KAAK;EAAW,OAAOA,EAAO,QAAQH,IAAiB;CAAK,IAEnEG,EAAO,QAAc;EAAE,KAAK;EAAS,OAAOF;CAAe,IACxD;AACT;AAWA,SAAgBG,EACd,GACA,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BC,EACd,GAGiB;CACjB,QAAQC,EAAO,QAAf;EACE,KAAK,QACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,KAAK,SACH,OAAOA,EAAO,YAAY,YAAY,OAAOA,EAAO;CACxD;AACF;AAQA,SAAgBC,EACd,GACA,GACA,GACW;CAIX,OAHI,CAACC,EAAQ,eAAeF,EAAO,WAAW,WAAWA,EAAO,YAAY,YACnEE,EAAQ,UAEVC,EAAcH,EAAO,OAAO9B,CAAQ;AAC7C;AAGA,SAAgBkC,EAAW,GAAoB,GAAoB;CAIjE,OAHIC,MAAa,YACR;EAAE,MAAM;EAAQ,MAAMnB,EAAG,2BAA2B,0BAA0B;CAAE,IAElFmB,MAAa,YAChB;EAAE,MAAM;EAAO,MAAMnB,EAAG,gCAAgC,4BAA4B;CAAE,IACtF;EAAE,MAAM;EAAO,MAAMA,EAAG,8BAA8B,gCAAgC;CAAE;AAC9F;AAGA,SAAgBoB,EACd,GACA,GACA,GACA,GACQ;CACR,IAAMC,IAAO,IAAI,KAAK,KAAK,IAAIlC,EAAK,OAAOD,EAAM,MAAM,QAAQ,CAAC,CAAC,GAC3DoC,IAAK,IAAI,KAAK,KAAK,IAAInC,EAAK,KAAKD,EAAM,IAAI,QAAQ,CAAC,CAAC;CAC3D,OAAOW,EAAmBwB,GAAMC,GAAItC,GAAUW,CAAM;AACtD"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { CalendarEventV2 } from '../types';
|
|
2
|
+
import { EventForm, FormIssues, GuestDraft } from './eventForm';
|
|
3
|
+
import { BusySpan } from './findTime';
|
|
4
|
+
import { ScopeChoice } from './savePlan';
|
|
5
|
+
import { Identities, RoomsForEvent } from './useEventData';
|
|
6
|
+
export type EventTab = 'details' | 'people' | 'place' | 'more';
|
|
7
|
+
export declare const EVENT_TABS: readonly EventTab[];
|
|
8
|
+
export declare function isEventTab(value: unknown): value is EventTab;
|
|
9
|
+
/** Someone's time while the event happens. */
|
|
10
|
+
export interface PersonStatus {
|
|
11
|
+
/**
|
|
12
|
+
* From free/busy: free, busy, a maybe (`tentative`) or time off (`away`). `noFreeBusy`:
|
|
13
|
+
* someone outside the workspace (an email address, a former member), who can't be asked.
|
|
14
|
+
*/
|
|
15
|
+
kind: 'free' | 'busy' | 'tentative' | 'away' | 'noFreeBusy' | 'loading' | 'error';
|
|
16
|
+
/** The busy time that overlaps the event. */
|
|
17
|
+
span: BusySpan | null;
|
|
18
|
+
/** Some of their busy time may be missing (the service stopped at one of its limits). */
|
|
19
|
+
truncated: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface EventDialogModel {
|
|
22
|
+
form: EventForm;
|
|
23
|
+
update: (change: (form: EventForm) => EventForm) => void;
|
|
24
|
+
/** Someone else's event, or one on a calendar followed by link: shown, never changed. */
|
|
25
|
+
readOnly: boolean;
|
|
26
|
+
/** The event being edited, as the service last returned it; null for a new event. */
|
|
27
|
+
event: CalendarEventV2 | null;
|
|
28
|
+
issues: FormIssues;
|
|
29
|
+
/** Problems are named once a save has been tried. */
|
|
30
|
+
showIssues: boolean;
|
|
31
|
+
/** The event's instants, from the form. */
|
|
32
|
+
start: Date;
|
|
33
|
+
end: Date;
|
|
34
|
+
/** The person's own time then. */
|
|
35
|
+
me: PersonStatus;
|
|
36
|
+
guestStatus: (guest: GuestDraft) => PersonStatus;
|
|
37
|
+
retryFreeBusy: () => void;
|
|
38
|
+
identities: Identities;
|
|
39
|
+
/** A guest's name: theirs from the workspace, else the one on the event, else the address. */
|
|
40
|
+
guestName: (guest: GuestDraft) => string;
|
|
41
|
+
rooms: RoomsForEvent;
|
|
42
|
+
/** Find a time, with what the dialog holds. */
|
|
43
|
+
openFindTime: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* A team's members are being looked up to be added (or that ended): saving waits meanwhile,
|
|
46
|
+
* else they would be left out of what is saved.
|
|
47
|
+
*/
|
|
48
|
+
guestsPending: (pending: boolean) => void;
|
|
49
|
+
/** A date of a repeating event (A4): which events the save changes; null otherwise. */
|
|
50
|
+
scope: ScopeChoice | null;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialogModel.js","names":["EVENT_TABS","isEventTab","tab","value"],"sources":["../../../src/v2/event/dialogModel.ts"],"sourcesContent":["/**\n * What the event dialog's tabs share (BOFF-15698 A2): the form and how to change it, the event\n * being edited, what stops a save, and what the dialog has read about people and rooms.\n */\nimport type { CalendarEventV2 } from '../types';\nimport type { EventForm, FormIssues, GuestDraft } from './eventForm';\nimport type { BusySpan } from './findTime';\nimport type { ScopeChoice } from './savePlan';\nimport type { Identities, RoomsForEvent } from './useEventData';\n\nexport type EventTab = 'details' | 'people' | 'place' | 'more';\n\nexport const EVENT_TABS: readonly EventTab[] = ['details', 'people', 'place', 'more'];\n\nexport function isEventTab(value: unknown): value is EventTab {\n return EVENT_TABS.some((tab) => tab === value);\n}\n\n/** Someone's time while the event happens. */\nexport interface PersonStatus {\n /**\n * From free/busy: free, busy, a maybe (`tentative`) or time off (`away`). `noFreeBusy`:\n * someone outside the workspace (an email address, a former member), who can't be asked.\n */\n kind: 'free' | 'busy' | 'tentative' | 'away' | 'noFreeBusy' | 'loading' | 'error';\n /** The busy time that overlaps the event. */\n span: BusySpan | null;\n /** Some of their busy time may be missing (the service stopped at one of its limits). */\n truncated: boolean;\n}\n\nexport interface EventDialogModel {\n form: EventForm;\n update: (change: (form: EventForm) => EventForm) => void;\n /** Someone else's event, or one on a calendar followed by link: shown, never changed. */\n readOnly: boolean;\n /** The event being edited, as the service last returned it; null for a new event. */\n event: CalendarEventV2 | null;\n issues: FormIssues;\n /** Problems are named once a save has been tried. */\n showIssues: boolean;\n /** The event's instants, from the form. */\n start: Date;\n end: Date;\n /** The person's own time then. */\n me: PersonStatus;\n guestStatus: (guest: GuestDraft) => PersonStatus;\n retryFreeBusy: () => void;\n identities: Identities;\n /** A guest's name: theirs from the workspace, else the one on the event, else the address. */\n guestName: (guest: GuestDraft) => string;\n rooms: RoomsForEvent;\n /** Find a time, with what the dialog holds. */\n openFindTime: () => void;\n /**\n * A team's members are being looked up to be added (or that ended): saving waits meanwhile,\n * else they would be left out of what is saved.\n */\n guestsPending: (pending: boolean) => void;\n /** A date of a repeating event (A4): which events the save changes; null otherwise. */\n scope: ScopeChoice | null;\n}\n"],"mappings":";AAYA,IAAaA,IAAkC;CAAC;CAAW;CAAU;CAAS;AAAM;AAEpF,SAAgBC,EAAW,GAAmC;CAC5D,OAAOD,EAAW,MAAM,MAAQE,MAAQC,CAAK;AAC/C"}
|