@propriety/court-calendar 1.0.151 → 1.0.153
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/README.md +1 -0
- package/dist/__tests__/collectionsPipeline.test.d.ts +16 -0
- package/dist/__tests__/hooks/UseCourtDates.test.d.ts +12 -0
- package/dist/_components/List/CalendarList.d.ts +2 -1
- package/dist/helpers/courtDates.d.ts +17 -2
- package/dist/helpers/formatter.d.ts +1 -0
- package/dist/helpers/routing.d.ts +3 -3
- package/dist/hooks/UseCourtDates.d.ts +1 -1
- package/dist/index.mjs +3903 -3877
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/__tests__/collectionsPipeline.test.ts +113 -0
- package/src/__tests__/filtering.test.ts +42 -0
- package/src/__tests__/helpers/api/courtDates.test.ts +26 -0
- package/src/__tests__/helpers/courtDates.test.ts +34 -2
- package/src/__tests__/helpers/routing.test.ts +37 -1
- package/src/__tests__/hooks/UseCourtDates.test.ts +174 -0
- package/src/__tests__/hooks/UseRouteSync.test.ts +53 -0
- package/src/_components/CCalendar.tsx +3 -2
- package/src/_components/DebugModal/Dashboard.tsx +16 -1
- package/src/_components/List/CalendarList.tsx +14 -7
- package/src/helpers/api/courtDates.ts +22 -3
- package/src/helpers/courtDates.ts +25 -4
- package/src/helpers/filtering.ts +9 -3
- package/src/helpers/formatter.ts +7 -5
- package/src/helpers/routing.ts +10 -2
- package/src/hooks/UseCalendarEvents.ts +3 -2
- package/src/hooks/UseCourtDates.ts +18 -4
- package/src/hooks/UseRouteSync.ts +24 -11
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -211,6 +211,7 @@ Parameters use short keys to keep the address bar readable. Only non-default val
|
|
|
211
211
|
| `view` | `view` | `'dayGridMonth'` | One of `dayGridMonth`, `timeGridWeek`, `timeGridDay`, `listDay`, `tableView` |
|
|
212
212
|
| `date` | `date` | today | ISO `YYYY-MM-DD` |
|
|
213
213
|
| `cdId` | `courtDateId` | absent | Integer court date ID — opens the details modal on load |
|
|
214
|
+
| `cdType` | `courtDateType` | absent (SCAR) | Which table `cdId` belongs to: `Negotiations` or `Collections`. The three date types have independent ID sequences that overlap, so `cdId` alone can resolve to the wrong record. Omitted for SCAR dates; a link without it resolves SCAR-first. |
|
|
214
215
|
| `ci` | `caseIdx` | absent | `Case.SCARIndexNumber` — opens a specific case (requires `cdId`) |
|
|
215
216
|
| `ht` | `showVirtual` / `showInPerson` / `showUnknown` | all visible | Comma-separated list of **hidden** hearing types, e.g. `ht=virtual,inPerson` |
|
|
216
217
|
| `user` | `showOnlyAssignedToUser` | `null` | UserID integer, or `-1` for "Unassigned" |
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* End-to-end guard for collections dates reaching the calendar.
|
|
3
|
+
*
|
|
4
|
+
* Collections come back as the raw Court.Collections columns — CollectionID,
|
|
5
|
+
* HearingDate (date-only), HearingTime (HH:mm:ss) — not the CourtDateID/CourtDate
|
|
6
|
+
* shape every other surface reads. A missing mapping is invisible at the API layer
|
|
7
|
+
* and only shows up three stages later as "the date isn't on the calendar":
|
|
8
|
+
*
|
|
9
|
+
* normalizeDateFromApi → CourtDateID undefined, CourtDate undefined
|
|
10
|
+
* filterCourtDates → dropped by the leading `cd.CourtDateID != null`
|
|
11
|
+
* buildCalEvents → dropped by the leading `if (!cd.CourtDate) continue`
|
|
12
|
+
*
|
|
13
|
+
* So this walks the real payload through all three stages rather than asserting on
|
|
14
|
+
* the normalizer alone.
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the date-identity half of useCourtDates.
|
|
3
|
+
*
|
|
4
|
+
* The three date types come from tables with independent auto-increment sequences,
|
|
5
|
+
* so a CourtDateID is only unique *within* a type. Ids 225 and 227 exist in both
|
|
6
|
+
* Court.HearingDates and Court.NegotiationDates today, and Court.Collections reaches
|
|
7
|
+
* the same range once it passes the HearingDates start.
|
|
8
|
+
*
|
|
9
|
+
* Resolving a date by bare id therefore picked whichever list was searched first —
|
|
10
|
+
* always SCAR — so assigning a chair on negotiation 225 wrote to SCAR date 225.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { CourtDate } from '../../types';
|
|
1
2
|
import { CalEvent } from '../../helpers/CalEvent';
|
|
2
3
|
export default function CalendarList({ filteredDates, onSelectCalEvent, currentDate, onUpdateChair, isPrinting, }: {
|
|
3
4
|
filteredDates: CalEvent[];
|
|
4
5
|
onSelectCalEvent: (calEvent: CalEvent) => void;
|
|
5
6
|
currentDate: Date;
|
|
6
|
-
onUpdateChair?: (
|
|
7
|
+
onUpdateChair?: (courtDate: CourtDate, position: 'first' | 'second', userId: number | null) => void;
|
|
7
8
|
isPrinting?: boolean;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Case, CourtDate } from '../types';
|
|
1
|
+
import { DateType, Case, CourtDate } from '../types';
|
|
2
2
|
export declare function isVillageDate(muniCode: string): boolean;
|
|
3
3
|
/**
|
|
4
4
|
* Parenthetical muni-code suffix for event labels, e.g. " (3100)". Collections may
|
|
@@ -16,5 +16,20 @@ export declare function caseIndexForMuni(muniCode: string, c: Pick<Case, 'SCARIn
|
|
|
16
16
|
* Returns a unique string key for a court date suitable for use in the allCases map.
|
|
17
17
|
* Negotiation IDs and SCAR IDs come from separate auto-increment sequences and can
|
|
18
18
|
* overlap numerically, so negotiations are prefixed with "neg_".
|
|
19
|
+
*
|
|
20
|
+
* This is also the only safe way to *identify* a date: resolving one by CourtDateID
|
|
21
|
+
* alone silently picks whichever type is searched first. The sequences already overlap
|
|
22
|
+
* in production (ids 225 and 227 exist as both a SCAR date and a negotiation date), and
|
|
23
|
+
* Collections joins them once it passes the SCAR sequence's start.
|
|
19
24
|
*/
|
|
20
|
-
export declare function caseKey(date: CourtDate): string;
|
|
25
|
+
export declare function caseKey(date: Pick<CourtDate, 'DateType' | 'CourtDateID'>): string;
|
|
26
|
+
/**
|
|
27
|
+
* The same key built from its parts, for callers holding an id and a type separately
|
|
28
|
+
* rather than a whole CourtDate — e.g. resolving the `cdId`/`cdType` URL pair.
|
|
29
|
+
*/
|
|
30
|
+
export declare function dateKeyOf(dateType: DateType | null | undefined, courtDateId: number): string;
|
|
31
|
+
/**
|
|
32
|
+
* True for a plain SCAR court date. DateType.SCAR is the empty string, so an absent
|
|
33
|
+
* type reads as SCAR — matching how the API omits the field for court dates.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isScarDate(date: Pick<CourtDate, 'DateType'>): boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Evidence } from '../types';
|
|
2
2
|
export declare function formatDateForAPI(date: Date): string;
|
|
3
3
|
export declare function formatDateTimeForAPI(date: Date, hearingTime?: string): string;
|
|
4
|
+
export declare function to24Hour(time: string): string;
|
|
4
5
|
export declare function formatEvidence(evidence: Evidence): string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CalendarFilterCtx, CalendarRouteParams } from '../types';
|
|
1
|
+
import { DateType, CalendarFilterCtx, CalendarRouteParams } from '../types';
|
|
2
2
|
import { DEFAULT_FILTER_CTX } from '../constants';
|
|
3
|
-
export declare const CALENDAR_PARAM_KEYS: readonly ["view", "date", "cdId", "ci", "ht", "user", "dl", "md", "adj", "dt", "muni", "settled", "noEvid", "unrev", "q"];
|
|
3
|
+
export declare const CALENDAR_PARAM_KEYS: readonly ["view", "date", "cdId", "cdType", "ci", "ht", "user", "dl", "md", "adj", "dt", "muni", "settled", "noEvid", "unrev", "q"];
|
|
4
4
|
export declare function serializeCalendarParams(params: CalendarRouteParams): URLSearchParams;
|
|
5
5
|
export declare function parseCalendarSearchParams(params: URLSearchParams | Record<string, string | undefined>): CalendarRouteParams;
|
|
6
|
-
export declare function buildCalendarRouteParams(view: string, date: Date, courtDateId: number | null, caseIdx: string | null, filterCtx: CalendarFilterCtx): CalendarRouteParams;
|
|
6
|
+
export declare function buildCalendarRouteParams(view: string, date: Date, courtDateId: number | null, caseIdx: string | null, filterCtx: CalendarFilterCtx, courtDateType?: DateType | null): CalendarRouteParams;
|
|
7
7
|
export declare function extractFilterFields(params: CalendarRouteParams): Partial<CalendarFilterCtx>;
|
|
8
8
|
export { DEFAULT_FILTER_CTX };
|
|
@@ -35,6 +35,6 @@ export declare function useCourtDates({ apiKey, activeUser, modalIsOpen, setSele
|
|
|
35
35
|
lastFetchedAt: Date | null;
|
|
36
36
|
forceRefreshDates: () => Promise<void>;
|
|
37
37
|
updateCourtDateInMemory: (updatedDate: CourtDate, del?: boolean) => void;
|
|
38
|
-
handleUpdateChair: (
|
|
38
|
+
handleUpdateChair: (target: CourtDate, position: "first" | "second", userId: number | null) => void;
|
|
39
39
|
loadRange: (from: Date, to: Date) => Promise<void>;
|
|
40
40
|
};
|