MVP 0.92
This commit is contained in:
1 parent
60f0d2830d
commit
53b1eff833
62 files changed
+6578
-355
No files matched your search
@@ -8,6 +8,7 @@ import HomePage from './pages/HomePage.jsx'
|
||||
import DialoguePage from './pages/DialoguePage.jsx'
|
||||
import JournalSpacesPage from './pages/JournalSpacesPage.jsx'
|
||||
import JournalSpacePage from './pages/JournalSpacePage.jsx'
|
||||
import JournalTrashPage from './pages/JournalTrashPage.jsx'
|
||||
import JournalDayPage from './pages/JournalDayPage.jsx'
|
||||
import JournalEditorPage from './pages/JournalEditorPage.jsx'
|
||||
import JournalSourcePage from './pages/JournalSourcePage.jsx'
|
||||
@@ -132,6 +133,7 @@ export default function App() {
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/journal" element={<JournalSpacesPage />} />
|
||||
<Route path="/journal/:spaceId" element={<JournalSpacePage />} />
|
||||
<Route path="/journal/:spaceId/trash" element={<JournalTrashPage />} />
|
||||
<Route path="/journal/:spaceId/:dayId" element={<JournalDayPage />} />
|
||||
<Route path="/journal/:spaceId/:dayId/entry" element={<JournalEditorPage />} />
|
||||
<Route path="/journal/:spaceId/:dayId/source/:conversationId" element={<JournalSourcePage />} />
|
||||
|
||||
@@ -82,6 +82,17 @@ button.ghost {
|
||||
padding: 0.4rem 0.6rem;
|
||||
}
|
||||
button:disabled { opacity: 0.6; }
|
||||
a.button-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border-radius: 10px;
|
||||
padding: 0.75rem 1rem;
|
||||
min-height: 2.75rem;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.app-shell { min-height: 100dvh; width: 100%; max-width: 100%; }
|
||||
.app-main {
|
||||
@@ -320,6 +331,15 @@ label.button-file {
|
||||
.trace-panel ol { padding-left: 1.2rem; margin: 0.4rem 0 0.8rem; }
|
||||
.trace-panel details { margin: 0.5rem 0; }
|
||||
.trace-panel summary { cursor: pointer; color: var(--muted); }
|
||||
.trace-stage {
|
||||
margin-top: 1rem;
|
||||
padding-top: 0.8rem;
|
||||
border-top: 1px solid var(--line);
|
||||
}
|
||||
.trace-stage h3 {
|
||||
margin: 0 0 0.5rem;
|
||||
font-size: 1rem;
|
||||
}
|
||||
button.ghost.active { color: var(--accent); }
|
||||
.media-row { display: flex; flex-wrap: wrap; gap: 0.8rem; }
|
||||
.media-row figure { margin: 0; width: 7.5rem; }
|
||||
|
||||
@@ -8,12 +8,46 @@ function Block({ title, value }) {
|
||||
)
|
||||
}
|
||||
|
||||
function unavailable(value) {
|
||||
if (value == null || value === '') return 'nicht verfügbar'
|
||||
return value
|
||||
}
|
||||
|
||||
function isJournalTrace(trace) {
|
||||
if (!trace) return false
|
||||
if (Array.isArray(trace.stages) && trace.stages.length > 0) return true
|
||||
return (
|
||||
trace.purpose === 'journal_reconstruct' ||
|
||||
trace.purpose === 'journal_generate' ||
|
||||
trace.layer === 'journalentwurf' ||
|
||||
trace.layer === 'journalrekonstruktion'
|
||||
)
|
||||
}
|
||||
|
||||
function layerLabel(trace) {
|
||||
if (trace?.layer === 'journalentwurf') return 'Journalentwurf'
|
||||
if (trace?.purpose === 'journal_generate') return 'Journalentwurf'
|
||||
if (trace?.purpose === 'journal_reconstruct' || trace?.layer === 'journalrekonstruktion') {
|
||||
return 'Journalrekonstruktion'
|
||||
}
|
||||
if (trace?.layer === 'journalentwurf' || trace?.purpose === 'journal_generate') {
|
||||
return 'Journalformulierung'
|
||||
}
|
||||
if (trace?.layer === 'profilreview' || trace?.purpose === 'profile_review') {
|
||||
return 'Profilreview'
|
||||
}
|
||||
return 'Dialogzug'
|
||||
}
|
||||
|
||||
function stageTitle(stage, index) {
|
||||
const layer = layerLabel(stage)
|
||||
if (stage?.purpose === 'journal_reconstruct' || stage?.layer === 'journalrekonstruktion') {
|
||||
return `Stufe ${index + 1}: Rekonstruktion`
|
||||
}
|
||||
if (stage?.purpose === 'journal_generate' || stage?.layer === 'journalentwurf') {
|
||||
return `Stufe ${index + 1}: Journalformulierung`
|
||||
}
|
||||
return `Stufe ${index + 1}: ${layer}`
|
||||
}
|
||||
|
||||
function detectLabel(trace) {
|
||||
if (trace?.detect_note === 'remote_llm') {
|
||||
return `${trace.detect_provider || 'openrouter'} (Detect-Call, Testphase)`
|
||||
@@ -27,9 +61,89 @@ function detectLabel(trace) {
|
||||
return trace.detect_provider
|
||||
}
|
||||
|
||||
function BudgetMeta({ budget, trace }) {
|
||||
const data = budget || {}
|
||||
const model = data.actual_model || data.model || trace?.model
|
||||
return (
|
||||
<dl className="meta">
|
||||
<dt>Zweck</dt>
|
||||
<dd>{unavailable(trace?.purpose)}</dd>
|
||||
<dt>Prompt</dt>
|
||||
<dd>{unavailable(trace?.prompt_slug)}</dd>
|
||||
<dt>Provider</dt>
|
||||
<dd>{unavailable(trace?.provider || data.provider)}</dd>
|
||||
<dt>Modell</dt>
|
||||
<dd>{unavailable(model)}</dd>
|
||||
<dt>Kontextfenster</dt>
|
||||
<dd>{unavailable(data.effective_context_window)}</dd>
|
||||
<dt>Geschätzte Eingabetokens</dt>
|
||||
<dd>{unavailable(data.estimated_input_tokens)}</dd>
|
||||
<dt>Prompt-Tokens</dt>
|
||||
<dd>{unavailable(data.prompt_tokens)}</dd>
|
||||
<dt>Completion-Tokens</dt>
|
||||
<dd>{unavailable(data.completion_tokens)}</dd>
|
||||
<dt>Gesamttokens</dt>
|
||||
<dd>{unavailable(data.total_tokens)}</dd>
|
||||
<dt>Reservierte Ausgabe / max_tokens</dt>
|
||||
<dd>
|
||||
{unavailable(data.reserved_output_tokens)}
|
||||
{' / '}
|
||||
{unavailable(data.max_tokens)}
|
||||
</dd>
|
||||
<dt>Sicherheitsmarge</dt>
|
||||
<dd>{unavailable(data.safety_margin)}</dd>
|
||||
<dt>Kontextkompression</dt>
|
||||
<dd>{unavailable(data.context_compression)}</dd>
|
||||
<dt>Budgetstatus</dt>
|
||||
<dd>
|
||||
{data.budget_ok == null ? 'nicht verfügbar' : data.budget_ok ? 'ok' : 'abgebrochen'}
|
||||
{data.abort_reason ? ` · ${data.abort_reason}` : ''}
|
||||
</dd>
|
||||
<dt>Kosten</dt>
|
||||
<dd>{unavailable(data.cost)}</dd>
|
||||
</dl>
|
||||
)
|
||||
}
|
||||
|
||||
function StageView({ stage, index, journal }) {
|
||||
const title = journal ? stageTitle(stage, index) : layerLabel(stage)
|
||||
return (
|
||||
<section className="trace-stage">
|
||||
<h3>{title}</h3>
|
||||
<BudgetMeta budget={stage?.budget} trace={stage} />
|
||||
<dl className="meta">
|
||||
<dt>Schicht</dt>
|
||||
<dd>{layerLabel(stage)}</dd>
|
||||
<dt>Maskierung</dt>
|
||||
<dd>{detectLabel(stage)}</dd>
|
||||
<dt>Klasse</dt>
|
||||
<dd>{unavailable(stage?.data_class)}</dd>
|
||||
<dt>Masken</dt>
|
||||
<dd>{stage?.mapping_count ?? 'nicht verfügbar'}</dd>
|
||||
</dl>
|
||||
<Block title="Maskierung, Eingabe (nur user-Zeilen)" value={stage?.mask_input} />
|
||||
<Block
|
||||
title={journal ? 'Intern (Klartext-Vorlage, nicht gesendet)' : 'Dialogzug intern (Klartext-Vorlage, nicht gesendet)'}
|
||||
value={stage?.intern}
|
||||
/>
|
||||
<Block
|
||||
title={journal ? 'Egress (maskierter Modellaufruf)' : 'Dialogzug Egress (Sprachmodell-Call für Operation und Impuls)'}
|
||||
value={stage?.egress}
|
||||
/>
|
||||
<Block title={journal ? 'Antwort dieser Stufe' : 'Antwort dieses einen Calls (Operation + Impuls)'} value={stage?.raw} />
|
||||
<Block title="Lokal demaskiert" value={stage?.reply} />
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
export default function CallTrace({ decision, trace }) {
|
||||
if (!decision && !trace) return null
|
||||
const layer = layerLabel(trace)
|
||||
const journal = isJournalTrace(trace)
|
||||
const stages = Array.isArray(trace?.stages) && trace.stages.length > 0
|
||||
? trace.stages
|
||||
: trace
|
||||
? [trace]
|
||||
: []
|
||||
return (
|
||||
<aside className="trace-panel">
|
||||
<h2>Testspur</h2>
|
||||
@@ -38,12 +152,28 @@ export default function CallTrace({ decision, trace }) {
|
||||
Maskierung sucht nur Namen (Testphase: eigener OpenRouter-Call auf user-Zeilen).
|
||||
Sie wählt keine Operation und schreibt keinen Impuls.
|
||||
</li>
|
||||
<li>
|
||||
{layer} ist ein Sprachmodell-Call. Intern ist die lokale Klartext-Vorlage
|
||||
(nicht gesendet). Egress ist dieselbe Vorlage, maskiert — das ist der gesendete Call.
|
||||
Operation und sichtbare Antwort kommen beide aus diesem einen Call.
|
||||
</li>
|
||||
<li>Es gibt keinen dritten Call, der danach noch einmal antwortet.</li>
|
||||
{journal ? (
|
||||
<>
|
||||
<li>
|
||||
Die Journalgenerierung sind zwei getrennte Sprachmodell-Calls: zuerst Rekonstruktion,
|
||||
danach Journalformulierung. Intern ist die lokale Klartext-Vorlage (nicht gesendet).
|
||||
Egress ist dieselbe Vorlage, maskiert.
|
||||
</li>
|
||||
<li>
|
||||
Stufe 2 läuft nur, wenn Stufe 1 lokal vollständig validiert wurde. Eine fehlende Stufe
|
||||
bedeutet, dass dieser Call nicht stattgefunden hat.
|
||||
</li>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<li>
|
||||
{layerLabel(trace)} ist ein Sprachmodell-Call. Intern ist die lokale Klartext-Vorlage
|
||||
(nicht gesendet). Egress ist dieselbe Vorlage, maskiert — das ist der gesendete Call.
|
||||
Operation und sichtbare Antwort kommen beide aus diesem einen Call.
|
||||
</li>
|
||||
<li>Es gibt keinen dritten Call, der danach noch einmal antwortet.</li>
|
||||
</>
|
||||
)}
|
||||
</ol>
|
||||
{decision && (
|
||||
<p>
|
||||
@@ -53,29 +183,9 @@ export default function CallTrace({ decision, trace }) {
|
||||
{decision.guard ? ` — lokal ersetzt (${decision.guard})` : ''}
|
||||
</p>
|
||||
)}
|
||||
{trace && (
|
||||
<>
|
||||
<dl className="meta">
|
||||
<dt>Schicht</dt>
|
||||
<dd>{layer}</dd>
|
||||
<dt>Prompt</dt>
|
||||
<dd>{trace.prompt_slug || '—'}</dd>
|
||||
<dt>Sprachmodell</dt>
|
||||
<dd>{[trace.provider, trace.model].filter(Boolean).join(' · ') || '—'}</dd>
|
||||
<dt>Maskierung</dt>
|
||||
<dd>{detectLabel(trace)}</dd>
|
||||
<dt>Klasse</dt>
|
||||
<dd>{trace.data_class || '—'}</dd>
|
||||
<dt>Masken</dt>
|
||||
<dd>{trace.mapping_count ?? 0}</dd>
|
||||
</dl>
|
||||
<Block title="1. Maskierung, Eingabe (nur user-Zeilen)" value={trace.mask_input} />
|
||||
<Block title="2a. Dialogzug intern (Klartext-Vorlage, nicht gesendet)" value={trace.intern} />
|
||||
<Block title="2b. Dialogzug Egress (Sprachmodell-Call für Operation und Impuls)" value={trace.egress} />
|
||||
<Block title="Antwort dieses einen Calls (Operation + Impuls)" value={trace.raw} />
|
||||
<Block title="Lokal demaskiert" value={trace.reply} />
|
||||
</>
|
||||
)}
|
||||
{stages.map((stage, index) => (
|
||||
<StageView key={`${stage?.purpose || 'stage'}-${index}`} stage={stage} index={index} journal={journal} />
|
||||
))}
|
||||
</aside>
|
||||
)
|
||||
}
|
||||
@@ -1,14 +1,50 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { api } from '../api.js'
|
||||
import { useAuth } from '../context/AuthContext.jsx'
|
||||
|
||||
export default function HomePage() {
|
||||
const { session } = useAuth()
|
||||
const [payload, setPayload] = useState(null)
|
||||
const [error, setError] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
api('/api/journal/continuity', { token: session.token })
|
||||
.then(setPayload)
|
||||
.catch((err) => setError(err.message))
|
||||
}, [session.token])
|
||||
|
||||
if (!payload && !error) {
|
||||
return <section className="card"><p>Lädt …</p></section>
|
||||
}
|
||||
|
||||
const continuable = payload?.continuable
|
||||
const hasSpaces = payload?.has_spaces
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<h1>Start</h1>
|
||||
<p>
|
||||
Der Einstieg bleibt bewusst dünn: kein Funktions-Dashboard. Der MVP-Kern liegt im Journal.
|
||||
<h1>Weitergehen</h1>
|
||||
<p className="lede">
|
||||
Kein Dashboard. Wenn ein Journal Day offen ist, geht es dort weiter.
|
||||
</p>
|
||||
<p><Link to="/journal">Zum Journal</Link></p>
|
||||
<p className="muted">Keine Tracking-Kacheln, keine Aufgabenliste, keine Diagnose.</p>
|
||||
{error && <p className="error">{error}</p>}
|
||||
{continuable && (
|
||||
<p>
|
||||
<Link className="button-link" to={`/journal/${continuable.space_id}/${continuable.journal_day_id}`}>
|
||||
{continuable.calendar_date} in {continuable.space_title || 'Space'} fortsetzen
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
{!continuable && hasSpaces && (
|
||||
<p><Link to="/journal">Zum Journal</Link></p>
|
||||
)}
|
||||
{!continuable && !hasSpaces && (
|
||||
<p>
|
||||
Noch kein Reflection Space. Lege einen an und starte den ersten Journal Day.
|
||||
{' '}
|
||||
<Link to="/journal">Space anlegen</Link>
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -25,6 +25,7 @@ export default function JournalDayPage() {
|
||||
const [trace, setTrace] = useState(null)
|
||||
const [decision, setDecision] = useState(null)
|
||||
const [chooseSources, setChooseSources] = useState(false)
|
||||
const [includeExisting, setIncludeExisting] = useState(false)
|
||||
|
||||
const loadDay = async (preferId) => {
|
||||
const data = await api(`/api/journal/days/${dayId}`, { token: session.token })
|
||||
@@ -114,6 +115,7 @@ export default function JournalDayPage() {
|
||||
try {
|
||||
const body = {}
|
||||
if (conversationIds?.length) body.conversation_ids = conversationIds
|
||||
if (includeExisting) body.include_existing = true
|
||||
const result = await api(`/api/journal/days/${dayId}/generate`, {
|
||||
token: session.token,
|
||||
method: 'POST',
|
||||
@@ -122,7 +124,7 @@ export default function JournalDayPage() {
|
||||
setDecision(null)
|
||||
setTrace(result.trace || null)
|
||||
await loadDay(activeId)
|
||||
navigate(`/journal/${spaceId}/${dayId}/entry?draft=1`)
|
||||
navigate(`/journal/${spaceId}/${dayId}/entry?draft=1`, { state: { trace: result.trace || null } })
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -202,6 +204,25 @@ export default function JournalDayPage() {
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{(payload.current_draft || payload.entries?.length > 0) && (
|
||||
<div className="generate-choice">
|
||||
<p>
|
||||
Es gibt bereits einen Entwurf oder Eintrag. Die gespeicherte Fassung bleibt unangetastet.
|
||||
Ein neuer Entwurf entsteht getrennt und wird erst durch Übernehmen zur Version.
|
||||
</p>
|
||||
<label className="check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={includeExisting}
|
||||
onChange={(e) => setIncludeExisting(e.target.checked)}
|
||||
/>
|
||||
Bestehende Fassung einbeziehen
|
||||
</label>
|
||||
<p className="muted">
|
||||
Standard: nicht einbeziehen. Das Flag wird nur nach dieser Auswahl gesetzt.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
{(payload.current_draft || payload.entries?.length > 0) && (
|
||||
<p className="dialogue-meta muted">
|
||||
{payload.current_draft && (
|
||||
@@ -223,7 +244,7 @@ export default function JournalDayPage() {
|
||||
<strong>{item.role === 'assistant' ? 'Kanshō' : 'Du'}:</strong> {item.body}
|
||||
</p>
|
||||
))}
|
||||
{!activeId && <p className="muted">Noch kein Gespräch. Lege eines an und erzähle.</p>}
|
||||
{!activeId && <p className="muted">Noch kein Gespräch. Lege eines an — Kanshō setzt den ersten Impuls.</p>}
|
||||
</div>
|
||||
{activeId && (
|
||||
<form className="dialogue-composer" onSubmit={send}>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { Link, useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
import { Link, useLocation, useNavigate, useParams, useSearchParams } from 'react-router-dom'
|
||||
import { api, apiBlob, apiUpload } from '../api.js'
|
||||
import CallTrace from '../components/CallTrace.jsx'
|
||||
import JournalDocumentEditor from '../components/JournalDocumentEditor.jsx'
|
||||
import { useAuth } from '../context/AuthContext.jsx'
|
||||
import { useUnsavedChanges } from '../context/UnsavedChanges.jsx'
|
||||
@@ -9,9 +10,10 @@ import { entryTitle, formatWhen, originLabel } from '../journal/document.js'
|
||||
export default function JournalEditorPage() {
|
||||
const { spaceId, dayId } = useParams()
|
||||
const [params] = useSearchParams()
|
||||
const location = useLocation()
|
||||
const entryQuery = params.get('entry') || ''
|
||||
const wantDraft = params.get('draft') === '1'
|
||||
const { session } = useAuth()
|
||||
const { session, isAdmin } = useAuth()
|
||||
const navigate = useNavigate()
|
||||
const editorRef = useRef(null)
|
||||
const entryIdRef = useRef(entryQuery)
|
||||
@@ -224,13 +226,13 @@ export default function JournalEditorPage() {
|
||||
|
||||
const remove = async () => {
|
||||
if (!entryId) return
|
||||
if (!window.confirm('Eintrag in den Papierkorb legen? Das ist noch nicht endgültig.')) return
|
||||
if (!window.confirm('Eintrag in den Papierkorb legen? Das ist noch nicht endgültig. Endgültiges Löschen geschieht später im Papierkorb.')) return
|
||||
setError('')
|
||||
setNotice('')
|
||||
try {
|
||||
await api(`/api/journal/entries/${entryId}`, { token: session.token, method: 'DELETE' })
|
||||
showLoaded(null)
|
||||
setNotice('Im Papierkorb.')
|
||||
navigate(`/journal/${spaceId}/trash`)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
}
|
||||
@@ -334,6 +336,7 @@ export default function JournalEditorPage() {
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
{isAdmin && location.state?.trace && <CallTrace trace={location.state.trace} />}
|
||||
{versions.length > 0 && (
|
||||
<div className="stack">
|
||||
<h2>Versionen</h2>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useEffect, useState } from 'react'
|
||||
import { Link, useNavigate, useParams } from 'react-router-dom'
|
||||
import { api } from '../api.js'
|
||||
import { useAuth } from '../context/AuthContext.jsx'
|
||||
import { entryTitle, originLabel } from '../journal/document.js'
|
||||
|
||||
function todayLocal() {
|
||||
const now = new Date()
|
||||
@@ -16,16 +17,20 @@ export default function JournalSpacePage() {
|
||||
const { session } = useAuth()
|
||||
const [space, setSpace] = useState(null)
|
||||
const [days, setDays] = useState([])
|
||||
const [entries, setEntries] = useState([])
|
||||
const [date, setDate] = useState(todayLocal())
|
||||
const [error, setError] = useState('')
|
||||
|
||||
useEffect(() => {
|
||||
const load = () =>
|
||||
api(`/api/journal/spaces/${spaceId}`, { token: session.token })
|
||||
.then((data) => {
|
||||
setSpace(data.space)
|
||||
setDays(data.days || [])
|
||||
setEntries(data.entries || [])
|
||||
})
|
||||
.catch((err) => setError(err.message))
|
||||
|
||||
useEffect(() => {
|
||||
load().catch((err) => setError(err.message))
|
||||
}, [session.token, spaceId])
|
||||
|
||||
const openDay = async (calendarDate) => {
|
||||
@@ -44,9 +49,16 @@ export default function JournalSpacePage() {
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<p className="muted"><Link to="/journal">Alle Spaces</Link></p>
|
||||
<p className="muted">
|
||||
<Link to="/journal">Alle Spaces</Link>
|
||||
{' · '}
|
||||
<Link to={`/journal/${spaceId}/trash`}>Papierkorb</Link>
|
||||
</p>
|
||||
<h1>{space?.title || 'Space'}</h1>
|
||||
<p className="lede">Tage chronologisch. Der Kalendertag ist nicht die Dialogzeit.</p>
|
||||
<p className="lede">
|
||||
Einträge chronologisch. Mehrere Einträge desselben Tages bleiben einzeln erreichbar.
|
||||
Gelöschte Einträge liegen nur im Papierkorb.
|
||||
</p>
|
||||
{error && <p className="error">{error}</p>}
|
||||
<form
|
||||
className="stack"
|
||||
@@ -61,6 +73,30 @@ export default function JournalSpacePage() {
|
||||
</label>
|
||||
<button type="submit">Tag öffnen</button>
|
||||
</form>
|
||||
<h2>Einträge</h2>
|
||||
{entries.length === 0 && <p className="muted">Noch keine Einträge in diesem Space.</p>}
|
||||
<ul className="stack">
|
||||
{entries.map((item) => (
|
||||
<li key={item.id} className="row-item">
|
||||
<Link to={`/journal/${spaceId}/${item.journal_day_id}/entry?entry=${item.id}`}>
|
||||
{item.calendar_date}
|
||||
{' · '}
|
||||
{entryTitle(item.title) || 'Ohne Titel'}
|
||||
{item.version_count > 1 ? ` · ${item.version_count} Versionen` : ''}
|
||||
{item.origin ? ` · ${originLabel(item.origin)}` : ''}
|
||||
</Link>
|
||||
<span className="row-actions">
|
||||
<Link to={`/journal/${spaceId}/${item.journal_day_id}`}>Tag</Link>
|
||||
{item.source_conversation_id && (
|
||||
<Link to={`/journal/${spaceId}/${item.journal_day_id}/source/${item.source_conversation_id}`}>
|
||||
Quelldialog
|
||||
</Link>
|
||||
)}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<h2>Tage</h2>
|
||||
<ul className="stack">
|
||||
{days.map((item) => (
|
||||
<li key={item.id} className="row-item">
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { useEffect, useState } from 'react'
|
||||
import { Link, useParams } from 'react-router-dom'
|
||||
import { api } from '../api.js'
|
||||
import { useAuth } from '../context/AuthContext.jsx'
|
||||
import { entryTitle } from '../journal/document.js'
|
||||
|
||||
export default function JournalTrashPage() {
|
||||
const { spaceId } = useParams()
|
||||
const { session } = useAuth()
|
||||
const [space, setSpace] = useState(null)
|
||||
const [items, setItems] = useState([])
|
||||
const [error, setError] = useState('')
|
||||
const [notice, setNotice] = useState('')
|
||||
const [busy, setBusy] = useState(false)
|
||||
|
||||
const load = async () => {
|
||||
const detail = await api(`/api/journal/spaces/${spaceId}`, { token: session.token })
|
||||
setSpace(detail.space)
|
||||
const trash = await api(`/api/journal/spaces/${spaceId}/trash`, { token: session.token })
|
||||
setItems(Array.isArray(trash) ? trash : [])
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
load().catch((err) => setError(err.message))
|
||||
}, [session.token, spaceId])
|
||||
|
||||
const undelete = async (entryId) => {
|
||||
setError('')
|
||||
setNotice('')
|
||||
setBusy(true)
|
||||
try {
|
||||
await api(`/api/journal/entries/${entryId}/undelete`, { token: session.token, method: 'POST', body: {} })
|
||||
setNotice('Eintrag aus dem Papierkorb zurückgeholt. Das ist keine Versionswiederherstellung.')
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const purge = async (entryId) => {
|
||||
if (!window.confirm(
|
||||
'Endgültig löschen? Text, Versionen und nur diesem Eintrag gehörende Medien werden unwiderruflich entfernt. Quelldialoge bleiben. Geteilte Medien bleiben, wenn sie noch in einem anderen Eintrag stehen.'
|
||||
)) return
|
||||
const typed = window.prompt('Zum Bestätigen ENDGÜLTIG eingeben.')
|
||||
if (typed !== 'ENDGÜLTIG') {
|
||||
setNotice('Endgültiges Löschen abgebrochen.')
|
||||
return
|
||||
}
|
||||
setError('')
|
||||
setNotice('')
|
||||
setBusy(true)
|
||||
try {
|
||||
await api(`/api/journal/entries/${entryId}/purge`, {
|
||||
token: session.token,
|
||||
method: 'POST',
|
||||
body: { confirm: true }
|
||||
})
|
||||
setNotice('Eintrag endgültig gelöscht.')
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card">
|
||||
<p className="muted"><Link to={`/journal/${spaceId}`}>{space?.title || 'Space'}</Link></p>
|
||||
<h1>Papierkorb</h1>
|
||||
<p className="lede">
|
||||
Im Papierkorb liegen nur soft gelöschte Einträge. Wiederherstellen holt den Eintrag zurück.
|
||||
Endgültiges Löschen ist eine eigene, irreversible Aktion.
|
||||
</p>
|
||||
{error && <p className="error">{error}</p>}
|
||||
{notice && <p className="muted">{notice}</p>}
|
||||
{items.length === 0 && <p className="muted">Der Papierkorb ist leer.</p>}
|
||||
<ul className="stack">
|
||||
{items.map((item) => (
|
||||
<li key={item.id} className="row-item">
|
||||
<span>
|
||||
{item.calendar_date}
|
||||
{' · '}
|
||||
{entryTitle(item.title) || 'Ohne Titel'}
|
||||
</span>
|
||||
<span className="row-actions">
|
||||
<button type="button" className="ghost" disabled={busy} onClick={() => undelete(item.id)}>
|
||||
Wiederherstellen
|
||||
</button>
|
||||
<button type="button" className="ghost" disabled={busy} onClick={() => purge(item.id)}>
|
||||
Endgültig löschen
|
||||
</button>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
@@ -678,9 +678,7 @@ export default function SettingsPage() {
|
||||
</div>
|
||||
)}
|
||||
{!profile?.compiled_brief && (
|
||||
<p className="muted">
|
||||
Noch kein Stilbrief. Sobald Einträge oder Importe mit Zeitbezug vorliegen, entstehen Exzerpte. Traits folgen erst aus dem Initial Build.
|
||||
</p>
|
||||
<p className="muted">Noch kein Stilbrief. Lege eigene Texte in den Korpus oder übernimm einen Journal-Eintrag.</p>
|
||||
)}
|
||||
{profile?.sources?.length > 0 && (
|
||||
<ul className="muted">
|
||||
@@ -697,7 +695,10 @@ export default function SettingsPage() {
|
||||
{profile?.compiled_brief && (
|
||||
<div className="stack">
|
||||
<h2>Aktueller Brief</h2>
|
||||
<p className="muted">Abgeleiteter Runtime-Brief, nicht Source of Truth und kein Import-/Exportformat. Nach einer übernommenen Profiländerung wird er neu kompiliert.</p>
|
||||
<p className="muted">
|
||||
Abgeleiteter Runtime-Brief, nicht Source of Truth und nicht das Import-/Exportformat.
|
||||
Facets, Traits und Quellen bleiben maßgeblich.
|
||||
</p>
|
||||
<p className="writing-brief">{profile.compiled_brief}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in new issue
Block a user