@propriety/court-calendar 1.0.150 → 1.0.152
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__/StatusTimeline.test.d.ts +1 -0
- package/dist/__tests__/hooks/UseCourtDates.test.d.ts +12 -0
- package/dist/__tests__/timelineStages.test.d.ts +1 -0
- package/dist/_components/List/CalendarList.d.ts +2 -1
- package/dist/_components/Modal/DateDetails/timelineStages.d.ts +51 -0
- package/dist/helpers/cases.d.ts +10 -0
- 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 +5391 -5329
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
- package/src/__tests__/StatusTimeline.test.tsx +84 -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/__tests__/timelineStages.test.ts +406 -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/_components/Modal/DateDetails/DateDetails.tsx +10 -64
- package/src/_components/Modal/DateDetails/timelineStages.ts +137 -0
- package/src/helpers/api/courtDates.ts +22 -3
- package/src/helpers/cases.ts +15 -2
- 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 @@
|
|
|
1
|
+
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 {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Case } from '../../../types';
|
|
2
|
+
import { Status } from './StatusTimeline';
|
|
3
|
+
export interface StageResult {
|
|
4
|
+
status: Status;
|
|
5
|
+
count?: {
|
|
6
|
+
done: number;
|
|
7
|
+
total: number;
|
|
8
|
+
};
|
|
9
|
+
date?: Date;
|
|
10
|
+
}
|
|
11
|
+
/** Most recent of a set of possibly-missing dates, or undefined when none are set. */
|
|
12
|
+
export declare function latestDate(dates: (Date | null | undefined)[]): Date | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* What an empty base means for a stage. The two cases are deliberately NOT symmetric:
|
|
15
|
+
*
|
|
16
|
+
* - 'complete' No work is left, so the stage is finished (green check). Used by
|
|
17
|
+
* Reviewed/Sent Offers/Uploaded: you cannot review, offer on, or upload
|
|
18
|
+
* for a case that already settled, so once every case is settled those
|
|
19
|
+
* stages are done by definition.
|
|
20
|
+
* - 'notStarted' The stage cannot have begun yet (empty circle). Used by Stipulation:
|
|
21
|
+
* a stipulation only exists once a case settles, so "nothing settled"
|
|
22
|
+
* means not started, not finished.
|
|
23
|
+
*/
|
|
24
|
+
type EmptyBase = 'complete' | 'notStarted';
|
|
25
|
+
/**
|
|
26
|
+
* Collapses one timeline stage into a status.
|
|
27
|
+
*
|
|
28
|
+
* `base` is the population the stage is measured against — the "X of Y" label is always
|
|
29
|
+
* done/base, never cases.length. `cases` is the full list on the date, used only to blank
|
|
30
|
+
* the timeline when the date has no cases at all, and to date the check when the base is
|
|
31
|
+
* empty but the stage still counts as complete.
|
|
32
|
+
*/
|
|
33
|
+
export declare function stageStatus({ cases, base, isDone, dateOf, whenBaseEmpty, }: {
|
|
34
|
+
cases: Case[];
|
|
35
|
+
base: Case[];
|
|
36
|
+
isDone: (c: Case) => boolean;
|
|
37
|
+
dateOf: (done: Case[]) => Date | undefined;
|
|
38
|
+
whenBaseEmpty: EmptyBase;
|
|
39
|
+
}): StageResult;
|
|
40
|
+
export declare function reviewedStage(cases: Case[], isVillage: boolean): StageResult;
|
|
41
|
+
export declare function sentOffersStage(cases: Case[], isVillage: boolean): StageResult;
|
|
42
|
+
export declare function uploadedStage(cases: Case[], isVillage: boolean): StageResult;
|
|
43
|
+
/** Settled is the one stage measured against every case — it *is* the settlement rate. */
|
|
44
|
+
export declare function settledStage(cases: Case[], isVillage: boolean): StageResult;
|
|
45
|
+
/**
|
|
46
|
+
* Stipulations only exist on settled cases (~98% of stip rows in production sit on one),
|
|
47
|
+
* so "stips done / settled cases" is the meaningful ratio. Note the asymmetry with the
|
|
48
|
+
* stages above: an empty base here means not-started, not finished.
|
|
49
|
+
*/
|
|
50
|
+
export declare function stipulationStage(cases: Case[], isVillage: boolean): StageResult;
|
|
51
|
+
export {};
|
package/dist/helpers/cases.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { CalendarFilterCtx, Case, NegotiationLog } from '../types';
|
|
2
2
|
export declare function isCaseSettled(c: Case, isVillage: boolean): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The raw upload fact: this case's evidence is up on NYSCEF. Says nothing about
|
|
5
|
+
* settlement — use this when settled cases have already been filtered out.
|
|
6
|
+
*/
|
|
7
|
+
export declare function hasCaseUploadedEvidence(c: Case): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* True when the case needs no upload — either it settled (mooting the upload) or the
|
|
10
|
+
* evidence is already up. This is the "nothing left to chase" predicate behind the
|
|
11
|
+
* calendar/week upload badges; it is NOT the Uploaded timeline stage.
|
|
12
|
+
*/
|
|
3
13
|
export declare function isCaseUploadedOrSettled(c: Case, isVillage: boolean): boolean;
|
|
4
14
|
export declare function isCaseMissingEvidence(c: Case): boolean;
|
|
5
15
|
export declare function hasCaseUnuploadedEvidence(c: Case): boolean;
|
|
@@ -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
|
};
|