@propriety/court-calendar 1.0.173 → 1.0.175

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/CLAUDE.md CHANGED
@@ -2,15 +2,30 @@
2
2
 
3
3
  Published npm package: `@propriety/court-calendar` — a React component library built with Vite in library mode.
4
4
 
5
+ ## Read this before debugging anything
6
+
7
+ **[docs/REFERENCE.md](docs/REFERENCE.md)** — the data model (three date types in three tables, one
8
+ `CourtDate` shape), the call path a mutation travels, the permission gates, and a table of traps
9
+ that each cost a real debugging session. Most bugs here look like frontend bugs and are one of
10
+ those. Read it before forming a hypothesis, and add to it when a session rediscovers something
11
+ structural.
12
+
5
13
  ## Commands
6
14
 
7
15
  ```bash
8
16
  npm run build # tsc -b && vite build → dist/
9
- npx vitest run # run all tests
10
- npx biome format --write <file> # format a file
11
- npx biome check src/ # lint entire src
17
+ npx tsc -b # typecheck only
18
+ npx vitest run # run all tests (~1260 of them, ~60s)
19
+ npx biome lint <file> # lint — this is the useful one
12
20
  ```
13
21
 
22
+ - `npx biome check` reports whole-file **format** drift on almost every file at `HEAD`: the repo is
23
+ not biome-formatted. Judge your own edit with `biome lint`. Never `biome format --write` a whole
24
+ file — it buries the change under hundreds of lines.
25
+ - `npm run lint` is a leftover from the Vite template (`eslint .`, and there is no eslint config
26
+ here — only `biome.json`). The `eslint-disable-next-line` comments in `src/` are vestigial.
27
+ - `rtk` is not installed on this machine, despite the global instruction to prefix with it.
28
+
14
29
  ## Architecture
15
30
 
16
31
  - **Entry**: `src/index.ts` → exports `CCalendar` component from `src/_components/CCalendar.tsx`
@@ -44,4 +59,5 @@ Context is at `src/context/ReferenceDataContext.tsx` and provides: `allUsers`, `
44
59
  failure is plausible. If you cannot name the bug, do not write the test. Never assert on the text
45
60
  of a file, a private helper's internals, or a constant equalling itself. `/test-audit` applies this
46
61
  retroactively.
47
- - **Pre-commit**: Husky runs on commit — run `npx biome format --write` before staging
62
+ - **Git hooks**: one only — Husky `pre-push` runs `npm test`. There is no pre-commit hook and
63
+ nothing formats on commit, so do not reformat files to satisfy an imagined one.
@@ -1,5 +1,5 @@
1
1
  import { ModalMode } from '../types';
2
- export default function ModalActions({ modalMode, onDelete, onSave, setModalMode, setIsOpen, canEdit, isAdmin, createdBy, createdOn, }: {
2
+ export default function ModalActions({ modalMode, onDelete, onSave, setModalMode, setIsOpen, canEdit, isAdmin, courtDateId, createdBy, createdOn, }: {
3
3
  modalMode: ModalMode;
4
4
  onDelete: () => void | Promise<unknown>;
5
5
  onSave: () => void | Promise<unknown>;
@@ -7,8 +7,19 @@ export default function ModalActions({ modalMode, onDelete, onSave, setModalMode
7
7
  setIsOpen: (isOpen: boolean) => void;
8
8
  /** Gates Edit/Save — everyone who works on cases. */
9
9
  canEdit: boolean;
10
- /** Gates Delete only. Deleting a date is not recoverable from the UI. */
10
+ /**
11
+ * Gates Delete, and is the whole gate. Deleting a date is not recoverable from the UI,
12
+ * so the protection is the permission plus `handleDelete`'s confirm — not obscurity.
13
+ * Delete used to be hidden behind an unlabelled triple-click on a blank strip in this
14
+ * footer, which admins could not find and which broke outright whenever anything else
15
+ * in the row needed the space.
16
+ */
11
17
  isAdmin: boolean;
18
+ /**
19
+ * The row Delete would act on, or undefined/null while it is still unresolved. Only a
20
+ * positive id is a real saved date — CREATE's stub is -1 and `DEFAULT_COURT_DATE` is 0.
21
+ */
22
+ courtDateId?: number | null;
12
23
  createdBy?: number | null;
13
24
  createdOn?: Date | string | null;
14
25
  }): import("react/jsx-runtime").JSX.Element;
@@ -23,6 +23,17 @@ export interface CalEvent {
23
23
  casesLoaded: boolean;
24
24
  source: CourtDate;
25
25
  }
26
+ /**
27
+ * `date` with `hearingTime`'s clock folded in, as a new Date. A blank or unparseable time
28
+ * leaves the date's own clock alone.
29
+ *
30
+ * Parsing is delegated to `to24Hour` rather than repeated here. The local parser this
31
+ * replaced read anything without a "PM" suffix as 12-hour AM, so a bare "12:00" folded to
32
+ * midnight. HearingTime holds both dialects — "10:00 AM" written by the notice ingest,
33
+ * "12:00" written by the modal's TimePicker — and noon is the single value where they
34
+ * disagree, so a 12pm hearing drew at 12am.
35
+ */
36
+ export declare function withHearingTime(date: Date | string | number, hearingTime: string | null | undefined): Date;
26
37
  /** 'YYYY-MM-DD' in local time — the identity of a calendar day, used to bucket by day. */
27
38
  export declare function dateToKey(d: Date): string;
28
39
  /**