Richte die Exportauswahl am bestehenden Baum aus.
Deploy Development / deploy (push) Successful in 25s

Kleine Kaestchen, linksbündige Zeilen und die Inhaltssymbole machen die Auswahl lesbar. Der Pruefbericht haelt das Ergebnis der ersten Exportlieferung fest.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 20:19:36 +02:00
1 parent 95381030bc
commit 060d99bda0
5 files changed
+144 -29

No files matched your search

+49 -18
View File
@@ -1,5 +1,6 @@
import { useEffect, useRef, useState } from "react";
import { api, downloadPost } from "../api.js";
import { symbolUrl } from "../content-symbol.mjs";
function leafIds(node, into = []) {
if (!node) return into;
@@ -56,28 +57,55 @@ function CheckBox({ state, disabled, onChange, label }) {
);
}
function TreeRows({ node, depth, selected, onToggle }) {
function ContentMark({ name }) {
return (
<span className="export-tree__mark" aria-hidden="true">
<img className="type-glyph type-glyph--light" src={symbolUrl("light", name)} width="16" height="16" alt="" />
<img className="type-glyph type-glyph--dark" src={symbolUrl("dark", name)} width="16" height="16" alt="" />
</span>
);
}
function symbolFor(node) {
if (node.kind === "chapter") return "chapter";
if (node.kind === "matter") return node.label === "Teilvorgang" ? "submatter" : "matter";
if (node.kind === "annotation" || node.content_kind === "note") return "note";
if (node.content_kind === "email") return "email";
if (node.content_kind === "paperless") return "source-archive";
if (node.content_kind === "url") return "link";
return "file";
}
function TreeBranch({ node, selected, onToggle }) {
const state = checkState(node, selected);
const ids = leafIds(node);
const branch = node.kind === "matter" || node.kind === "chapter";
return (
<>
<label className="export-tree__row" style={{ paddingLeft: `${depth * 16}px` }}>
<li>
<label className={branch ? "export-tree__row is-branch" : "export-tree__row"}>
<CheckBox
state={state}
disabled={!ids.length}
label={node.title}
label={node.label ? `${node.label}: ${node.title}` : node.title}
onChange={() => onToggle(node, state !== "on")}
/>
<span>
<strong>{node.title}</strong>
{node.label ? <span className="muted"> {node.label}</span> : null}
{node.reason ? <span className="export-reason"> {node.reason}</span> : null}
<ContentMark name={symbolFor(node)} />
<span className="export-tree__text">
<span className="export-tree__line">
<span className="export-tree__title">{node.title}</span>
{node.label ? <span className="export-tree__kind">{node.label}</span> : null}
</span>
{node.reason ? <span className="export-reason">{node.reason}</span> : null}
</span>
</label>
{(node.children || []).map((child) => (
<TreeRows key={child.id} node={child} depth={depth + 1} selected={selected} onToggle={onToggle} />
))}
</>
{node.children?.length ? (
<ul>
{node.children.map((child) => (
<TreeBranch key={child.id} node={child} selected={selected} onToggle={onToggle} />
))}
</ul>
) : null}
</li>
);
}
@@ -153,7 +181,7 @@ export function ExportPackage({ matterId, context, onClose }) {
return (
<div className="stack export-package">
<p className="muted">
<p className="export-lead">
Die Auswahl gilt für diese Ausgabe. Ein bereits heruntergeladenes Paket verändert sich nicht,
wenn danach Inhalte geändert oder ergänzt werden.
</p>
@@ -161,9 +189,9 @@ export function ExportPackage({ matterId, context, onClose }) {
{!tree ? <p className="muted">Auswahl wird geladen …</p> : null}
{tree && !review ? (
<>
<div className="export-tree" role="group" aria-label="Exportauswahl">
<TreeRows node={tree} depth={0} selected={selected} onToggle={toggle} />
</div>
<ul className="export-tree" role="group" aria-label="Exportauswahl">
<TreeBranch node={tree} selected={selected} onToggle={toggle} />
</ul>
<div className="export-actions">
<button type="button" onClick={examine} disabled={pending || selected.size === 0}>
{pending ? "Prüfung läuft …" : "Auswahl prüfen"}
@@ -203,8 +231,11 @@ export function ExportPackage({ matterId, context, onClose }) {
<ul className="export-entries">
{(review.entries || []).map((entry) => (
<li key={entry.node_id}>
{entry.kind_label}: {entry.title}
{entry.path ? <span className="muted"> · {entry.path}</span> : null}
<span className="export-tree__line">
<span className="export-tree__title">{entry.title}</span>
{entry.kind_label ? <span className="export-tree__kind">{entry.kind_label}</span> : null}
</span>
{entry.path ? <span className="export-tree__kind">{entry.path}</span> : null}
</li>
))}
</ul>