Stelle die Struktur als Hierarchie des gewaehlten Objekts dar und halte die Ordnerschrift im Postfach klein, ausser auf dem gewaehlten Pfad.
Deploy Development / deploy (push) Successful in 26s
Test Suite / pytest-backend (push) Successful in 1m2s
Test Suite / smoke-dev (push) Successful in 0s
Test Suite / frontend-build (push) Successful in 8s

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-10-17 17:46:59 +02:00
1 parent f27df3ff35
commit 20625b4596
4 files changed
+170 -118

No files matched your search

+7 -4
View File
@@ -220,12 +220,14 @@ function ancestorNames(folders, name) {
return names;
}
function FolderBranch({ node, mailbox, expanded, onToggle, onSelect }) {
function FolderBranch({ node, mailbox, path, expanded, onToggle, onSelect }) {
const open = expanded.has(node.name);
const current = node.name === mailbox;
const onPath = path.has(node.name);
const rowClass = current ? "folder-row is-current" : onPath ? "folder-row is-ancestor" : "folder-row";
return (
<li>
<div className={current ? "folder-row is-current" : "folder-row"}>
<div className={rowClass}>
{node.children.length ? (
<button type="button" className="folder-twist" aria-expanded={open} aria-label={open ? `${node.label} zuklappen` : `${node.label} aufklappen`} onClick={() => onToggle(node.name)}>
{open ? "▾" : "▸"}
@@ -243,7 +245,7 @@ function FolderBranch({ node, mailbox, expanded, onToggle, onSelect }) {
{node.children.length && open ? (
<ul>
{node.children.map((child) => (
<FolderBranch key={child.name} node={child} mailbox={mailbox} expanded={expanded} onToggle={onToggle} onSelect={onSelect} />
<FolderBranch key={child.name} node={child} mailbox={mailbox} path={path} expanded={expanded} onToggle={onToggle} onSelect={onSelect} />
))}
</ul>
) : null}
@@ -270,6 +272,7 @@ function FolderTree({ folders, mailbox, onSelect }) {
});
}, [folders, mailbox]);
const roots = folderTree(folders);
const path = new Set([mailbox, ...ancestorNames(folders, mailbox)]);
function toggle(name) {
setExpanded((current) => {
const next = new Set(current);
@@ -283,7 +286,7 @@ function FolderTree({ folders, mailbox, onSelect }) {
<nav className="mailbox__folders" aria-label="Fächer">
<ul className="folder-tree">
{roots.map((node) => (
<FolderBranch key={node.name} node={node} mailbox={mailbox} expanded={expanded} onToggle={toggle} onSelect={onSelect} />
<FolderBranch key={node.name} node={node} mailbox={mailbox} path={path} expanded={expanded} onToggle={toggle} onSelect={onSelect} />
))}
</ul>
</nav>
+2
View File
@@ -26,6 +26,8 @@ export function NavIcon({ name }) {
if (name === "close") return <svg {...common}><path d="M6 6l12 12M18 6 6 18" /></svg>;
if (name === "plus") return <svg {...common}><path d="M12 5v14M5 12h14" /></svg>;
if (name === "link") return <svg {...common}><path d="M10 13a5 5 0 0 0 7.1.1l1.4-1.5a5 5 0 0 0-7.1-7.1L10 6" /><path d="M14 11a5 5 0 0 0-7.1-.1L5.5 12.4a5 5 0 0 0 7.1 7.1L14 18" /></svg>;
if (name === "chapter") return <svg {...common}><path d="M7 4.5h8.5a2 2 0 0 1 2 2V20l-6.5-3L4.5 20V6.5a2 2 0 0 1 2-2z" /></svg>;
if (name === "contents") return <svg {...common}><path d="M5 6h14M5 12h14M5 18h10" /></svg>;
return <svg {...common}><circle cx="12" cy="12" r="8" /></svg>;
}
+120 -98
View File
@@ -51,53 +51,132 @@ export function Workspace({ width, structureOpen, setStructureOpen, hasEntry, na
);
}
function TreeNodes({ nodes, onNavigate }) {
function structureIcon(kind) {
if (kind === "Akte" || kind === "Unterakte") return "folder";
if (kind === "Kapitel") return "chapter";
if (kind === "Inhalte") return "contents";
if (kind === "Querverweis" || kind === "Weitere Akte") return "link";
return "layers";
}
function branchHasCurrent(node) {
if (node.current) return true;
return (node.children || []).some(branchHasCurrent);
}
function TreeRow({ node, onNavigate, ancestor = false }) {
const className = node.current ? "nav-tree__link is-current" : ancestor ? "nav-tree__link is-ancestor" : "nav-tree__link";
const icon = <NavIcon name={structureIcon(node.kind)} />;
const label = <span className="nav-tree__title">{node.title}</span>;
const name = `${node.kind}: ${node.title}`;
let row;
if (node.onSelect) {
row = (
<button type="button" className={className} aria-current={node.current ? "true" : undefined} aria-label={name} title={name} onClick={() => { node.onSelect(); onNavigate?.(); }}>
{icon}
{label}
</button>
);
} else if (node.href) {
row = (
<Link className={className} to={node.href} aria-current={node.current ? "page" : undefined} aria-label={name} title={name} onClick={onNavigate}>
{icon}
{label}
</Link>
);
} else {
row = (
<span className={className} title={name}>
{icon}
{label}
</span>
);
}
if (node.moveUp === undefined && node.moveDown === undefined) return row;
return (
<div className="nav-tree__line">
{row}
<span className="chapter-link__move">
<button type="button" aria-label={`${node.title} nach oben`} disabled={!node.moveUp} onClick={node.moveUp}>↑</button>
<button type="button" aria-label={`${node.title} nach unten`} disabled={!node.moveDown} onClick={node.moveDown}>↓</button>
</span>
</div>
);
}
function TreeNodes({ nodes, onNavigate, unfold = false }) {
if (!nodes?.length) return null;
return (
<ul className="nav-tree">
{nodes.map((node) => (
<li key={node.id}>
{node.href ? (
<Link
className={node.current ? "nav-tree__link is-current" : "nav-tree__link"}
to={node.href}
aria-current={node.current ? "page" : undefined}
title={node.title}
onClick={onNavigate}
>
<NavIcon name={node.kind === "Querverweis" ? "link" : node.kind === "Akte" || node.kind === "Unterakte" ? "folder" : "layers"} />
<span>
<span className="nav-tree__kind">{node.kind}</span>
<span className="nav-tree__title">{node.title}</span>
</span>
</Link>
) : (
<span className="nav-tree__link is-current">
<NavIcon name="layers" />
<span>
<span className="nav-tree__kind">{node.kind}</span>
<span className="nav-tree__title">{node.title}</span>
</span>
</span>
)}
{node.children?.length ? <TreeNodes nodes={node.children} onNavigate={onNavigate} /> : null}
</li>
))}
{nodes.map((node) => {
const open = unfold || node.current || branchHasCurrent(node);
return (
<li key={node.id}>
<TreeRow node={node} onNavigate={onNavigate} ancestor={!node.current && branchHasCurrent(node)} />
{open && node.children?.length ? (
<TreeNodes nodes={node.children} onNavigate={onNavigate} unfold={unfold || node.current} />
) : null}
</li>
);
})}
</ul>
);
}
function scopeContents({ chapters, chapterId, allLabel, overview, onChapter, canReorder, onMoveChapter }) {
const items = [];
if (overview) {
items.push({
id: "overview",
title: "Überblick",
kind: "Inhalte",
current: Boolean(overview.active),
onSelect: overview.onSelect,
});
}
items.push({
id: "all-contents",
title: allLabel,
kind: "Inhalte",
current: !chapterId && !overview?.active,
onSelect: () => onChapter?.(""),
});
chapters.forEach((chapter, index) => {
items.push({
id: chapter.id,
title: chapter.title,
kind: "Kapitel",
current: chapterId === chapter.id,
onSelect: () => onChapter?.(chapter.id),
...(canReorder ? {
moveUp: index > 0 ? () => onMoveChapter(chapter.id, -1) : null,
moveDown: index < chapters.length - 1 ? () => onMoveChapter(chapter.id, 1) : null,
} : {}),
});
});
return items;
}
function attachScope(nodes, extras) {
return (nodes || []).map((node) => {
const children = attachScope(node.children, extras);
if (!node.current) return { ...node, children };
return { ...node, children: [...extras, ...children] };
});
}
function treeWithScope(nodes, extras) {
const attached = attachScope(nodes, extras);
if (attached.some(branchHasCurrent)) return attached;
return [...extras, ...attached];
}
export function StructureNavigator({
contexts = [],
contextValue = "",
onContext,
nodes = [],
chapters = [],
chapterId = "",
allCount = 0,
allLabel = "Alle Inhalte",
overview = null,
chapterHeading,
onChapter,
onAddChapter,
canAddChapter = false,
@@ -107,6 +186,7 @@ export function StructureNavigator({
onNavigate,
onClose,
}) {
const tree = treeWithScope(nodes, scopeContents({ chapters, chapterId, allLabel, overview, onChapter, canReorder, onMoveChapter }));
return (
<nav className="structure" aria-label="Struktur">
<div className="structure__bar">
@@ -118,71 +198,13 @@ export function StructureNavigator({
) : null}
</div>
<div className="structure__tree">
<label className="context-select">
Aktenkontext
<select
aria-label="Aktenkontext"
value={contextValue}
onChange={(event) => onContext?.(event.target.value)}
disabled={!onContext || contexts.length < 2}
>
{contexts.length ? contexts.map((item) => (
<option key={item.id} value={item.id}>{item.label}</option>
)) : <option value="">Ohne Akte</option>}
</select>
</label>
<TreeNodes nodes={nodes} onNavigate={onNavigate} />
{links.length ? (
<div className="structure__links">
<h3>Weitere Zuordnungen</h3>
<ul className="nav-tree">
{links.map((item) => (
<li key={item.id}>
<Link className="nav-tree__link" to={item.href} onClick={onNavigate}>
<NavIcon name="link" />
<span>
<span className="nav-tree__kind">{item.kind}</span>
<span className="nav-tree__title">{item.title}</span>
</span>
</Link>
</li>
))}
</ul>
</div>
) : null}
</div>
<div className="structure__chapters">
<h3>{chapterHeading}</h3>
{overview ? (
<button type="button" className={overview.active ? "chapter-link is-current" : "chapter-link"} onClick={overview.onSelect}>
<span>Überblick</span>
<span className="count">{overview.count}</span>
</button>
<TreeNodes nodes={tree} onNavigate={onNavigate} />
{links.length ? (
<div className="structure__links">
<h3>Weitere Zuordnungen</h3>
<TreeNodes nodes={links} onNavigate={onNavigate} unfold />
</div>
) : null}
<button type="button" className={!chapterId && !overview?.active ? "chapter-link is-current" : "chapter-link"} onClick={() => onChapter("")}>
<span>{allLabel}</span>
<span className="count">{allCount}</span>
</button>
<ul className="chapter-links">
{chapters.map((chapter, index) => (
<li key={chapter.id}>
<button
type="button"
className={chapterId === chapter.id ? "chapter-link is-current" : "chapter-link"}
onClick={() => onChapter(chapter.id)}
>
<span>{chapter.title}</span>
<span className="count">{chapter.count}</span>
</button>
{canReorder ? (
<span className="chapter-link__move">
<button type="button" aria-label={`${chapter.title} nach oben`} disabled={index === 0} onClick={() => onMoveChapter(chapter.id, -1)}>↑</button>
<button type="button" aria-label={`${chapter.title} nach unten`} disabled={index === chapters.length - 1} onClick={() => onMoveChapter(chapter.id, 1)}>↓</button>
</span>
) : null}
</li>
))}
</ul>
{canAddChapter ? (
<button type="button" className="quiet chapter-add" onClick={onAddChapter}>
<NavIcon name="plus" /> Kapitel
+41 -16
View File
@@ -469,11 +469,12 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(-
.folder-tree ul { margin-left: 11px; padding-left: 8px; border-left: 1px solid var(--border); }
.folder-row { display: flex; align-items: center; gap: 0; min-height: 28px; border-radius: 4px; }
.folder-row.is-current { background: var(--accent-light); }
.folder-twist, .folder-name { background: transparent; border: 0; color: inherit; min-height: 28px; padding: 0; justify-content: flex-start; text-align: left; }
.folder-twist { width: 22px; flex: none; }
.folder-name { flex: 1; display: flex; align-items: flex-start; gap: 6px; text-align: left; padding: 2px 6px; font: inherit; font-weight: 500; cursor: pointer; min-width: 0; line-height: 1.3; }
.folder-name span { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; }
.folder-name svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.folder-twist, .folder-name { background: transparent; border: 0; color: inherit; min-height: 22px; padding: 0; justify-content: flex-start; text-align: left; font-size: 13px; font-weight: 400; line-height: 1.25; }
.folder-twist { width: 16px; min-width: 16px; flex: none; }
.folder-name { flex: 1; display: flex; align-items: flex-start; gap: 6px; text-align: left; padding: 1px 4px; cursor: pointer; min-width: 0; }
.folder-row.is-current .folder-name, .folder-row.is-ancestor .folder-name { font-weight: 700; }
.folder-name span { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; font-weight: inherit; }
.folder-name svg { width: 14px; height: 14px; flex: 0 0 14px; margin-top: 1px; }
.order-choice { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; max-width: 36rem; font-size: 14px; }
.order-choice select { width: auto; min-width: 16rem; flex: 1; }
.target-line { margin: 0; color: var(--text2); overflow-wrap: break-word; }
@@ -938,31 +939,42 @@ p.bezug__link { cursor: default; }
.surface-tabs button[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--accent); }
.structure { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; padding: 12px 10px 12px; overflow: hidden; }
.structure__tree, .structure__chapters { min-height: 0; overflow: auto; }
.structure__tree { flex: 1 1 46%; }
.structure__tree { flex: 1 1 auto; }
.structure__chapters { flex: 1 1 54%; border-top: 1px solid var(--border); padding-top: 8px; }
.structure__bar, .structure h2 { display: flex; align-items: center; justify-content: space-between; margin: 0; font-size: 20px; }
.structure h3 { margin: 8px 0 4px; font-size: 13px; color: var(--text2); font-weight: 700; }
.context-select select { background: #fff; }
.nav-tree, .chapter-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-tree ul { margin: 0; padding: 0 0 0 14px; }
.nav-tree__link, .chapter-link {
.nav-tree__line { display: flex; align-items: center; gap: 2px; min-width: 0; }
.nav-tree__line .nav-tree__link { flex: 1; min-width: 0; }
.nav-tree__link, .chapter-link, button.nav-tree__link {
display: flex;
align-items: center;
align-items: flex-start;
justify-content: flex-start;
gap: 8px;
width: 100%;
min-height: 32px;
padding: 4px 8px;
min-height: 28px;
padding: 3px 6px;
border: 0;
border-radius: 6px;
background: transparent;
color: inherit;
text-align: left;
text-decoration: none;
font-weight: 600;
font-size: 13px;
font-weight: 500;
line-height: 1.3;
}
.nav-tree__link > span { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.nav-tree__link svg {
width: 16px;
height: 16px;
flex: 0 0 16px;
margin-top: 1px;
}
.nav-tree__title { min-width: 0; flex: 1; overflow-wrap: break-word; }
.nav-tree__link.is-current, .chapter-link.is-current { background: var(--accent-light); color: var(--brand); }
.nav-tree__kind { font-size: 11px; color: var(--text3); font-weight: 700; flex: none; }
.nav-tree__link.is-current .nav-tree__title, .nav-tree__link.is-ancestor .nav-tree__title { font-weight: 700; }
.chapter-links { margin-left: 8px; padding-left: 10px; border-left: 1px solid var(--border); }
.chapter-links li { display: flex; align-items: center; gap: 2px; }
.chapter-links li .chapter-link { flex: 1; }
@@ -970,7 +982,8 @@ p.bezug__link { cursor: default; }
.task-row, .task-assign { display: grid; gap: 4px; }
.task-elements { border: 0; margin: 0; padding: 0; display: grid; gap: 4px; }
.task-elements label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.nav-tree__title, .chapter-link span:first-child, .preview-row__main strong, h1 { overflow-wrap: anywhere; }
.nav-tree__title { overflow-wrap: break-word; }
.chapter-link span:first-child, .preview-row__main strong, h1 { overflow-wrap: anywhere; }
.chapter-link { justify-content: space-between; align-items: center; }
.count {
min-width: 1.6rem;
@@ -979,8 +992,20 @@ p.bezug__link { cursor: default; }
font-size: 13px;
font-weight: 650;
}
.chapter-link__move { display: flex; gap: 2px; flex: none; }
.chapter-link__move button { min-height: 28px; min-width: 28px; padding: 0 6px; font-size: 14px; }
.chapter-link__move { display: flex; gap: 2px; flex: none; align-items: center; }
.chapter-link__move button {
min-height: 22px;
width: 22px;
height: 22px;
padding: 0;
font-size: 12px;
font-weight: 600;
background: transparent;
color: var(--text3);
border-radius: 4px;
}
.chapter-link__move button:hover:not(:disabled) { background: var(--accent-light); color: var(--brand); }
.chapter-link__move button:disabled { opacity: 0.35; }
.chapter-add { justify-content: flex-start; }
.content-toolbar { align-items: center; margin-bottom: 12px; }
.content-toolbar h2 { font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--text1); }