Lass E-Mails ueber die Faecher finden und halte Kapitel sowie das Menue in der Akte an ihrem Ort.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3465ed57f6
commit
67d48378c9
11 files changed
+696
-160
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { Link } from "react-router-dom";
|
||||
import { api, fetchFile, fetchPaperless } from "../api.js";
|
||||
import { Modal } from "./Modal.jsx";
|
||||
import { ErrorNote } from "./widgets.jsx";
|
||||
|
||||
export function formatDate(value) {
|
||||
@@ -103,11 +104,15 @@ function sectionsOf(chapters, bindings) {
|
||||
loose.push(binding);
|
||||
}
|
||||
}
|
||||
const sections = (chapters || [])
|
||||
.filter((chapter) => (buckets.get(chapter.id) || []).length)
|
||||
.map((chapter) => ({ id: chapter.id, title: chapter.title, items: buckets.get(chapter.id) }));
|
||||
if (loose.length || !sections.length) {
|
||||
sections.push({ id: "loose", title: sections.length ? "Ohne Kapitel" : "", items: loose });
|
||||
const sections = (chapters || []).map((chapter) => ({
|
||||
id: chapter.id,
|
||||
title: chapter.title,
|
||||
items: buckets.get(chapter.id) || [],
|
||||
}));
|
||||
if (sections.length && loose.length) {
|
||||
sections.push({ id: "loose", title: "Ohne Kapitel", items: loose });
|
||||
} else if (!sections.length) {
|
||||
sections.push({ id: "loose", title: "", items: loose });
|
||||
}
|
||||
return sections;
|
||||
}
|
||||
@@ -138,16 +143,23 @@ export function Placements({ items }) {
|
||||
}
|
||||
|
||||
export function ObjectMenu({ view, onView, children }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
function choose(next) {
|
||||
setOpen(false);
|
||||
onView(next);
|
||||
}
|
||||
return (
|
||||
<details className="object-menu">
|
||||
<summary>Menü</summary>
|
||||
<div className="stack">
|
||||
<button type="button" className={view === "course" ? "" : "quiet"} onClick={() => onView("course")}>Fachlicher Verlauf</button>
|
||||
<button type="button" className={view === "audit" ? "" : "quiet"} onClick={() => onView("audit")}>Änderungsprotokoll</button>
|
||||
<button type="button" className={view === "links" ? "" : "quiet"} onClick={() => onView("links")}>Zuordnungen</button>
|
||||
{children}
|
||||
</div>
|
||||
</details>
|
||||
<>
|
||||
<button type="button" className="quiet" onClick={() => setOpen(true)}>Menü</button>
|
||||
<Modal open={open} title="Menü" onClose={() => setOpen(false)}>
|
||||
<div className="menu-list" onClick={() => setOpen(false)}>
|
||||
<button type="button" className={view === "course" ? "" : "quiet"} onClick={() => choose("course")}>Fachlicher Verlauf</button>
|
||||
<button type="button" className={view === "audit" ? "" : "quiet"} onClick={() => choose("audit")}>Änderungsprotokoll</button>
|
||||
<button type="button" className={view === "links" ? "" : "quiet"} onClick={() => choose("links")}>Zuordnungen</button>
|
||||
{children}
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -421,7 +433,7 @@ export function ContentBoard({
|
||||
)}
|
||||
{pending ? <p className="muted">Ordnung wird gespeichert …</p> : null}
|
||||
<ErrorNote error={error} />
|
||||
{source.length ? (
|
||||
{source.length || chapters.length ? (
|
||||
visibleSections.map((section) => (
|
||||
<section
|
||||
key={section.id}
|
||||
@@ -431,6 +443,7 @@ export function ContentBoard({
|
||||
onDrop={(event) => onDrop(event, section.id)}
|
||||
>
|
||||
{section.title ? <h3 className="chapter-title">{section.title}</h3> : null}
|
||||
{section.title && !section.items.length ? <p className="muted">Noch nichts in diesem Kapitel.</p> : null}
|
||||
<ol className="preview-list">
|
||||
{section.items.map((binding, index) => {
|
||||
const element = binding.element;
|
||||
@@ -450,7 +463,7 @@ export function ContentBoard({
|
||||
onDragStart={(event) => onDragStart(event, binding.id, section.id)}
|
||||
onDragEnd={cancel}
|
||||
>
|
||||
Ziehen
|
||||
<span className="handle__grip" aria-hidden="true" />
|
||||
</button>
|
||||
) : null}
|
||||
<Thumb element={element} context={context} />
|
||||
@@ -460,11 +473,15 @@ export function ContentBoard({
|
||||
{text ? <span className="preview-row__text">{text}</span> : null}
|
||||
{binding.origin ? <span className="preview-row__origin">{binding.origin}{binding.shared ? " · weitere Einbindung" : ""}</span> : null}
|
||||
</Link>
|
||||
{canSort && custom ? (
|
||||
{canSort && (custom || chapters.length) ? (
|
||||
<details className="row-menu">
|
||||
<summary>Ordnen</summary>
|
||||
<button type="button" aria-label={`${element.title} nach oben`} disabled={pending || index === 0} onClick={() => move(binding.id, -1)}>Nach oben</button>
|
||||
<button type="button" aria-label={`${element.title} nach unten`} disabled={pending || index === section.items.length - 1} onClick={() => move(binding.id, 1)}>Nach unten</button>
|
||||
<summary>{custom ? "Ordnen" : "Einordnen"}</summary>
|
||||
{custom ? (
|
||||
<>
|
||||
<button type="button" aria-label={`${element.title} nach oben`} disabled={pending || index === 0} onClick={() => move(binding.id, -1)}>Nach oben</button>
|
||||
<button type="button" aria-label={`${element.title} nach unten`} disabled={pending || index === section.items.length - 1} onClick={() => move(binding.id, 1)}>Nach unten</button>
|
||||
</>
|
||||
) : null}
|
||||
{chapters.length ? (
|
||||
<label>
|
||||
In Kapitel einordnen
|
||||
|
||||
Reference in new issue
Block a user