diff --git a/frontend/src/pages/Matters.jsx b/frontend/src/pages/Matters.jsx
index 3bbf69b..10bf639 100644
--- a/frontend/src/pages/Matters.jsx
+++ b/frontend/src/pages/Matters.jsx
@@ -445,6 +445,7 @@ export function MatterDetail() {
nodes={nodes}
chapters={chapters}
chapterId={chapterId}
+ allLabel=""
allCount={(record.bindings || []).length}
chapterHeading={`Kapitel in ${record.title}`}
onChapter={chooseChapter}
diff --git a/frontend/src/pages/Sources.jsx b/frontend/src/pages/Sources.jsx
index a3b0123..91b86a0 100644
--- a/frontend/src/pages/Sources.jsx
+++ b/frontend/src/pages/Sources.jsx
@@ -135,17 +135,21 @@ function MailForm({ onSaved, onError }) {
);
}
+function paperlessLabel(item) {
+ const dated = formatDate(item.document_on);
+ return dated !== "Ohne Datum" ? `${dated} · ${item.title}` : item.title;
+}
+
export function PaperlessPicker({ context, placement, chapterId = "", chapterTitle = "", targetLabel = "", onDone, onInserted }) {
const [query, setQuery] = useState("");
const [items, setItems] = useState([]);
- const [picked, setPicked] = useState(() => new Set());
+ const [picked, setPicked] = useState(() => new Map());
const [pending, setPending] = useState(false);
const [error, setError] = useState("");
async function search(event) {
event.preventDefault();
setError("");
- setPicked(new Set());
try {
const data = await api(`/api/v1/sources/paperless/documents?q=${encodeURIComponent(query)}`);
setItems(data.items);
@@ -154,17 +158,18 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit
}
}
- function toggle(id) {
+ function toggle(item) {
+ const key = String(item.id);
setPicked((current) => {
- const next = new Set(current);
- if (next.has(id)) next.delete(id);
- else next.add(id);
+ const next = new Map(current);
+ if (next.has(key)) next.delete(key);
+ else next.set(key, item);
return next;
});
}
async function linkMany() {
- const chosen = items.filter((item) => picked.has(item.id));
+ const chosen = [...picked.values()];
if (!chosen.length) return;
setError("");
setPending(true);
@@ -191,7 +196,7 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit
: {}),
},
});
- inserted.push(item.id);
+ inserted.push(String(item.id));
}
} catch (err) {
setError(err.message);
@@ -199,9 +204,9 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit
setPending(false);
}
if (inserted.length) {
- setItems((current) => current.filter((item) => !inserted.includes(item.id)));
+ setItems((current) => current.filter((item) => !inserted.includes(String(item.id))));
setPicked((current) => {
- const next = new Set(current);
+ const next = new Map(current);
inserted.forEach((id) => next.delete(id));
return next;
});
@@ -219,16 +224,22 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit
Die Verbindung richtest du unter Quellen ein. Mehrere Treffer lassen sich zusammen einfügen.
- {items.length ? (
+ {items.length || picked.size ? (
) : null}
+ {[...picked.values()].filter((item) => !items.some((entry) => String(entry.id) === String(item.id))).map((item) => (
+
+ ))}
{items.map((item) => (
))}
diff --git a/frontend/src/pages/content.jsx b/frontend/src/pages/content.jsx
index 383a316..7fb4096 100644
--- a/frontend/src/pages/content.jsx
+++ b/frontend/src/pages/content.jsx
@@ -640,6 +640,20 @@ function ChapterHeading({
}
return (
<>
+ {real ? (
+
+ ) : null}
{real ? : null}
{section.title}
diff --git a/frontend/src/pages/workspace.jsx b/frontend/src/pages/workspace.jsx
index ab40bc6..d2f946b 100644
--- a/frontend/src/pages/workspace.jsx
+++ b/frontend/src/pages/workspace.jsx
@@ -159,13 +159,15 @@ function scopeContents({ chapters, chapterId, allLabel, overview, onChapter, can
onSelect: overview.onSelect,
});
}
- items.push({
- id: "all-contents",
- title: allLabel,
- kind: "Inhalte",
- current: !chapterId && !overview?.active,
- onSelect: () => onChapter?.(""),
- });
+ if (allLabel) {
+ items.push({
+ id: "all-contents",
+ title: allLabel,
+ kind: "Inhalte",
+ current: !chapterId && !overview?.active,
+ onSelect: () => onChapter?.(""),
+ });
+ }
const byParent = new Map();
chapters.forEach((chapter) => {
const key = chapter.parent_chapter_id || "";
@@ -192,16 +194,23 @@ function scopeContents({ chapters, chapterId, allLabel, overview, onChapter, can
return items;
}
-function attachScope(nodes, extras) {
+function attachScope(nodes, extras, onContainerSelect) {
return (nodes || []).map((node) => {
- const children = attachScope(node.children, extras);
+ const children = attachScope(node.children, extras, onContainerSelect);
if (!node.current) return { ...node, children };
- return { ...node, children: [...extras, ...children] };
+ const nested = [...extras, ...children];
+ const childCurrent = Boolean(onContainerSelect) && nested.some(branchHasCurrent);
+ return {
+ ...node,
+ current: onContainerSelect ? !childCurrent : node.current,
+ ...(onContainerSelect ? { onSelect: onContainerSelect } : {}),
+ children: nested,
+ };
});
}
-function treeWithScope(nodes, extras) {
- const attached = attachScope(nodes, extras);
+function treeWithScope(nodes, extras, onContainerSelect) {
+ const attached = attachScope(nodes, extras, onContainerSelect);
if (attached.some(branchHasCurrent)) return attached;
return [...extras, ...attached];
}
@@ -224,7 +233,8 @@ export function StructureNavigator({
}) {
const [opened, setOpened] = useState(() => new Set());
const [closed, setClosed] = useState(() => new Set());
- const tree = treeWithScope(nodes, scopeContents({ chapters, chapterId, allLabel, overview, onChapter, canReorder, onMoveChapter }));
+ const extras = scopeContents({ chapters, chapterId, allLabel, overview, onChapter, canReorder, onMoveChapter });
+ const tree = treeWithScope(nodes, extras, allLabel ? null : () => onChapter?.(""));
function isOpen(node, unfold) {
if (!node.children?.length) return false;
diff --git a/frontend/src/styles.css b/frontend/src/styles.css
index 0b94bf6..d4e7afc 100644
--- a/frontend/src/styles.css
+++ b/frontend/src/styles.css
@@ -581,6 +581,24 @@ button.nav-item:active { transform: none; }
border-radius: 8px;
}
.chapter-plus svg { width: 18px; height: 18px; }
+.chapter-fold {
+ width: 28px;
+ min-width: 28px;
+ height: 28px;
+ min-height: 28px;
+ padding: 0;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ flex: none;
+ border: 0;
+ border-radius: 6px;
+ background: transparent;
+ color: var(--brand);
+ font-size: 16px;
+ line-height: 1;
+}
+.chapter-fold:hover, .chapter-fold:focus-visible { background: var(--accent-light); }
.chapter-menu, .record-tools, .chapter-move { display: inline-flex; gap: 0; flex: 0 0 auto; align-items: center; }
.icon-button--compact { width: 32px; min-width: 32px; height: 32px; }
.icon-button--compact svg { width: 16px; height: 16px; }
@@ -1256,25 +1274,34 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border:
}
.chapter-link__move { display: flex; gap: 2px; flex: none; align-items: center; }
.chapter-link__move button {
- min-height: 44px;
- width: 44px;
- height: 44px;
+ min-height: 28px;
+ width: 28px;
+ height: 28px;
padding: 0;
- font-size: 16px;
+ font-size: 14px;
font-weight: 600;
background: transparent;
color: var(--text3);
border-radius: 4px;
}
.nav-tree__toggle {
- width: 44px;
- min-width: 44px;
- height: 44px;
+ width: 22px;
+ min-width: 22px;
+ height: 28px;
+ min-height: 28px;
padding: 0;
border: 0;
+ border-radius: 4px;
background: transparent;
color: var(--text2);
- font-size: 16px;
+ font-size: 13px;
+ line-height: 1;
+}
+.structure .chapter-add {
+ min-height: 32px;
+ padding: 4px 10px;
+ margin-top: 6px;
+ font-size: 13px;
}
.nav-tree__toggle.is-empty { visibility: hidden; }
.nav-tree__kind {