Oeffne Kapitel und Dokument auf derselben Arbeitsflaeche, damit Pfad, Rechte und eigene Reihenfolge beim Lesen erhalten bleiben.
Deploy Development / deploy (push) Successful in 33s
Test Suite / pytest-backend (push) Successful in 56s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 9s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 14:19:06 +02:00
1 parent 94ef46d8eb
commit 448e9a06ff
34 files changed
+2998 -696

No files matched your search

+293 -143
View File
@@ -1,11 +1,14 @@
import { useContext, useEffect, useRef, useState } from "react";
import { Link, useParams, useSearchParams } from "react-router-dom";
import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom";
import { api, markDirty, textToDocument } from "../api.js";
import { SessionContext } from "../session.js";
import { Modal } from "./Modal.jsx";
import { MailPicker, PaperlessPicker } from "./Sources.jsx";
import { ErrorNote, ShareBox } from "./widgets.jsx";
import { ContentBoard, ObjectMenu, OrderChoice, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, selectionOf, withSelection, writeSelection } from "./content.jsx";
import { ContentBoard, ObjectMenu, OrderChoice, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, saveChapterOrder, writeSelection } from "./content.jsx";
import { ReadingPane } from "./ReadingPane.jsx";
import { StructureNavigator, Workspace, rememberScroll, restoreScroll, useWorkspaceLayout } from "./workspace.jsx";
import { NavIcon } from "./icons.jsx";
export function CaseList() {
const { session } = useContext(SessionContext);
@@ -208,12 +211,12 @@ function mergedCaseItems(record, direction, caseId) {
...(record.bindings || []).map((binding) => ({
...binding,
origin: chapterOrigin("Direkt in dieser Akte", record.chapters, binding.chapter_id),
readerHref: `/cases/${caseId}/items/${binding.id}`,
readerHref: `/cases/${caseId}?eintrag=${binding.id}${binding.chapter_id ? `&kapitel=${binding.chapter_id}` : ""}`,
})),
...(record.contained || []).flatMap((group) => (group.bindings || []).map((binding) => ({
...binding,
origin: chapterOrigin(matterOrigin(group), group.chapters, binding.chapter_id),
readerHref: `/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${caseId}`,
readerHref: `/matters/${group.matter_id}?context_kind=case&context_id=${caseId}&eintrag=${binding.id}${binding.chapter_id ? `&kapitel=${binding.chapter_id}` : ""}`,
}))),
];
const counts = {};
@@ -227,16 +230,72 @@ function mergedCaseItems(record, direction, caseId) {
return [...dated, ...undated];
}
function matterNode(matter, caseId) {
const query = `?context_kind=case&context_id=${caseId}`;
return {
id: matter.id,
title: matter.title,
kind: matter.kind_label || "Vorgang",
href: `/matters/${matter.id}${query}`,
current: false,
children: (matter.children || []).map((child) => matterNode(child, caseId)),
};
}
function caseNodes(record, parentRecord) {
const self = {
id: record.id,
title: record.title,
kind: record.kind_label || "Akte",
href: null,
current: true,
children: [
...(record.subcases || []).map((item) => ({
id: item.id,
title: item.title,
kind: "Unterakte",
href: `/cases/${item.id}`,
current: false,
children: [],
})),
...(record.matters || []).map((matter) => matterNode(matter, record.id)),
],
};
if (!parentRecord) return [self];
const siblings = (parentRecord.subcases || []).map((item) => (item.id === record.id ? self : {
id: item.id,
title: item.title,
kind: "Unterakte",
href: `/cases/${item.id}`,
current: false,
children: [],
}));
return [{
id: parentRecord.id,
title: parentRecord.title,
kind: "Akte",
href: `/cases/${parentRecord.id}`,
current: false,
children: siblings.length ? siblings : [self],
}];
}
export function CaseDetail() {
const { id } = useParams();
const navigate = useNavigate();
const [params, setParams] = useSearchParams();
const { scope, chapterId } = selectionOf(params);
const rawScope = params.get("bereich") || "";
const overview = rawScope === "all" || rawScope === "ueberblick";
const chapterId = overview ? "" : (params.get("kapitel") || "");
const entryId = params.get("eintrag") || "";
const [record, setRecord] = useState(null);
const [parentTree, setParentTree] = useState(null);
const [error, setError] = useState("");
const [modal, setModal] = useState("");
const [view, setView] = useState("contents");
const [dateDir, setDateDir] = useState("asc");
const [outlineOpen, setOutlineOpen] = useState(false);
const { width, structureOpen, setStructureOpen } = useWorkspaceLayout();
const listRef = useRef(null);
const pendingChapter = useRef("");
const context = { kind: "case", id };
@@ -254,7 +313,8 @@ export function CaseDetail() {
setView("contents");
setModal("");
setDateDir("asc");
setOutlineOpen(false);
setStructureOpen(false);
setParentTree(null);
api(`/api/v1/cases/${id}`).then((detail) => {
if (!alive) return;
pendingChapter.current = "";
@@ -266,158 +326,248 @@ export function CaseDetail() {
}, [id]);
useEffect(() => {
if (!record || record.id !== id) return;
const known = new Set(["all", "direct", ...(record.contained || []).map((item) => item.matter_id)]);
const nextScope = known.has(scope) ? scope : "all";
const chapters = nextScope === "direct"
? (record.chapters || [])
: (record.contained || []).find((item) => item.matter_id === nextScope)?.chapters || [];
const nextChapter = chapterId && chapters.some((chapter) => chapter.id === chapterId) ? chapterId : "";
if (chapterId && !nextChapter && pendingChapter.current === chapterId) return;
if (nextScope !== scope || nextChapter !== chapterId) writeSelection(params, setParams, nextScope, nextChapter);
}, [record, id, scope, chapterId, params, setParams]);
if (!record || record.id !== id || !record.parent_case_id) return undefined;
let alive = true;
api(`/api/v1/cases/${record.parent_case_id}`).then((parent) => {
if (alive) setParentTree(parent);
}).catch(() => {
if (alive) setParentTree(null);
});
return () => {
alive = false;
};
}, [record, id]);
function choose(nextScope, nextChapter = "") {
writeSelection(params, setParams, nextScope, nextChapter);
useEffect(() => {
if (!record || record.id !== id) return;
const matterId = rawScope && !["all", "ueberblick", "direkt", "direct"].includes(rawScope) ? rawScope : "";
if (matterId && (record.contained || []).some((item) => item.matter_id === matterId)) {
const next = new URLSearchParams();
next.set("context_kind", "case");
next.set("context_id", id);
const chapter = params.get("kapitel");
if (chapter) next.set("kapitel", chapter);
navigate(`/matters/${matterId}?${next.toString()}`, { replace: true });
return;
}
if (!overview && chapterId && !(record.chapters || []).some((chapter) => chapter.id === chapterId)) {
if (pendingChapter.current === chapterId) return;
writeSelection(params, setParams, "direct", "");
}
}, [record, id, rawScope, overview, chapterId, params, setParams, navigate]);
useEffect(() => {
if (!record || record.id !== id || !entryId || overview) return;
const binding = (record.bindings || []).find((item) => item.id === entryId);
if (!binding) return;
const nextChapter = binding.chapter_id || "";
if ((chapterId || "") !== nextChapter) writeSelection(params, setParams, "direct", nextChapter);
}, [record, id, entryId, overview, chapterId, params, setParams]);
useEffect(() => {
if (entryId) return;
restoreScroll(listRef.current, `tsumugu-scroll:case:${id}:${chapterId}:${overview ? "over" : "direct"}`);
}, [entryId, id, chapterId, overview, record]);
function chooseChapter(next) {
const updated = new URLSearchParams(params);
updated.delete("bereich");
updated.delete("eintrag");
if (next) updated.set("kapitel", next);
else updated.delete("kapitel");
setParams(updated);
setView("contents");
setOutlineOpen(false);
setStructureOpen(false);
}
function showOverview() {
const updated = new URLSearchParams(params);
updated.set("bereich", "ueberblick");
updated.delete("kapitel");
updated.delete("eintrag");
setParams(updated);
setView("contents");
setStructureOpen(false);
}
function openEntry(binding) {
rememberScroll(listRef.current, `tsumugu-scroll:case:${id}:${chapterId}:direct`);
const updated = new URLSearchParams(params);
updated.delete("bereich");
updated.set("eintrag", binding.id);
if (binding.chapter_id) updated.set("kapitel", binding.chapter_id);
else updated.delete("kapitel");
setParams(updated);
setView("contents");
}
function closeEntry() {
const updated = new URLSearchParams(params);
updated.delete("eintrag");
setParams(updated, { replace: true });
}
async function moveChapter(chapterIdToMove, delta) {
const ids = (record?.chapters || []).map((chapter) => chapter.id);
const index = ids.indexOf(chapterIdToMove);
const target = index + delta;
if (!record || index < 0 || target < 0 || target >= ids.length) return;
const [moved] = ids.splice(index, 1);
ids.splice(target, 0, moved);
try {
await saveChapterOrder({ containerKind: "case", containerId: id, record, ids });
await load();
} catch (err) {
setError(err.message);
}
}
if (error && !record) return <main className="page"><ErrorNote error={error} /></main>;
if (!record) return <main className="page"><p className="muted">Akte wird geladen …</p></main>;
const group = scope !== "all" && scope !== "direct"
? (record.contained || []).find((item) => item.matter_id === scope) || null
: null;
const target = scope === "direct"
? {
scope: "direct",
label: `Akte ${record.title}`,
edit: Boolean(record.rights?.edit),
chapters: record.chapters || [],
chapterPath: `/api/v1/cases/${id}/chapters`,
}
: group
? {
scope: group.matter_id,
label: `${group.kind_label || "Vorgang"} ${group.title}`,
edit: Boolean(group.rights?.edit),
chapters: group.chapters || [],
chapterPath: `/api/v1/matters/${group.matter_id}/chapters?context_kind=case&context_id=${id}`,
}
: null;
const activeChapter = target?.chapters.find((chapter) => chapter.id === chapterId) || null;
const canEdit = Boolean(record.rights?.edit);
const targetLabel = `${record.kind_label || "Akte"} ${record.title}`;
const activeChapter = (record.chapters || []).find((chapter) => chapter.id === chapterId) || null;
const chapters = (record.chapters || []).map((chapter) => ({
...chapter,
count: (record.bindings || []).filter((item) => item.chapter_id === chapter.id).length,
}));
const merged = mergedCaseItems(record, dateDir, id);
const addPlacement = group ? { kind: "matter", id: group.matter_id } : null;
const contexts = [
...(parentTree ? [{ id: parentTree.id, label: parentTree.title }] : []),
{ id: record.id, label: record.title },
];
const entry = overview ? null : ((record.bindings || []).find((item) => item.id === entryId) || null);
const hasContained = Boolean(record.contained?.length);
return (
<main className="page">
<header className="page-head">
<>
<Workspace
width={width}
structureOpen={structureOpen}
setStructureOpen={setStructureOpen}
hasEntry={Boolean(entryId) && !overview}
listRef={listRef}
nav={(
<StructureNavigator
contexts={contexts}
contextValue={id}
onContext={parentTree ? ((next) => { if (next !== id) navigate(`/cases/${next}`); }) : null}
nodes={caseNodes(record, parentTree)}
chapters={chapters}
chapterId={overview ? "" : chapterId}
allCount={(record.bindings || []).length}
overview={hasContained ? { active: overview, count: merged.length, onSelect: showOverview } : null}
chapterHeading={`Kapitel in ${record.title}`}
onChapter={chooseChapter}
onAddChapter={canEdit ? () => setModal("chapter") : null}
canAddChapter={canEdit}
onMoveChapter={moveChapter}
canReorder={canEdit && chapters.length > 1}
links={[]}
onNavigate={() => setStructureOpen(false)}
onClose={width < 1500 ? () => setStructureOpen(false) : null}
/>
)}
reader={entryId && !overview ? (
<ReadingPane
binding={entry}
context={context}
backLabel={activeChapter?.title || "Alle Inhalte"}
onClose={closeEntry}
onReload={load}
canDetach={canEdit}
canDestroy={Boolean(record.is_owner)}
/>
) : null}
>
<header className="workspace-head">
<div>
<Trail items={caseTrail(record, id, group, scope, activeChapter)} />
<p className="eyebrow">{record.kind_label || "Akte"} · {record.home_scope_name}</p>
<h1>{record.title}</h1>
<p className="muted">{record.status === "open" ? "Offen" : "Geschlossen"}</p>
<Trail items={record.trail} />
<div className="title-row">
<h1>{record.title}</h1>
<span className={record.status === "open" ? "status-pill" : "status-pill is-closed"}>{record.status === "open" ? "Offen" : "Geschlossen"}</span>
</div>
</div>
<div className="page-actions">
{target?.edit ? <button type="button" onClick={() => setModal("add")}>Inhalt hinzufügen</button> : null}
{width < 1500 ? <button type="button" className="quiet" onClick={() => setStructureOpen(true)}>Struktur</button> : null}
{canEdit ? (
<button type="button" className="desktop-add" onClick={() => setModal("add")}>
<NavIcon name="plus" /> Inhalt hinzufügen
</button>
) : null}
<ObjectMenu view={view} onView={setView}>
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("matter")}>Vorgang anlegen und zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("assign")}>Vorhandenen Vorgang zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("subcase")}>Unterakte anlegen</button> : null}
{record.rights.share || record.is_owner ? <button type="button" className="quiet" onClick={() => setModal("share")}>Teilen</button> : null}
</ObjectMenu>
{target && !target.edit ? <p className="muted">In {target.label} fehlt das Bearbeitungsrecht.</p> : null}
</div>
</header>
{!canEdit ? <p className="muted">In {targetLabel} fehlt das Bearbeitungsrecht.</p> : null}
<ErrorNote error={error} />
<div className="record-layout">
<aside className={outlineOpen ? "outline is-open" : "outline"}>
<button type="button" className="outline__toggle" onClick={() => setOutlineOpen((open) => !open)}>{outlineOpen ? "Bereiche schließen" : "Bereiche"}</button>
<div className="outline__body">
<CaseOutline
record={record}
caseId={id}
scope={scope}
chapterId={chapterId}
onScope={(next) => choose(next)}
onChapter={(nextScope, nextChapter) => choose(nextScope, nextChapter)}
/>
</div>
</aside>
<div className="record-main">
<WorkSwitch view={view} onView={setView} />
{view === "contents" ? (
<p className="target-line">
{target ? (
<>Bearbeitet wird <strong>{target.label}</strong>{activeChapter ? <> · Kapitel <strong>{activeChapter.title}</strong></> : null}</>
) : (
"Lesesicht aller Inhalte. Zum Bearbeiten einen Bereich in der Gliederung wählen."
)}
</p>
) : null}
{view === "contents" && scope === "all" ? (
<div className="stack">
<OrderChoice mode="date" direction={dateDir} onChange={(_mode, next) => setDateDir(next)} />
<ContentBoard
record={{ bindings: merged, chapters: [], content_order: "date", content_order_dir: dateDir, rights: { edit: false }, version: record.version }}
bindings={merged}
sortable={false}
containerKind="case"
containerId={id}
onChange={load}
itemHref={(binding) => binding.readerHref}
/>
</div>
) : null}
{view === "contents" && scope === "direct" ? (
<ContentBoard
record={record}
containerKind="case"
containerId={id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => withSelection(`/cases/${id}/items/${binding.id}`, params)}
/>
) : null}
{view === "contents" && group ? (
<ContentBoard
record={{ ...group, rights: group.rights, chapters: group.chapters || [] }}
bindings={group.bindings}
context={context}
containerKind="matter"
containerId={group.matter_id}
onlyChapter={chapterId}
onChange={load}
itemHref={(binding) => withSelection(`/matters/${group.matter_id}/items/${binding.id}?context_kind=case&context_id=${id}`, params)}
/>
) : null}
{view === "contents" && scope !== "all" && scope !== "direct" && !group ? (
<p className="muted">Dieser Bereich hat in der Akte keine eigenen Unterlagen.</p>
) : null}
{view === "work" ? <WorkLists record={record} context={context} onChange={load} /> : null}
{view === "course" || view === "audit" ? (
<SurfaceView view={view} coursePath={`/api/v1/cases/${id}/course`} auditPath={`/api/v1/cases/${id}/chronology`} />
) : null}
{view === "links" ? (
<div className="stack">
<h2>Zuordnungen</h2>
<p className="muted">Unterakten, Vorgänge und Freigaben dieses Objekts.</p>
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("matter")}>Vorgang anlegen und zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("assign")}>Vorhandenen Vorgang zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("subcase")}>Unterakte anlegen</button> : null}
</div>
) : null}
<WorkSwitch view={view} onView={setView} />
{view === "contents" && overview ? (
<div className="stack">
<p className="muted">Überblick über direkte Inhalte und Inhalte der zugeordneten Vorgänge. Herkunft steht an jeder Zeile. Neue Inhalte und die eigene Reihenfolge gelten in der Akte oder im geöffneten Vorgang.</p>
<OrderChoice mode="date" direction={dateDir} onChange={(_mode, next) => setDateDir(next)} />
<ContentBoard
record={{ bindings: merged, chapters: [], content_order: "date", content_order_dir: dateDir, rights: { edit: false }, version: record.version }}
bindings={merged}
sortable={false}
listTitle="Überblick"
containerKind="case"
containerId={id}
onChange={load}
itemHref={(binding) => binding.readerHref}
/>
</div>
</div>
) : null}
{view === "contents" && !overview ? (
<ContentBoard
record={record}
containerKind="case"
containerId={id}
onlyChapter={chapterId}
selectedId={entryId}
listTitle={activeChapter ? activeChapter.title : "Alle Inhalte"}
onOpen={openEntry}
onChange={load}
itemHref={(binding) => {
const search = new URLSearchParams();
search.set("eintrag", binding.id);
if (binding.chapter_id) search.set("kapitel", binding.chapter_id);
return `/cases/${id}?${search}`;
}}
/>
) : null}
{view === "work" ? <WorkLists record={record} context={context} onChange={load} /> : null}
{view === "course" || view === "audit" ? (
<SurfaceView view={view} coursePath={`/api/v1/cases/${id}/course`} auditPath={`/api/v1/cases/${id}/chronology`} />
) : null}
{view === "links" ? (
<div className="stack">
<h2>Zuordnungen</h2>
<p className="muted">Unterakten, Vorgänge und Freigaben dieses Objekts.</p>
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("matter")}>Vorgang anlegen und zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("assign")}>Vorhandenen Vorgang zuordnen</button> : null}
{record.rights.edit ? <button type="button" className="quiet" onClick={() => setModal("subcase")}>Unterakte anlegen</button> : null}
</div>
) : null}
{canEdit && view === "contents" && !overview ? (
<button type="button" className="mobile-add" onClick={() => setModal("add")}>
<NavIcon name="plus" /> Inhalt hinzufügen
</button>
) : null}
</Workspace>
<Modal open={modal === "matter"} title="Vorgang anlegen und zuordnen" onClose={() => setModal("")}>
<NewMatter caseId={id} homeScopeId={record.home_scope_id} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "assign"} title="Vorhandenen Vorgang zuordnen" onClose={() => setModal("")}>
<AssignMatter caseId={id} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "add" && Boolean(target)} title={target ? `Hinzufügen in ${target.label}` : "Hinzufügen"} onClose={() => setModal("")}>
<TargetLine label={target?.label} chapters={target?.chapters} chapterId={activeChapter?.id || ""} />
<Modal open={modal === "add"} title={`Hinzufügen in ${targetLabel}`} onClose={() => setModal("")}>
<TargetLine label={targetLabel} chapters={record.chapters} chapterId={activeChapter?.id || ""} />
<div className="add-choices">
<button type="button" onClick={() => setModal("chapter")}>Kapitel</button>
<button type="button" onClick={() => setModal("note")}>Notiz</button>
@@ -426,29 +576,29 @@ export function CaseDetail() {
<button type="button" onClick={() => setModal("mail")}>E-Mail</button>
</div>
</Modal>
<Modal open={modal === "note" && Boolean(target)} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={context} placement={addPlacement} chapters={target?.chapters || []} initialChapter={activeChapter?.id || ""} targetLabel={target?.label || ""} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "note"} title="Notiz" onClose={() => setModal("")}>
<NoteForm context={context} chapters={record.chapters} initialChapter={activeChapter?.id || ""} targetLabel={targetLabel} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "file" && Boolean(target)} title="Datei" onClose={() => setModal("")}>
<FileForm context={context} placement={addPlacement} chapters={target?.chapters || []} initialChapter={activeChapter?.id || ""} targetLabel={target?.label || ""} onChange={() => { setModal(""); load(); }} />
<Modal open={modal === "file"} title="Datei" onClose={() => setModal("")}>
<FileForm context={context} chapters={record.chapters} initialChapter={activeChapter?.id || ""} targetLabel={targetLabel} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "paperless" && Boolean(target)} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={context} placement={addPlacement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={target?.label || ""} onDone={() => { setModal(""); load(); }} />
<Modal open={modal === "paperless"} title="Aus Paperless" onClose={() => setModal("")}>
<PaperlessPicker context={context} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={targetLabel} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "mail" && Boolean(target)} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={context} placement={addPlacement} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={target?.label || ""} onDone={() => { setModal(""); load(); }} />
<Modal open={modal === "mail"} title="E-Mail verbinden" wide onClose={() => setModal("")}>
<MailPicker context={context} chapterId={activeChapter?.id || ""} chapterTitle={activeChapter?.title || ""} targetLabel={targetLabel} onDone={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "subcase"} title="Unterakte anlegen" onClose={() => setModal("")}>
<NewSubcase parentId={id} onChange={() => { setModal(""); load(); }} />
</Modal>
<Modal open={modal === "chapter" && Boolean(target)} title={target ? `Kapitel in ${target.label} hinzufügen` : "Kapitel hinzufügen"} onClose={() => setModal("")}>
<Modal open={modal === "chapter"} title={`Kapitel in ${targetLabel} hinzufügen`} onClose={() => setModal("")}>
<ChapterForm
path={target?.chapterPath || ""}
path={`/api/v1/cases/${id}/chapters`}
onChange={(created) => {
setModal("");
if (created?.id && target) {
if (created?.id) {
pendingChapter.current = created.id;
writeSelection(params, setParams, target.scope, created.id);
writeSelection(params, setParams, "direct", created.id);
}
load();
}}
@@ -457,7 +607,7 @@ export function CaseDetail() {
<Modal open={modal === "share"} title="Teilen" onClose={() => setModal("")}>
<ShareBox path={`/api/v1/cases/${id}/grants`} grants={record.grants || []} onChange={load} />
</Modal>
</main>
</>
);
}