From deb5d662fe0ae7b7def64973264dc117bf6aa316 Mon Sep 17 00:00:00 2001 From: Lars Date: Sat, 17 Oct 2026 22:46:12 +0200 Subject: [PATCH] Halte die Vorgangsleiste sichtbar und nimm die ueberfluessigen Kapitelworte weg, damit Datum, Bezuege, Titel und mehrere Belege direkt gesetzt werden koennen. Co-authored-by: Cursor --- backend/app/api/routes.py | 20 +++++ backend/app/api/schemas.py | 6 ++ backend/app/ops.py | 13 +++ backend/app/present.py | 1 + backend/tests/test_element_title.py | 47 +++++++++++ frontend/src/pages/Cases.jsx | 47 ++++++----- frontend/src/pages/Matters.jsx | 33 +++++--- frontend/src/pages/ReadingPane.jsx | 28 ++++++- frontend/src/pages/Shell.jsx | 37 +++----- frontend/src/pages/Sources.jsx | 88 +++++++++++++------ frontend/src/pages/content.jsx | 126 ++++++++++++++++++++++++++-- frontend/src/pages/workspace.jsx | 2 +- frontend/src/styles.css | 76 ++++++++++++++++- 13 files changed, 423 insertions(+), 101 deletions(-) create mode 100644 backend/tests/test_element_title.py diff --git a/backend/app/api/routes.py b/backend/app/api/routes.py index 18a8b1c..9df0e11 100644 --- a/backend/app/api/routes.py +++ b/backend/app/api/routes.py @@ -78,6 +78,7 @@ from app.api.schemas import ( TaskDependencyIn, TaskElementsIn, SummaryPatch, + TitlePatch, TaskIn, TaskPatch, ) @@ -142,6 +143,7 @@ from app.ops import ( update_dates, update_note, update_summary, + update_title, ) from app.present import ( LABELS, @@ -1593,6 +1595,24 @@ def patch_element_summary( return {"id": str(element["id"]), "version": element["version"], "summary": element["summary"]} +@router.patch("/api/v1/elements/{element_id}/title") +def patch_element_title( + element_id: UUID, + body: TitlePatch, + principal: Principal = Depends(get_principal), + conn: Connection = Depends(get_conn), +): + element = update_title( + conn, + principal.account_id, + element_id, + body.expected_version, + body.title, + _ctx_model(body.context), + ) + return {"id": str(element["id"]), "version": element["version"], "title": element["title"]} + + @router.patch("/api/v1/bindings/{binding_id}/chapter") def patch_binding_chapter( binding_id: UUID, diff --git a/backend/app/api/schemas.py b/backend/app/api/schemas.py index d7e678a..0d0022e 100644 --- a/backend/app/api/schemas.py +++ b/backend/app/api/schemas.py @@ -220,6 +220,12 @@ class SummaryPatch(APIModel): context: ContextIn | None = None +class TitlePatch(APIModel): + expected_version: int = Field(ge=1) + title: str = Field(min_length=1, max_length=200) + context: ContextIn | None = None + + class ChapterMoveIn(APIModel): expected_version: int = Field(ge=1) chapter_id: UUID | None = None diff --git a/backend/app/ops.py b/backend/app/ops.py index 1332601..dc109fe 100644 --- a/backend/app/ops.py +++ b/backend/app/ops.py @@ -1497,6 +1497,19 @@ def update_summary(conn, actor: UUID, element_id: UUID, expected: int, summary: return get_element(conn, element_id) +def update_title(conn, actor: UUID, element_id: UUID, expected: int, title: str, context: Ctx | None) -> dict: + element, rights = require_element(conn, actor, element_id, context, "edit") + if not rights.edit: + raise forbidden() + cleaned = title.strip() + if not cleaned or len(cleaned) > 200: + raise unprocessable("Der Titel fehlt oder ist zu lang.") + bump_version(conn, "elements", element_id, expected) + conn.execute("UPDATE elements SET title = %s WHERE id = %s", (cleaned, element_id)) + audit(conn, actor, element["home_scope_id"], "title_changed", "element", element_id, context) + return get_element(conn, element_id) + + def move_binding_chapter(conn, actor: UUID, binding_id: UUID, expected: int, chapter_id: UUID | None, context: Ctx | None) -> int: """Move one visible binding inside its container. No new binding and no grant.""" binding = conn.execute("SELECT * FROM bindings WHERE id = %s", (binding_id,)).fetchone() diff --git a/backend/app/present.py b/backend/app/present.py index 9fba596..5b93321 100644 --- a/backend/app/present.py +++ b/backend/app/present.py @@ -954,6 +954,7 @@ LABELS = { "correspondence_recorded": "Erfassung", "chapter_created": "Kapitel angelegt", "summary_changed": "Kurzbeschreibung geändert", + "title_changed": "Titel geändert", "binding_chapter": "In ein Kapitel eingeordnet", "chapters_reordered": "Kapitelreihenfolge geändert", "chapter_dated": "Kapiteldatum geändert", diff --git a/backend/tests/test_element_title.py b/backend/tests/test_element_title.py new file mode 100644 index 0000000..2b29110 --- /dev/null +++ b/backend/tests/test_element_title.py @@ -0,0 +1,47 @@ +"""An entry title can be renamed without touching the document body.""" + +from __future__ import annotations + +from tests.support import Actor, document, register + + +def test_element_title_can_be_renamed(client, db): + ada = Actor(client, "ada-titel@example.test", "Ada Titel") + register(db, ada.email, ada.name) + ada.login() + matter = ada.request("POST", "/api/v1/matters", json={"title": "Vorgang"}, status=201) + ada.request( + "POST", + "/api/v1/notes", + json={ + "title": "Alter Titel", + "document": document("Text"), + "context": {"kind": "matter", "id": matter["id"]}, + }, + status=201, + ) + detail = ada.request("GET", f"/api/v1/matters/{matter['id']}") + element = detail["bindings"][0]["element"] + renamed = ada.request( + "PATCH", + f"/api/v1/elements/{element['id']}/title", + json={ + "expected_version": element["version"], + "title": "Neuer Titel", + "context": {"kind": "matter", "id": matter["id"]}, + }, + ) + assert renamed["title"] == "Neuer Titel" + assert renamed["version"] == element["version"] + 1 + shown = ada.request("GET", f"/api/v1/matters/{matter['id']}") + assert shown["bindings"][0]["element"]["title"] == "Neuer Titel" + ada.request( + "PATCH", + f"/api/v1/elements/{element['id']}/title", + json={ + "expected_version": renamed["version"], + "title": " ", + "context": {"kind": "matter", "id": matter["id"]}, + }, + status=422, + ) diff --git a/frontend/src/pages/Cases.jsx b/frontend/src/pages/Cases.jsx index 0f65b16..ef7e20b 100644 --- a/frontend/src/pages/Cases.jsx +++ b/frontend/src/pages/Cases.jsx @@ -6,7 +6,7 @@ import { chapterPathLabel, siblingChapterIds, trailWithChapter } from "./chapter import { Modal } from "./Modal.jsx"; import { MailPicker, PaperlessPicker } from "./Sources.jsx"; import { ErrorNote, ShareBox } from "./widgets.jsx"; -import { ContentBoard, DirectionChoice, MarkdownEditor, ObjectMenu, OrderChoice, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, saveChapterOrder, writeSelection } from "./content.jsx"; +import { ContentBoard, DateField, DirectionChoice, MarkdownEditor, 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"; @@ -297,6 +297,7 @@ export function CaseDetail() { const [error, setError] = useState(""); const [modal, setModal] = useState(""); const [chapterParentId, setChapterParentId] = useState(""); + const [addChapterId, setAddChapterId] = useState(""); const [view, setView] = useState("contents"); const [dateDir, setDateDir] = useState("asc"); const { width, structureOpen, setStructureOpen } = useWorkspaceLayout(); @@ -441,6 +442,11 @@ export function CaseDetail() { setModal("chapter"); } + function openAdd(targetChapterId = chapterId) { + setAddChapterId(targetChapterId || ""); + setModal("add"); + } + async function moveChapter(chapterIdToMove, delta) { const ids = siblingChapterIds(record?.chapters || [], chapterIdToMove); const index = ids.indexOf(chapterIdToMove); @@ -532,7 +538,7 @@ export function CaseDetail() {
{width < 1500 ? : null} {canEdit ? ( - ) : null} @@ -575,6 +581,7 @@ export function CaseDetail() { selectedId={entryId} listTitle={activeChapter ? chapterPathLabel(record.chapters, activeChapter.id) : "Direkt in dieser Akte"} onAddSubchapter={canEdit ? openChapter : null} + onAddContent={canEdit ? openAdd : null} context={context} onOpen={openEntry} onChange={load} @@ -601,7 +608,7 @@ export function CaseDetail() {
) : null} {canEdit && view === "contents" && !overview ? ( - ) : null} @@ -614,10 +621,10 @@ export function CaseDetail() { setModal("")}>

Dieser Inhalt liegt direkt in der Akte. Er erscheint unter „Direkt in dieser Akte“ und im Überblick, nicht in einem Vorgang.

- +
- - {activeChapter ? : null} + + {addChapterId ? : null} @@ -625,16 +632,16 @@ export function CaseDetail() {
setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> { setModal(""); load(); }} /> @@ -846,7 +853,7 @@ export function ChapterForm({ path, onChange, targetLabel = "", parentChapter = {parentChapter ? <>Elternkapitel: {parentChapter.title} : <>Ebene: oberste Kapitel}

- + @@ -937,9 +944,9 @@ export function NoteForm({ context, placement, chapters = [], initialChapter = " { setText(value); markDirty(true); }} rows={8} /> { setDirection(value); markDirty(true); }} /> - - - + + + {chapterSelect(chapters, chapterId, setChapterId)} @@ -994,9 +1001,9 @@ export function FileForm({ context, placement, chapters = [], initialChapter = "

Datei

setTitle(event.target.value)} placeholder="Titel des Schreibens" required /> setFile(event.target.files?.[0] || null)} required /> - - - + + + {chapterSelect(chapters, chapterId, setChapterId)} @@ -1055,9 +1062,9 @@ function ExternalForm({ context, placement, chapters = [], initialChapter = "", setExternalId(event.target.value)} placeholder="Externe ID" required /> - - - + + + {chapterSelect(chapters, chapterId, setChapterId)} diff --git a/frontend/src/pages/Matters.jsx b/frontend/src/pages/Matters.jsx index 2ae4973..3bbf69b 100644 --- a/frontend/src/pages/Matters.jsx +++ b/frontend/src/pages/Matters.jsx @@ -7,7 +7,7 @@ import { MailPicker, PaperlessPicker } from "./Sources.jsx"; import { ErrorNote, ShareBox } from "./widgets.jsx"; import { chapterPathLabel, siblingChapterIds, trailWithChapter } from "./chapters.js"; import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx"; -import { ContentBoard, ObjectMenu, Placements, RecordTree, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, matterOpenHref, saveChapterOrder, writeChapter } from "./content.jsx"; +import { ContentBoard, DateField, ObjectMenu, Placements, RecordTree, 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 { NavIcon } from "./icons.jsx"; @@ -199,6 +199,7 @@ export function MatterDetail() { const [error, setError] = useState(""); const [modal, setModal] = useState(""); const [chapterParentId, setChapterParentId] = useState(""); + const [addChapterId, setAddChapterId] = useState(""); const rightsContext = inherited || { kind: "matter", id }; const placement = inherited?.kind === "case" ? { kind: "matter", id } : null; const [view, setView] = useState("contents"); @@ -374,6 +375,11 @@ export function MatterDetail() { setModal("chapter"); } + function openAdd(targetChapterId = chapterId) { + setAddChapterId(targetChapterId || ""); + setModal("add"); + } + async function moveChapter(chapterIdToMove, delta) { const ids = siblingChapterIds(record?.chapters || [], chapterIdToMove); const index = ids.indexOf(chapterIdToMove); @@ -468,6 +474,7 @@ export function MatterDetail() { /> ) : null} > +
@@ -480,7 +487,7 @@ export function MatterDetail() {
{width < 1500 ? : null} {canEdit ? ( - ) : null} @@ -499,6 +506,7 @@ export function MatterDetail() { {!canEdit ?

In {targetLabel} fehlt das Bearbeitungsrecht.

: null} +
{view === "contents" ? ( { rememberScroll(listRef.current, scrollKey); openEntry(binding); @@ -544,7 +553,7 @@ export function MatterDetail() {
) : null} {canEdit && view === "contents" ? ( - ) : null} @@ -556,10 +565,10 @@ export function MatterDetail() { { setModal(""); load(); }} /> setModal("")}> - +
- - {activeChapter ? : null} + + {addChapterId ? : null} @@ -567,16 +576,16 @@ export function MatterDetail() {
setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> - { setModal(""); load(); }} /> + { setModal(""); load(); }} /> setModal("")}> { setModal(""); load(); }} /> @@ -756,13 +765,13 @@ function WorkForms({ matterId, context, deadlines, onChange }) {

Frist

setDeadlineTitle(event.target.value)} placeholder="Maßgeblicher Termin" required /> - +

Aufgabe

setTaskTitle(event.target.value)} placeholder="Was ist vor der Frist zu tun?" required /> - +
diff --git a/frontend/src/pages/Shell.jsx b/frontend/src/pages/Shell.jsx index cb6b3fb..94fec86 100644 --- a/frontend/src/pages/Shell.jsx +++ b/frontend/src/pages/Shell.jsx @@ -1,5 +1,5 @@ import { useContext, useEffect, useRef, useState } from "react"; -import { NavLink, Outlet, useLocation, useNavigate } from "react-router-dom"; +import { NavLink, Outlet, useNavigate } from "react-router-dom"; import { SessionContext } from "../session.js"; import { Mark, NavIcon } from "./icons.jsx"; @@ -18,10 +18,15 @@ function initials(name) { return parts.slice(0, 2).map((part) => part[0]).join("").toUpperCase(); } +const MOBILE = [ + ...WORK, + { to: "/settings", label: "Verwaltung", short: "Verwaltung", icon: "gear" }, + { to: "/search", label: "Suche", short: "Suche", icon: "search" }, +]; + export function Shell() { const { session, logout } = useContext(SessionContext); const navigate = useNavigate(); - const location = useLocation(); const [expanded, setExpanded] = useState(() => { try { return localStorage.getItem(NAV_KEY) !== "0"; @@ -32,7 +37,6 @@ export function Shell() { const [query, setQuery] = useState(""); const [searchOpen, setSearchOpen] = useState(false); const searchRef = useRef(null); - const [more, setMore] = useState(false); const [width, setWidth] = useState(() => window.innerWidth); const [markIntroDone, setMarkIntroDone] = useState(false); const markMotion = markIntroDone ? "none" : "intro"; @@ -71,10 +75,6 @@ export function Shell() { return () => cancelAnimationFrame(frame); }, [markIntroDone]); - useEffect(() => { - setMore(false); - }, [location.pathname]); - const forcedCompact = width < 1180; const compact = forcedCompact || !expanded; @@ -173,32 +173,17 @@ export function Shell() {
- {more ? ( -
{ if (event.target === event.currentTarget) setMore(false); }}> -
-
-

Mehr

- -
-
- setMore(false)}>Verwaltung - setMore(false)}>Suche - -
-
-
- ) : null} ); diff --git a/frontend/src/pages/Sources.jsx b/frontend/src/pages/Sources.jsx index 7676299..a3b0123 100644 --- a/frontend/src/pages/Sources.jsx +++ b/frontend/src/pages/Sources.jsx @@ -135,14 +135,17 @@ function MailForm({ onSaved, onError }) { ); } -export function PaperlessPicker({ context, placement, chapterId = "", chapterTitle = "", targetLabel = "", onDone }) { +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 [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); @@ -151,33 +154,60 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit } } - async function link(item) { + function toggle(id) { + setPicked((current) => { + const next = new Set(current); + if (next.has(id)) next.delete(id); + else next.add(id); + return next; + }); + } + + async function linkMany() { + const chosen = items.filter((item) => picked.has(item.id)); + if (!chosen.length) return; setError(""); + setPending(true); + const inserted = []; try { - await api("/api/v1/external-refs", { - method: "POST", - body: { - title: item.title, - source: "paperless", - external_id: item.id, - context, - ...(placement ? { placement } : {}), - ...(chapterId ? { chapter_id: chapterId } : {}), - ...(item.document_on || item.correspondent || item.open_url - ? { - dates: { document_on: item.document_on || null, sent_on: null, received_on: null }, - detail: { - ...(item.correspondent ? { correspondent: item.correspondent } : {}), - ...(item.open_url ? { open_url: item.open_url } : {}), - }, - } - : {}), - }, - }); - onDone(); + for (const item of chosen) { + await api("/api/v1/external-refs", { + method: "POST", + body: { + title: item.title, + source: "paperless", + external_id: String(item.id), + context, + ...(placement ? { placement } : {}), + ...(chapterId ? { chapter_id: chapterId } : {}), + ...(item.document_on || item.correspondent || item.open_url + ? { + dates: { document_on: item.document_on || null, sent_on: null, received_on: null }, + detail: { + ...(item.correspondent ? { correspondent: item.correspondent } : {}), + ...(item.open_url ? { open_url: item.open_url } : {}), + }, + } + : {}), + }, + }); + inserted.push(item.id); + } } catch (err) { setError(err.message); + } finally { + setPending(false); } + if (inserted.length) { + setItems((current) => current.filter((item) => !inserted.includes(item.id))); + setPicked((current) => { + const next = new Set(current); + inserted.forEach((id) => next.delete(id)); + return next; + }); + onInserted?.(); + } + if (inserted.length === chosen.length) onDone(); } return ( @@ -188,10 +218,18 @@ export function PaperlessPicker({ context, placement, chapterId = "", chapterTit -

Die Verbindung richtest du unter Quellen ein.

+

Die Verbindung richtest du unter Quellen ein. Mehrere Treffer lassen sich zusammen einfügen.

+ {items.length ? ( + + ) : null}
{items.map((item) => ( - + ))}
diff --git a/frontend/src/pages/content.jsx b/frontend/src/pages/content.jsx index 9bfcb39..383a316 100644 --- a/frontend/src/pages/content.jsx +++ b/frontend/src/pages/content.jsx @@ -5,6 +5,7 @@ import { api, fetchFile, fetchPaperless } from "../api.js"; import { contentSourceSymbol, contentSymbol, symbolUrl } from "../content-symbol.mjs"; import { bezugCount, counterpartLabel, directionSymbol } from "../list-meta.mjs"; import { MarkdownView } from "../markdown.jsx"; +import { NavIcon } from "./icons.jsx"; import { Modal } from "./Modal.jsx"; import { ErrorNote } from "./widgets.jsx"; import { @@ -22,6 +23,56 @@ export function formatDate(value) { return `${day}.${month}.${year}`; } +function completeDate(value) { + return /^\d{4}-\d{2}-\d{2}$/.test(value || ""); +} + +export function DateField({ value = "", onChange, disabled = false, ...rest }) { + const ref = useRef(null); + const committed = useRef(value || ""); + // Chromium setzt bei einem gesteuerten Datumsfeld nach jeder Ziffer `value` + // neu. Die Jahresstelle springt dann auf eine einstellige Zahl wie 0002 + // und der Fokus verlässt das Feld. Das Feld bleibt deshalb ungesteuert. + useEffect(() => { + const next = value || ""; + const node = ref.current; + if (node && document.activeElement === node) return; + committed.current = next; + if (node && node.value !== next) node.value = next; + }, [value]); + + function commit(next) { + if (next === committed.current) return; + committed.current = next; + onChange(next); + } + + function commitFrom(node) { + if (node.validity?.badInput) { + node.value = committed.current || ""; + return; + } + const next = node.value || ""; + if (next && !completeDate(next)) return; + commit(next); + } + + return ( + { + if (completeDate(event.target.value)) commit(event.target.value); + }} + onBlur={(event) => commitFrom(event.target)} + /> + ); +} + export function formatStamp(value) { if (!value) return ""; const [day, time = ""] = String(value).split("T"); @@ -351,12 +402,15 @@ function MenuPopover({ open, anchorRef, onClose, label, children, sheet = false } function onScroll(event) { if (panelRef.current?.contains(event.target)) return; + const active = document.activeElement; + if (active && panelRef.current?.contains(active) && /^(INPUT|TEXTAREA|SELECT)$/.test(active.tagName)) return; position(); } window.addEventListener("keydown", onKey); window.addEventListener("resize", position); window.addEventListener("scroll", onScroll, true); const frame = requestAnimationFrame(() => { + if (panelRef.current?.contains(document.activeElement)) return; const selected = panelRef.current?.querySelector("[aria-selected='true']") || panelRef.current?.querySelector("button, a, input, select"); selected?.focus(); @@ -496,17 +550,22 @@ function BezugTarget({ item, source, onOpen, itemHref, onDone }) { return

{caption}

; } -function BezugMenu({ element, source, onOpen, itemHref }) { +function BezugMenu({ element, source, onOpen, itemHref, canEdit = false, onClearBezug }) { const refers = element.refers_to || []; const replies = element.referred_by || []; const count = bezugCount(element); const anchorRef = useRef(null); const [open, setOpen] = useState(false); + const canClear = Boolean(canEdit && onClearBezug); if (!count) return null; function close() { setOpen(false); anchorRef.current?.focus(); } + function dissolve(sourceId, targetId) { + close(); + onClearBezug(sourceId, targetId); + } return ( <> : null} + ))} {replies.length ?

Darauf bezogen

: null} {replies.map((item) => ( - +
+ + {canClear ? : null} +
))} @@ -560,6 +625,7 @@ function ChapterHeading({ onDate, onMove, onAddSubchapter, + onAddContent, onChange, onError, onPending, @@ -574,10 +640,23 @@ function ChapterHeading({ } return ( <> -

- {real ? {section.parentId ? "Unterkapitel" : "Kapitel"} : null} - {section.title} +

+ {real ? : null} + {section.title}

+ {canEdit && onAddContent ? ( + + ) : null} {count} {section.documentOn ? {formatDate(section.documentOn)} : null} {showMenu ? ( @@ -603,7 +682,7 @@ function ChapterHeading({ {canDate ? ( ) : null} {movable ? : null} @@ -659,6 +738,7 @@ function EntryActions({ pending, onSetBezug, onClearBezug, + onRenameTitle, onRemove, onMove, onPlaceChapter, @@ -692,6 +772,7 @@ function EntryActions({ {canEdit ? ( <> +

Bezug

{(element.refers_to || []).map((item) => ( - ))} + {(element.referred_by || []).length ?

Darauf bezogen

: null} + {(element.referred_by || []).map((item) => ( + + ))} ) : null} {canSort && chapters.length ? ( @@ -811,6 +898,7 @@ export function ContentBoard({ selectedId = "", onOpen, onAddSubchapter, + onAddContent, listTitle = "", }) { const source = bindings || record?.bindings || []; @@ -883,6 +971,24 @@ export function ContentBoard({ } } + async function renameElement(element) { + const title = window.prompt("Titel", element.title); + if (!title || title.trim() === element.title) return; + setPending(true); + setError(""); + try { + await api(`/api/v1/elements/${element.id}/title`, { + method: "PATCH", + body: { expected_version: element.version, title: title.trim(), context: actionContext() }, + }); + await onChange(); + } catch (err) { + setError(err.message); + } finally { + setPending(false); + } + } + async function clearBezug(elementId, refersToId) { setPending(true); setError(""); @@ -1429,6 +1535,7 @@ export function ContentBoard({ onDate={(value) => saveChapterDate(section.id, value)} onMove={(delta) => moveChapter(section.id, delta)} onAddSubchapter={onAddSubchapter} + onAddContent={section.id === "loose" ? null : onAddContent} onChange={onChange} onError={setError} onPending={setPending} @@ -1535,7 +1642,7 @@ export function ContentBoard({ ) : null} {facts} - + {text ? ( {text} @@ -1556,6 +1663,7 @@ export function ContentBoard({ pending={pending} onSetBezug={setBezug} onClearBezug={clearBezug} + onRenameTitle={renameElement} onRemove={removeBinding} onMove={move} onPlaceChapter={placeChapter} diff --git a/frontend/src/pages/workspace.jsx b/frontend/src/pages/workspace.jsx index 4a7ae0f..ab40bc6 100644 --- a/frontend/src/pages/workspace.jsx +++ b/frontend/src/pages/workspace.jsx @@ -72,7 +72,7 @@ function TreeRow({ node, onNavigate, ancestor = false, toggle = null }) { const label = ( {node.title} - {node.kind === "Kapitel" || node.kind === "Unterkapitel" || node.kind === "Teilvorgang" ? ( + {node.kind === "Teilvorgang" ? ( {node.kind} ) : null} diff --git a/frontend/src/styles.css b/frontend/src/styles.css index 9b230eb..0b94bf6 100644 --- a/frontend/src/styles.css +++ b/frontend/src/styles.css @@ -98,6 +98,7 @@ input, select, textarea { border: 1.5px solid var(--border2); border-radius: 8px; } +input[type="date"] { user-select: text; touch-action: manipulation; } input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); } textarea { min-height: 7rem; resize: vertical; } label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text1); } @@ -230,14 +231,21 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(- width: 100%; max-width: 600px; display: flex; + flex-wrap: nowrap; + justify-content: flex-start; + overflow-x: auto; + overscroll-behavior-x: contain; + scrollbar-width: none; background: var(--surface); border-top: 1px solid var(--border); z-index: 20; padding: var(--nav-pad-top) 6px env(safe-area-inset-bottom, 0px); min-height: calc(var(--nav-h) + var(--nav-pad-top) + env(safe-area-inset-bottom, 0px)); } +.bottom-nav::-webkit-scrollbar { display: none; } .nav-item { - flex: 1; + flex: 1 0 auto; + min-width: 4.5rem; display: flex; flex-direction: column; align-items: center; @@ -250,6 +258,17 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(- line-height: 1.15; padding: 2px 4px 4px; } +button.nav-item { + background: transparent; + border: 0; + border-radius: 0; + min-height: 0; + color: var(--text3); + font-weight: 500; + font-size: 10px; +} +button.nav-item:active { transform: none; } +.nav-item span { white-space: nowrap; } .nav-item.active { color: var(--accent); } .nav-item svg { flex-shrink: 0; } @@ -532,7 +551,36 @@ label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(- .chapter-head.is-movable:active { cursor: grabbing; } .chapter-head.is-movable .chapter-date, .chapter-head.is-movable .chapter-move { cursor: auto; touch-action: auto; user-select: auto; } -.chapter-title { margin: 22px 0 4px; font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--text1); font-weight: 700; } +.chapter-title { + display: flex; + align-items: center; + gap: 8px; + margin: 0; + font-size: 20px; + letter-spacing: 0; + text-transform: none; + color: var(--brand); + font-weight: 700; +} +.chapter-title.is-nested { font-size: 17px; } +.chapter-title svg { width: 18px; height: 18px; flex: 0 0 18px; } +.chapter-title span { min-width: 0; } +.chapter-plus { + width: 36px; + min-width: 36px; + height: 36px; + min-height: 36px; + padding: 0; + display: inline-flex; + align-items: center; + justify-content: center; + flex: none; + background: transparent; + color: var(--brand); + border: 1px solid var(--border2); + border-radius: 8px; +} +.chapter-plus svg { width: 18px; height: 18px; } .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; } @@ -751,6 +799,17 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border: .menu-popover__panel button[aria-selected="true"] { background: var(--accent-light); color: var(--brand); } .menu-popover__panel button.danger { background: #fcebeb; color: var(--danger); } .menu-popover__label { margin: 6px 4px 0; color: var(--text3); font-size: 12px; font-weight: 700; } +.bezug-entry { display: grid; gap: 2px; } +.paperless-pick { + display: flex; + gap: 10px; + align-items: flex-start; + min-height: 44px; + padding: 8px 2px; + font-weight: 600; +} +.paperless-pick input { width: 20px; min-width: 20px; min-height: 20px; margin-top: 2px; } +.paperless-pick span { min-width: 0; overflow-wrap: anywhere; } .trail__more { min-height: 28px; height: auto; @@ -1097,7 +1156,16 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border: box-shadow: var(--shadow); } .workspace-scrim { position: absolute; inset: 0; z-index: 5; border: 0; background: rgba(28, 27, 24, 0.28); } -.workspace-main { padding: 22px 28px 32px; } +.workspace-main { --pin-x: 28px; --pin-y: 22px; padding: var(--pin-y) var(--pin-x) 32px; } +.workspace-pin { + position: sticky; + top: 0; + z-index: 4; + background: var(--bg); + margin: calc(var(--pin-y) * -1) calc(var(--pin-x) * -1) 12px; + padding: var(--pin-y) var(--pin-x) 0; +} +.workspace-pin .surface-tabs { margin-bottom: 0; } .workspace-reader { background: #eef2ee; border-left: 1px solid var(--border); display: flex; min-height: 0; } .workspace-head, .title-row, .page-actions, .content-toolbar, .reader-pane__bar, .reader-controls { display: flex; @@ -1361,7 +1429,7 @@ button.hierarchy__row { width: 100%; min-height: 34px; padding: 6px 8px; border: @media (max-width: 759px) { .rail { display: none; } .app-shell { flex-direction: column; } - .workspace-main { padding: 8px 12px 88px; } + .workspace-main { --pin-x: 12px; --pin-y: 8px; padding: 8px 12px 88px; } .structure { padding-bottom: 96px; } .mobile-add { display: none; } .page-actions { flex-wrap: wrap; }