Vereine Ablage, Akte und Vorgang in einem Navigationsbaum mit Fokus und Nachladen.
Der Baum Meine Ablage steht jetzt auch auf den Seiten von Akte und Vorgang und ersetzt die Spalte Struktur. Ein Klick öffnet den Eintrag und klappt seine Struktur auf: Überblick, Kapitel und Unterkapitel, Unterakten, Vorgänge und Teilvorgänge. Der Pfad bleibt offen, die aktuelle Zeile ist hervorgehoben und nach dem Neuladen stimmt der Fokus wieder. Ein Vorgang steht unter jeder Akte, in der er liegt, und unter Vorgänge; ein Klick unter einer Akte öffnet ihn in diesem Aktenkontext. So wechselt man direkt von Vorgang zu Vorgang. Kapitel anlegen und verschieben geht im Baum. Die Struktur eines Knotens kommt aus neuen schlanken Endpunkten (cases und matters outline), die nur Lesbares liefern, und wird beim Aufklappen einmal nachgeladen. Die Zweispaltenansicht mit dem Lesebereich beginnt erst, wenn neben dem Baum genug Platz bleibt. Im Browser gegen die lokale Umgebung durchgespielt (Akte, Vorgang unter der Akte, Wechsel zwischen Vorgängen, Kapitel anlegen, Neuladen, Vorgang ohne Akte, Handy, Hell und Dunkel). Die Backend-Suite läuft mit 149 Tests grün, der Frontend-Build und 37 Node-Tests ebenfalls. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
322ad491c1
commit
5f60e1fe40
15 files changed
+688
-471
No files matched your search
+32
-151
@@ -10,7 +10,9 @@ import { chapterPathLabel, siblingChapterIds, trailWithChapter } from "./chapter
|
||||
import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx";
|
||||
import { ContentBoard, DateField, ObjectMenu, Placements, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, matterOpenHref, saveChapterOrder, writeChapter } from "./content.jsx";
|
||||
import { ReadingPane } from "./ReadingPane.jsx";
|
||||
import { StructureNavigator, Workspace, rememberScroll, restoreScroll, useWorkspaceLayout } from "./workspace.jsx";
|
||||
import { Workspace, rememberScroll, restoreScroll, useWorkspaceLayout } from "./workspace.jsx";
|
||||
import { useLibraryFocus } from "../library/LibraryLayout.jsx";
|
||||
import { outlineSignature } from "../library/library-core.js";
|
||||
import { NavIcon } from "./icons.jsx";
|
||||
import { ExportPackage } from "./ExportPackage.jsx";
|
||||
import { RoomShare } from "../admin/RoomShare.jsx";
|
||||
@@ -27,98 +29,6 @@ function contextQuery(inherited) {
|
||||
return inherited ? `?context_kind=${inherited.kind}&context_id=${inherited.id}` : "";
|
||||
}
|
||||
|
||||
function mapMatterNodes(nodes, activeId, query) {
|
||||
return (nodes || []).map((node) => ({
|
||||
id: node.id,
|
||||
title: node.title,
|
||||
kind: node.kind_label || "Vorgang",
|
||||
href: `/matters/${node.id}${query}`,
|
||||
current: node.id === activeId,
|
||||
children: mapMatterNodes(node.children, activeId, query),
|
||||
}));
|
||||
}
|
||||
|
||||
function caseNodes(caseRecord, parentRecord, activeId, contextId) {
|
||||
const query = `?context_kind=case&context_id=${contextId}`;
|
||||
const self = {
|
||||
id: caseRecord.id,
|
||||
title: caseRecord.title,
|
||||
kind: caseRecord.kind_label || "Akte",
|
||||
href: `/cases/${caseRecord.id}`,
|
||||
current: false,
|
||||
children: [
|
||||
...(caseRecord.subcases || []).map((item) => ({
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
kind: "Unterakte",
|
||||
href: `/cases/${item.id}`,
|
||||
current: false,
|
||||
children: [],
|
||||
})),
|
||||
...mapMatterNodes(caseRecord.matters, activeId, query),
|
||||
],
|
||||
};
|
||||
if (!parentRecord) return [self];
|
||||
const siblings = (parentRecord.subcases || []).map((item) => (item.id === caseRecord.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]),
|
||||
...mapMatterNodes(parentRecord.matters, activeId, `?context_kind=case&context_id=${parentRecord.id}`),
|
||||
],
|
||||
}];
|
||||
}
|
||||
|
||||
function placementNodes(record) {
|
||||
const matter = {
|
||||
id: record.id,
|
||||
title: record.title,
|
||||
kind: record.kind_label || "Vorgang",
|
||||
href: null,
|
||||
current: true,
|
||||
children: (record.submatters || []).map((item) => ({
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
kind: "Teilvorgang",
|
||||
href: `/matters/${item.id}`,
|
||||
current: false,
|
||||
children: [],
|
||||
})),
|
||||
};
|
||||
const rooted = record.parent_matter_id && record.parent_title ? [{
|
||||
id: record.parent_matter_id,
|
||||
title: record.parent_title,
|
||||
kind: "Vorgang",
|
||||
href: `/matters/${record.parent_matter_id}`,
|
||||
current: false,
|
||||
children: [matter],
|
||||
}] : [matter];
|
||||
const cases = record.placements || [];
|
||||
if (cases.length < 2) return rooted;
|
||||
return [
|
||||
...rooted,
|
||||
...cases.map((item) => ({
|
||||
id: item.case_id,
|
||||
title: String(item.label || "Akte").replaceAll("Unterakte ", "").replaceAll("Akte ", "").replaceAll(" → ", " / "),
|
||||
kind: "Akte",
|
||||
href: `/matters/${record.id}?context_kind=case&context_id=${item.case_id}`,
|
||||
current: false,
|
||||
children: [],
|
||||
})),
|
||||
];
|
||||
}
|
||||
|
||||
function objectTrail(record, query) {
|
||||
const items = [{ label: "Vorgänge", href: "/matters" }];
|
||||
if (record.parent_matter_id && record.parent_title) {
|
||||
@@ -144,8 +54,6 @@ export function MatterDetail() {
|
||||
const [view, setView] = useState("contents");
|
||||
const { width, structureOpen, setStructureOpen } = useWorkspaceLayout();
|
||||
const listRef = useRef(null);
|
||||
const [caseTree, setCaseTree] = useState(null);
|
||||
const [parentTree, setParentTree] = useState(null);
|
||||
const pendingChapter = useRef("");
|
||||
const entryId = params.get("eintrag") || "";
|
||||
|
||||
@@ -240,33 +148,6 @@ export function MatterDetail() {
|
||||
setParams(next, { replace: true });
|
||||
}, [record, id, inherited?.kind]);
|
||||
|
||||
useEffect(() => {
|
||||
if (inherited?.kind !== "case") {
|
||||
setCaseTree(null);
|
||||
setParentTree(null);
|
||||
return undefined;
|
||||
}
|
||||
let alive = true;
|
||||
api(`/api/v1/cases/${inherited.id}`).then((detail) => {
|
||||
if (!alive) return;
|
||||
setCaseTree(detail);
|
||||
if (!detail.parent_case_id) {
|
||||
setParentTree(null);
|
||||
return;
|
||||
}
|
||||
api(`/api/v1/cases/${detail.parent_case_id}`).then((parent) => {
|
||||
if (alive) setParentTree(parent);
|
||||
}).catch(() => {
|
||||
if (alive) setParentTree(null);
|
||||
});
|
||||
}).catch(() => {
|
||||
if (alive) setCaseTree(null);
|
||||
});
|
||||
return () => {
|
||||
alive = false;
|
||||
};
|
||||
}, [inherited?.kind, inherited?.id]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!record || record.id !== id || !entryId) return;
|
||||
if ((record.bindings || []).some((item) => item.id === entryId)) return;
|
||||
@@ -342,6 +223,25 @@ export function MatterDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
useLibraryFocus(
|
||||
record && record.id === id
|
||||
? {
|
||||
kind: "matter",
|
||||
id,
|
||||
contextId: inherited?.kind === "case" ? inherited.id : "",
|
||||
chapterId,
|
||||
canEdit: Boolean(record.rights?.edit),
|
||||
canReorder: Boolean(record.rights?.edit) && (record.chapters || []).length > 1,
|
||||
stamp: outlineSignature(record),
|
||||
}
|
||||
: null,
|
||||
{ addChapter: (parentId) => openChapter(parentId), moveChapter },
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
setView("contents");
|
||||
}, [chapterId]);
|
||||
|
||||
if (error && !record) return <main className="page"><ErrorNote error={error} /></main>;
|
||||
if (!record) return <main className="page"><p className="muted">Vorgang wird geladen …</p></main>;
|
||||
|
||||
@@ -353,12 +253,6 @@ export function MatterDetail() {
|
||||
...chapter,
|
||||
count: (record.bindings || []).filter((item) => item.chapter_id === chapter.id).length,
|
||||
}));
|
||||
const contexts = (record.placements || []).map((item) => ({
|
||||
id: item.case_id,
|
||||
label: String(item.label || "Akte").replaceAll("Unterakte ", "").replaceAll("Akte ", "").replaceAll(" → ", " / "),
|
||||
}));
|
||||
const contextValue = inherited?.kind === "case" ? inherited.id : (contexts.length === 1 ? contexts[0].id : "");
|
||||
const nodes = caseTree && inherited ? caseNodes(caseTree, parentTree, id, inherited.id) : placementNodes(record);
|
||||
const links = [
|
||||
...(record.cross_links || []).map((item) => ({
|
||||
id: `cross-${item.id}`,
|
||||
@@ -384,28 +278,6 @@ export function MatterDetail() {
|
||||
setStructureOpen={setStructureOpen}
|
||||
hasEntry={Boolean(entry)}
|
||||
listRef={listRef}
|
||||
nav={(
|
||||
<StructureNavigator
|
||||
contexts={contexts.length > 1 && !inherited ? [{ id: "", label: "Keine Akte gewählt" }, ...contexts] : contexts}
|
||||
contextValue={contextValue}
|
||||
onContext={contexts.length > 1 ? switchContext : null}
|
||||
nodes={nodes}
|
||||
chapters={chapters}
|
||||
chapterId={chapterId}
|
||||
allLabel=""
|
||||
allCount={(record.bindings || []).length}
|
||||
chapterHeading={`Kapitel in ${record.title}`}
|
||||
onChapter={chooseChapter}
|
||||
onAddChapter={canEdit ? () => openChapter(chapterId) : null}
|
||||
onAddRootChapter={canEdit ? () => openChapter("") : null}
|
||||
canAddChapter={canEdit}
|
||||
onMoveChapter={moveChapter}
|
||||
canReorder={canEdit && chapters.length > 1}
|
||||
links={links}
|
||||
onNavigate={() => setStructureOpen(false)}
|
||||
onClose={width < 1500 ? () => setStructureOpen(false) : null}
|
||||
/>
|
||||
)}
|
||||
reader={entry ? (
|
||||
<ReadingPane
|
||||
binding={entry}
|
||||
@@ -427,13 +299,22 @@ export function MatterDetail() {
|
||||
<div>
|
||||
<Trail items={trailWithChapter(record.trail?.length ? record.trail : objectTrail(record, query), record.chapters, chapterId, `/matters/${id}${query}`)} />
|
||||
<Placements items={record.placements} />
|
||||
{links.length ? (
|
||||
<p className="placements">
|
||||
{links.map((item, index) => (
|
||||
<span key={item.id}>
|
||||
{index ? <span aria-hidden="true"> · </span> : null}
|
||||
<span className="muted">{item.kind}: </span><Link to={item.href}>{item.title}</Link>
|
||||
</span>
|
||||
))}
|
||||
</p>
|
||||
) : null}
|
||||
<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">
|
||||
{width < 1500 ? <button type="button" className="quiet" onClick={() => setStructureOpen(true)}>Struktur</button> : null}
|
||||
{canEdit ? (
|
||||
<button type="button" className="desktop-add" onClick={() => openAdd(chapterId)}>
|
||||
<NavIcon name="plus" /> Inhalt hinzufügen
|
||||
|
||||
Reference in new issue
Block a user