@propriety/court-calendar 1.0.55 → 1.0.56
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/_components/List/CalendarList.d.ts +4 -5
- package/dist/_components/Modal/Modal.d.ts +3 -1
- package/dist/helpers/CalEvent.d.ts +23 -0
- package/dist/hooks/UseCalendarEvents.d.ts +6 -7
- package/dist/hooks/UseModalSelection.d.ts +17 -11
- package/dist/index.mjs +5664 -5706
- package/dist/types.d.ts +10 -1
- package/package.json +1 -1
- package/src/_components/CCalendar.tsx +11 -3
- package/src/_components/List/CalendarList.tsx +52 -117
- package/src/_components/Modal/Modal.tsx +5 -2
- package/src/helpers/CalEvent.ts +175 -0
- package/src/hooks/UseCalendarEvents.ts +85 -163
- package/src/hooks/UseModalSelection.ts +28 -14
- package/src/types.ts +23 -13
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export default function CalendarList({ filteredDates,
|
|
3
|
-
filteredDates:
|
|
4
|
-
|
|
1
|
+
import { CalEvent } from '../../helpers/CalEvent';
|
|
2
|
+
export default function CalendarList({ filteredDates, onSelectCalEvent, currentDate, onUpdateChair, isPrinting, }: {
|
|
3
|
+
filteredDates: CalEvent[];
|
|
4
|
+
onSelectCalEvent: (calEvent: CalEvent) => void;
|
|
5
5
|
currentDate: Date;
|
|
6
6
|
onUpdateChair?: (courtDateId: number, position: "first" | "second", userId: number | null) => void;
|
|
7
|
-
allCases: Record<string, Case[]>;
|
|
8
7
|
isPrinting?: boolean;
|
|
9
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Case, CourtDate } from '../../types';
|
|
2
|
+
import { CalEvent } from '../../helpers/CalEvent';
|
|
2
3
|
import { ModalMode } from './types';
|
|
3
|
-
export default function CCModal({ modalIsOpen, modalMode, setModalMode, setIsOpen, selectedCourtDate, selectedDate, selectedCases, isFetchingCases, }: {
|
|
4
|
+
export default function CCModal({ modalIsOpen, modalMode, setModalMode, setIsOpen, selectedCourtDate, selectedDate, selectedCalEvent, selectedCases, isFetchingCases, }: {
|
|
4
5
|
modalIsOpen: boolean;
|
|
5
6
|
modalMode: ModalMode;
|
|
6
7
|
setModalMode: (mode: ModalMode) => void;
|
|
7
8
|
setIsOpen: (isOpen: boolean) => void;
|
|
8
9
|
selectedCourtDate: CourtDate | null;
|
|
9
10
|
selectedDate: Date | null;
|
|
11
|
+
selectedCalEvent: CalEvent | null;
|
|
10
12
|
selectedCases: Case[];
|
|
11
13
|
isFetchingCases: boolean;
|
|
12
14
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HearingType, DateType, Lifecycle, Case, CourtDate, Notes } from '../types';
|
|
2
|
+
export interface CalEvent {
|
|
3
|
+
id: string;
|
|
4
|
+
courtDateID: number;
|
|
5
|
+
cases: Case[];
|
|
6
|
+
hearingType: HearingType;
|
|
7
|
+
lifecycle: Lifecycle;
|
|
8
|
+
dateType: DateType;
|
|
9
|
+
muniCode: string;
|
|
10
|
+
firstChair: number | null;
|
|
11
|
+
secondChair: number | null;
|
|
12
|
+
notes: Notes[] | null;
|
|
13
|
+
originalDate: Date;
|
|
14
|
+
activeDate: Date;
|
|
15
|
+
uploadDeadline: Date | null;
|
|
16
|
+
isAdjourned: boolean;
|
|
17
|
+
isExtraDay: boolean;
|
|
18
|
+
extraDayIndex: number | null;
|
|
19
|
+
isMultiDay: boolean;
|
|
20
|
+
hasAdjournedNoDate: boolean;
|
|
21
|
+
source: CourtDate;
|
|
22
|
+
}
|
|
23
|
+
export declare function buildCalEvents(courtDates: CourtDate[], casesByCourtDateId: Record<string, Case[]>, allCourtDates?: CourtDate[]): CalEvent[];
|
|
@@ -7,23 +7,22 @@ import { EventSourceInput, EventMountArg, Calendar } from '@fullcalendar/core/in
|
|
|
7
7
|
* - Runs async case-term searches and accumulates matching court date IDs.
|
|
8
8
|
* - Filters `courtDates` according to every dimension in `filterCtx`
|
|
9
9
|
* (hearing type, assignment, muni, unsettled/no-evidence/unreviewed, search term).
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* - **deadlines** – all-day upload-deadline events.
|
|
10
|
+
* - Calls `buildCalEvents` to produce one `CalEvent` per visual occurrence
|
|
11
|
+
* (original, extra-day, and adjournment events — bucketing/suppression lives there).
|
|
12
|
+
* - Maps each `CalEvent` to a FullCalendar event object.
|
|
14
13
|
* - Suppresses event updates while the modal is open to avoid UI churn.
|
|
15
14
|
* - Applies a staggered `pop-in` CSS animation to newly-appearing events via
|
|
16
15
|
* `handleEventMount`, and attaches HTML tooltip content to each event element.
|
|
17
16
|
*
|
|
18
17
|
* @param courtDates Full list of court dates to derive events from.
|
|
19
|
-
* @param allCases Map of `CourtDateID → Case[]` for case
|
|
18
|
+
* @param allCases Map of `CourtDateID → Case[]` for filtering and case counts.
|
|
20
19
|
* @param apiKey API key forwarded to the search helper.
|
|
21
20
|
* @param modalIsOpen When `true`, event state updates are paused.
|
|
22
21
|
* @param filterCtx Active filter/search context from the calendar UI.
|
|
23
22
|
*
|
|
24
23
|
* @returns
|
|
25
24
|
* - `events` – current FullCalendar `EventSourceInput` array.
|
|
26
|
-
* - `filteredDates` –
|
|
25
|
+
* - `filteredDates` – `CalEvent[]` that survive all active filters.
|
|
27
26
|
* - `eventHash` – JSON hash of `events`; changes whenever the event list changes.
|
|
28
27
|
* - `handleEventMount` – callback to pass to FullCalendar's `eventDidMount` prop.
|
|
29
28
|
*/
|
|
@@ -35,7 +34,7 @@ export declare function useCalendarEvents({ courtDates, allCases, apiKey, modalI
|
|
|
35
34
|
filterCtx: CalendarFilterCtx;
|
|
36
35
|
}): {
|
|
37
36
|
events: EventSourceInput;
|
|
38
|
-
filteredDates:
|
|
37
|
+
filteredDates: import('../helpers/CalEvent').CalEvent[];
|
|
39
38
|
eventHash: string;
|
|
40
39
|
handleEventMount: (info: EventMountArg, calendarApi: Calendar | null) => void;
|
|
41
40
|
};
|
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
import { CourtDate } from '../types';
|
|
2
2
|
import { ModalMode } from '../_components/Modal/types';
|
|
3
3
|
import { EventClickArg } from '@fullcalendar/core/index.js';
|
|
4
|
+
import { CalEvent } from '../helpers/CalEvent';
|
|
4
5
|
/**
|
|
5
6
|
* Manages which court date is selected and how the modal is opened.
|
|
6
7
|
*
|
|
7
8
|
* Tracks open/close state, the selected `CourtDate`, the active `ModalMode`,
|
|
8
9
|
* and the calendar date associated with the selection.
|
|
9
10
|
*
|
|
11
|
+
* `selectedCalEventId` identifies which CalEvent was clicked so that CCalendar
|
|
12
|
+
* can reactively derive the pre-bucketed `selectedCalEvent` from `filteredDates`.
|
|
13
|
+
*
|
|
10
14
|
* @returns
|
|
11
|
-
* - `modalIsOpen`
|
|
12
|
-
* - `setIsOpen`
|
|
13
|
-
* - `selectedCourtDate`
|
|
15
|
+
* - `modalIsOpen` – Whether the modal is currently open.
|
|
16
|
+
* - `setIsOpen` – Directly set the open/close state.
|
|
17
|
+
* - `selectedCourtDate` – The court date currently displayed in the modal (for editing).
|
|
14
18
|
* - `setSelectedCourtDate` – Override the selected court date directly.
|
|
15
|
-
* - `
|
|
16
|
-
* - `
|
|
17
|
-
* - `
|
|
18
|
-
* - `
|
|
19
|
-
* - `
|
|
20
|
-
* - `
|
|
21
|
-
*
|
|
19
|
+
* - `selectedCalEventId` – ID of the clicked CalEvent (used to derive selectedCalEvent).
|
|
20
|
+
* - `modalMode` – Current mode (`DETAILS` or `CREATE`).
|
|
21
|
+
* - `setModalMode` – Override the modal mode directly.
|
|
22
|
+
* - `selectedDate` – Calendar date extracted from the last clicked event.
|
|
23
|
+
* - `openCreateModal` – Opens the modal in CREATE mode pre-filled with a date.
|
|
24
|
+
* - `openDetailsModal` – Opens the modal in DETAILS mode for a given CalEvent.
|
|
25
|
+
* - `handleEventClick` – FullCalendar `eventClick` handler; extracts the CalEvent id
|
|
26
|
+
* and CourtDate from event props and opens the details modal.
|
|
22
27
|
*/
|
|
23
28
|
export declare function useModalSelection(): {
|
|
24
29
|
modalIsOpen: boolean;
|
|
25
30
|
setIsOpen: import('react').Dispatch<import('react').SetStateAction<boolean>>;
|
|
26
31
|
selectedCourtDate: CourtDate | null;
|
|
27
32
|
setSelectedCourtDate: import('react').Dispatch<import('react').SetStateAction<CourtDate | null>>;
|
|
33
|
+
selectedCalEventId: string | null;
|
|
28
34
|
modalMode: ModalMode;
|
|
29
35
|
setModalMode: import('react').Dispatch<import('react').SetStateAction<ModalMode>>;
|
|
30
36
|
selectedDate: Date | null;
|
|
31
37
|
openCreateModal: (date: Date) => void;
|
|
32
|
-
openDetailsModal: (
|
|
38
|
+
openDetailsModal: (calEvent: CalEvent) => void;
|
|
33
39
|
handleEventClick: (clickInfo: EventClickArg) => void;
|
|
34
40
|
};
|