Enhance Exercise Progression Graph Panel and Editor with New Features
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m26s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 43s
Test Suite / lint-backend (push) Successful in 1s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m26s
- Refactored `ExerciseProgressionGraphPanel` to support a create dialog for new progression graphs, improving user experience. - Integrated `ProgressionGraphListCard` for better visualization of existing graphs and streamlined management. - Updated `ProgressionGraphEditor` to handle start/target analysis and improved draft hydration with AI suggestions. - Added utility functions for managing structured responses from AI, enhancing the planning process. - Incremented application version to reflect these updates.
This commit is contained in:
1 parent
3b483346de
commit
48d51c07c5
5 files changed
+687
-276
No files matched your search
@@ -1,13 +1,21 @@
|
||||
/**
|
||||
* Progressionsgraphen — eine Oberfläche: Graph wählen, Roadmap-Slots bearbeiten, KI & Speichern.
|
||||
* Progressionsgraphen — Kachel-Übersicht (wie Übungen) + Editor-Detailansicht.
|
||||
*/
|
||||
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
||||
import React, {
|
||||
forwardRef,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
useMemo,
|
||||
useState,
|
||||
} from 'react'
|
||||
import { Link, useLocation } from 'react-router-dom'
|
||||
import api from '../utils/api'
|
||||
import SkillProfilePanel from './skills/SkillProfilePanel'
|
||||
import { useAuth } from '../context/AuthContext'
|
||||
import { getTenantClubDependencyKey } from '../utils/activeClub'
|
||||
import ProgressionGraphEditor from './ProgressionGraphEditor'
|
||||
import ProgressionGraphListCard from './ProgressionGraphListCard'
|
||||
import { EXERCISE_VISIBILITY_FIELD_LABEL } from '../constants/exerciseGovernanceLabels'
|
||||
|
||||
const VIS_OPTIONS = [
|
||||
@@ -22,10 +30,14 @@ function edgeTypeLabel(type) {
|
||||
return type || '—'
|
||||
}
|
||||
|
||||
export default function ExerciseProgressionGraphPanel({
|
||||
anchorExerciseId = null,
|
||||
anchorTitle = null,
|
||||
}) {
|
||||
function ExerciseProgressionGraphPanel(
|
||||
{
|
||||
anchorExerciseId = null,
|
||||
anchorTitle = null,
|
||||
initialGraphId = null,
|
||||
},
|
||||
ref,
|
||||
) {
|
||||
const { user } = useAuth()
|
||||
const location = useLocation()
|
||||
const isSuperadmin = user?.role === 'superadmin'
|
||||
@@ -42,6 +54,7 @@ export default function ExerciseProgressionGraphPanel({
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [loadErr, setLoadErr] = useState(null)
|
||||
|
||||
const [createModalOpen, setCreateModalOpen] = useState(false)
|
||||
const [newGraphName, setNewGraphName] = useState('')
|
||||
const [newGraphVisibility, setNewGraphVisibility] = useState('private')
|
||||
|
||||
@@ -56,16 +69,28 @@ export default function ExerciseProgressionGraphPanel({
|
||||
const [skillProfileLoading, setSkillProfileLoading] = useState(false)
|
||||
const [skillProfileError, setSkillProfileError] = useState('')
|
||||
|
||||
useImperativeHandle(ref, () => ({
|
||||
openCreateDialog: () => {
|
||||
setNewGraphName('')
|
||||
setNewGraphVisibility('private')
|
||||
setCreateModalOpen(true)
|
||||
},
|
||||
}))
|
||||
|
||||
useEffect(() => {
|
||||
const gid = location.state?.progressionGraphId
|
||||
const gid =
|
||||
initialGraphId ??
|
||||
location.state?.progressionGraphId
|
||||
if (gid != null && Number.isFinite(Number(gid))) {
|
||||
setSelectedGraphId(Number(gid))
|
||||
}
|
||||
}, [location.state?.progressionGraphId])
|
||||
}, [location.state?.progressionGraphId, initialGraphId])
|
||||
|
||||
useEffect(() => {
|
||||
setSelectedGraphId(null)
|
||||
}, [tenantClubDepKey])
|
||||
if (!initialGraphId && !location.state?.progressionGraphId) {
|
||||
setSelectedGraphId(null)
|
||||
}
|
||||
}, [tenantClubDepKey, initialGraphId, location.state?.progressionGraphId])
|
||||
|
||||
const refreshGraphs = useCallback(async () => {
|
||||
const list = await api.listExerciseProgressionGraphs()
|
||||
@@ -174,6 +199,7 @@ export default function ExerciseProgressionGraphPanel({
|
||||
name,
|
||||
visibility: newGraphVisibility,
|
||||
})
|
||||
setCreateModalOpen(false)
|
||||
setNewGraphName('')
|
||||
await refreshGraphs()
|
||||
if (created?.id != null) setSelectedGraphId(created.id)
|
||||
@@ -184,6 +210,22 @@ export default function ExerciseProgressionGraphPanel({
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteGraph = async (graph) => {
|
||||
const gid = graph?.id ?? selectedGraphId
|
||||
if (!gid) return
|
||||
if (!window.confirm(`Progressionsgraph „${graph?.name || gid}" wirklich löschen?`)) return
|
||||
setBusy(true)
|
||||
try {
|
||||
await api.deleteExerciseProgressionGraph(gid)
|
||||
if (selectedGraphId === gid) setSelectedGraphId(null)
|
||||
await refreshGraphs()
|
||||
} catch (err) {
|
||||
alert(err.message || String(err))
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleSaveMeta = async () => {
|
||||
if (!selectedGraphId) return
|
||||
const name = metaName.trim()
|
||||
@@ -207,21 +249,6 @@ export default function ExerciseProgressionGraphPanel({
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteGraph = async () => {
|
||||
if (!selectedGraphId) return
|
||||
if (!window.confirm('Diesen Progressionsgraph wirklich löschen?')) return
|
||||
setBusy(true)
|
||||
try {
|
||||
await api.deleteExerciseProgressionGraph(selectedGraphId)
|
||||
setSelectedGraphId(null)
|
||||
await refreshGraphs()
|
||||
} catch (err) {
|
||||
alert(err.message || String(err))
|
||||
} finally {
|
||||
setBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
const handleDeleteEdge = async (edgeId) => {
|
||||
if (!selectedGraphId) return
|
||||
setBusy(true)
|
||||
@@ -261,8 +288,159 @@ export default function ExerciseProgressionGraphPanel({
|
||||
await Promise.all([refreshEdges(selectedGraphId), refreshGraphs()])
|
||||
}, [selectedGraphId, refreshEdges, refreshGraphs])
|
||||
|
||||
const selectedGraph = graphs.find((g) => g.id === selectedGraphId)
|
||||
|
||||
if (loadErr) {
|
||||
return (
|
||||
<div className="card" style={{ borderColor: 'var(--danger)' }}>
|
||||
<p style={{ margin: 0, color: 'var(--danger)' }}>{loadErr}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (!selectedGraphId) {
|
||||
return (
|
||||
<div className="exercise-progression-panel">
|
||||
{anchorExerciseId != null && (
|
||||
<p style={{ fontSize: '13px', color: 'var(--text2)', marginBottom: '12px' }}>
|
||||
Kontext:{' '}
|
||||
<strong>{anchorTitle?.trim() || `Übung #${anchorExerciseId}`}</strong>
|
||||
{' · '}
|
||||
<Link to={`/exercises/${anchorExerciseId}`}>Ansehen</Link>
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p style={{ fontSize: '13px', color: 'var(--text2)', marginBottom: '16px' }}>
|
||||
Progressionsgraphen planen didaktische Entwicklungspfade mit Roadmap-Slots, KI-Match und
|
||||
Bewertung — analog zur Übungsbibliothek als eigene Sammlung.
|
||||
</p>
|
||||
|
||||
{busy && graphs.length === 0 ? (
|
||||
<div className="empty-state card" style={{ padding: '2rem 1rem' }}>
|
||||
<div className="spinner" />
|
||||
<p className="muted" style={{ marginTop: '12px' }}>
|
||||
Lade Progressionsgraphen…
|
||||
</p>
|
||||
</div>
|
||||
) : graphs.length === 0 ? (
|
||||
<div className="card empty-state" style={{ padding: '2rem 1rem', textAlign: 'center' }}>
|
||||
<p style={{ margin: '0 0 12px', color: 'var(--text2)' }}>
|
||||
Noch keine Progressionsgraphen — lege den ersten an.
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
onClick={() => {
|
||||
setCreateModalOpen(true)
|
||||
}}
|
||||
>
|
||||
+ Neu
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="exercises-list-grid">
|
||||
{graphs.map((g) => (
|
||||
<ProgressionGraphListCard
|
||||
key={g.id}
|
||||
graph={g}
|
||||
userId={user?.id}
|
||||
disabled={busy}
|
||||
onOpen={(row) => setSelectedGraphId(row.id)}
|
||||
onDelete={handleDeleteGraph}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{createModalOpen ? (
|
||||
<div
|
||||
className="admin-modal-backdrop"
|
||||
role="presentation"
|
||||
onClick={(e) => {
|
||||
if (e.target === e.currentTarget && !busy) setCreateModalOpen(false)
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="admin-modal-sheet"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="new-progression-graph-title"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
style={{ maxWidth: '480px' }}
|
||||
>
|
||||
<div className="admin-modal-sheet__header">
|
||||
<h3 id="new-progression-graph-title" className="admin-modal-sheet__title">
|
||||
Neuer Progressionsgraph
|
||||
</h3>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary admin-modal-sheet__close"
|
||||
disabled={busy}
|
||||
onClick={() => setCreateModalOpen(false)}
|
||||
>
|
||||
Schließen
|
||||
</button>
|
||||
</div>
|
||||
<form onSubmit={handleCreateGraph}>
|
||||
<div className="admin-modal-sheet__body">
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name *</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={newGraphName}
|
||||
onChange={(e) => setNewGraphName(e.target.value)}
|
||||
placeholder="z. B. Kumite-Einstieg Verein Nord"
|
||||
autoFocus
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">{EXERCISE_VISIBILITY_FIELD_LABEL}</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={newGraphVisibility}
|
||||
onChange={(e) => setNewGraphVisibility(e.target.value)}
|
||||
>
|
||||
{filteredGraphVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="admin-modal-sheet__footer">
|
||||
<button type="button" className="btn btn-secondary" disabled={busy} onClick={() => setCreateModalOpen(false)}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Anlegen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="exercise-progression-panel">
|
||||
<div style={{ marginBottom: '12px', display: 'flex', flexWrap: 'wrap', gap: '8px', alignItems: 'center' }}>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
style={{ fontSize: '12px' }}
|
||||
disabled={busy}
|
||||
onClick={() => setSelectedGraphId(null)}
|
||||
>
|
||||
← Zur Übersicht
|
||||
</button>
|
||||
<h2 style={{ margin: 0, fontSize: '1.1rem', flex: '1 1 auto' }}>
|
||||
{selectedGraph?.name || `Graph #${selectedGraphId}`}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
{anchorExerciseId != null && (
|
||||
<p style={{ fontSize: '13px', color: 'var(--text2)', marginBottom: '12px' }}>
|
||||
Kontext:{' '}
|
||||
@@ -272,84 +450,6 @@ export default function ExerciseProgressionGraphPanel({
|
||||
</p>
|
||||
)}
|
||||
|
||||
<p style={{ fontSize: '13px', color: 'var(--text2)', marginBottom: '16px' }}>
|
||||
Ein Progressionsgraph = <strong>Roadmap mit Slots</strong> (Lernziel + Hauptübung + Schwestern).
|
||||
Roadmap, KI-Match und Bewertung sind in einer Ansicht — kein separater Wizard.
|
||||
</p>
|
||||
|
||||
{loadErr && (
|
||||
<div className="card" style={{ borderColor: 'var(--danger)', marginBottom: '12px' }}>
|
||||
<p style={{ margin: 0, color: 'var(--danger)' }}>{loadErr}</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="card" style={{ marginBottom: '12px' }}>
|
||||
<h3 style={{ marginTop: 0, fontSize: '1rem' }}>Graph auswählen</h3>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '10px', alignItems: 'flex-end' }}>
|
||||
<div className="form-row" style={{ flex: '1 1 220px', marginBottom: 0 }}>
|
||||
<label className="form-label">Aktiver Graph</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={selectedGraphId ?? ''}
|
||||
onChange={(e) => setSelectedGraphId(e.target.value ? parseInt(e.target.value, 10) : null)}
|
||||
>
|
||||
<option value="">— wählen —</option>
|
||||
{graphs.map((g) => (
|
||||
<option key={g.id} value={g.id}>
|
||||
{g.name} ({g.edges_count ?? 0} Kanten)
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
className="btn"
|
||||
disabled={busy || !selectedGraphId}
|
||||
onClick={() => refreshEdges(selectedGraphId)}
|
||||
>
|
||||
Aktualisieren
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy || !selectedGraphId} onClick={handleDeleteGraph}>
|
||||
Graph löschen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<form
|
||||
onSubmit={handleCreateGraph}
|
||||
style={{ marginTop: '16px', paddingTop: '16px', borderTop: '1px solid var(--border)' }}
|
||||
>
|
||||
<h4 style={{ margin: '0 0 8px', fontSize: '0.95rem' }}>Neuen Graphen anlegen</h4>
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '10px', alignItems: 'flex-end' }}>
|
||||
<div className="form-row" style={{ flex: '2 1 200px', marginBottom: 0 }}>
|
||||
<label className="form-label">Name</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={newGraphName}
|
||||
onChange={(e) => setNewGraphName(e.target.value)}
|
||||
placeholder="z. B. Kumite-Einstieg Verein Nord"
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row" style={{ flex: '1 1 140px', marginBottom: 0 }}>
|
||||
<label className="form-label">{EXERCISE_VISIBILITY_FIELD_LABEL}</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={newGraphVisibility}
|
||||
onChange={(e) => setNewGraphVisibility(e.target.value)}
|
||||
>
|
||||
{filteredGraphVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<button type="submit" className="btn btn-primary" disabled={busy}>
|
||||
Graph erstellen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{selectedGraphId && anchorExerciseId != null && (
|
||||
<label style={{ display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '12px', fontSize: '13px' }}>
|
||||
<input
|
||||
@@ -361,157 +461,160 @@ export default function ExerciseProgressionGraphPanel({
|
||||
</label>
|
||||
)}
|
||||
|
||||
{selectedGraphId ? (
|
||||
<>
|
||||
<ProgressionGraphEditor
|
||||
key={selectedGraphId}
|
||||
graphId={selectedGraphId}
|
||||
embedded
|
||||
onSaved={handleEditorSaved}
|
||||
/>
|
||||
<ProgressionGraphEditor
|
||||
key={selectedGraphId}
|
||||
graphId={selectedGraphId}
|
||||
embedded
|
||||
onSaved={handleEditorSaved}
|
||||
/>
|
||||
|
||||
<details className="card" style={{ marginBottom: '12px', marginTop: '12px' }}>
|
||||
<summary style={{ cursor: 'pointer', fontWeight: 600 }}>Graph-Einstellungen (Name, Sichtbarkeit)</summary>
|
||||
<div style={{ marginTop: '14px' }}>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name</label>
|
||||
<input className="form-input" value={metaName} onChange={(e) => setMetaName(e.target.value)} />
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Beschreibung</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={2}
|
||||
value={metaDescription}
|
||||
onChange={(e) => setMetaDescription(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">{EXERCISE_VISIBILITY_FIELD_LABEL}</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={metaVisibility}
|
||||
onChange={(e) => setMetaVisibility(e.target.value)}
|
||||
>
|
||||
{filteredGraphVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" className="btn btn-secondary" disabled={busy} onClick={handleSaveMeta}>
|
||||
Metadaten speichern
|
||||
</button>
|
||||
</div>
|
||||
</details>
|
||||
<details className="card" style={{ marginBottom: '12px', marginTop: '12px' }}>
|
||||
<summary style={{ cursor: 'pointer', fontWeight: 600 }}>Graph-Einstellungen (Name, Sichtbarkeit)</summary>
|
||||
<div style={{ marginTop: '14px' }}>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Name</label>
|
||||
<input className="form-input" value={metaName} onChange={(e) => setMetaName(e.target.value)} />
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Beschreibung</label>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={2}
|
||||
value={metaDescription}
|
||||
onChange={(e) => setMetaDescription(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row">
|
||||
<label className="form-label">{EXERCISE_VISIBILITY_FIELD_LABEL}</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={metaVisibility}
|
||||
onChange={(e) => setMetaVisibility(e.target.value)}
|
||||
>
|
||||
{filteredGraphVisOptions.map((o) => (
|
||||
<option key={o.value} value={o.value}>
|
||||
{o.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '8px', flexWrap: 'wrap' }}>
|
||||
<button type="button" className="btn btn-secondary" disabled={busy} onClick={handleSaveMeta}>
|
||||
Metadaten speichern
|
||||
</button>
|
||||
<button type="button" className="btn" disabled={busy} onClick={() => handleDeleteGraph(selectedGraph)}>
|
||||
Graph löschen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten entlang des Pfads"
|
||||
hint="Alle Übungen als Knoten im Graph."
|
||||
profile={skillProfileData?.overall}
|
||||
loading={skillProfileLoading}
|
||||
error={skillProfileError}
|
||||
defaultExpanded={false}
|
||||
artifactType="progression_graph"
|
||||
/>
|
||||
<SkillProfilePanel
|
||||
title="Fähigkeiten entlang des Pfads"
|
||||
hint="Alle Übungen als Knoten im Graph."
|
||||
profile={skillProfileData?.overall}
|
||||
loading={skillProfileLoading}
|
||||
error={skillProfileError}
|
||||
defaultExpanded={false}
|
||||
artifactType="progression_graph"
|
||||
/>
|
||||
|
||||
<details className="card" style={{ marginBottom: '12px' }}>
|
||||
<summary style={{ cursor: 'pointer', fontWeight: 600 }}>
|
||||
Technische Kantenliste ({filteredEdges.length}
|
||||
{edges.length !== filteredEdges.length ? ` von ${edges.length}` : ''})
|
||||
</summary>
|
||||
<div style={{ marginTop: '14px' }}>
|
||||
{filteredEdges.length === 0 ? (
|
||||
<p style={{ color: 'var(--text2)', margin: 0 }}>Keine Kanten.</p>
|
||||
) : (
|
||||
<div style={{ overflowX: 'auto' }}>
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '13px' }}>
|
||||
<thead>
|
||||
<tr style={{ textAlign: 'left', borderBottom: '1px solid var(--border)' }}>
|
||||
<th style={{ padding: '8px 6px' }}>Von</th>
|
||||
<th style={{ padding: '8px 6px' }} />
|
||||
<th style={{ padding: '8px 6px' }}>Nach</th>
|
||||
<th style={{ padding: '8px 6px' }}>Art</th>
|
||||
<th style={{ padding: '8px 6px' }}>Notiz</th>
|
||||
<th style={{ padding: '8px 6px' }} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filteredEdges.map((row) => (
|
||||
<tr key={row.id} style={{ borderBottom: '1px solid var(--border)' }}>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<Link to={`/exercises/${row.from_exercise_id}`}>
|
||||
{row.from_exercise_title || `#${row.from_exercise_id}`}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', color: 'var(--text3)', verticalAlign: 'top' }}>
|
||||
{row.edge_type === 'sibling' ? '·' : '→'}
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<Link to={`/exercises/${row.to_exercise_id}`}>
|
||||
{row.to_exercise_title || `#${row.to_exercise_id}`}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>{edgeTypeLabel(row.edge_type)}</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top', maxWidth: '280px' }}>
|
||||
{editingEdgeNotes === row.id ? (
|
||||
<>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={2}
|
||||
value={notesDraft}
|
||||
onChange={(e) => setNotesDraft(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
style={{ marginTop: '6px', fontSize: '12px', padding: '4px 8px' }}
|
||||
onClick={() => saveNotes(row.id)}
|
||||
>
|
||||
Speichern
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{row.notes || '—'}
|
||||
<button
|
||||
type="button"
|
||||
className="btn"
|
||||
style={{ marginLeft: '8px', fontSize: '12px', padding: '4px 8px' }}
|
||||
onClick={() => startEditNotes(row)}
|
||||
>
|
||||
Bearbeiten
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<details className="card" style={{ marginBottom: '12px' }}>
|
||||
<summary style={{ cursor: 'pointer', fontWeight: 600 }}>
|
||||
Technische Kantenliste ({filteredEdges.length}
|
||||
{edges.length !== filteredEdges.length ? ` von ${edges.length}` : ''})
|
||||
</summary>
|
||||
<div style={{ marginTop: '14px' }}>
|
||||
{filteredEdges.length === 0 ? (
|
||||
<p style={{ color: 'var(--text2)', margin: 0 }}>Keine Kanten.</p>
|
||||
) : (
|
||||
<div style={{ overflowX: 'auto' }}>
|
||||
<table style={{ width: '100%', borderCollapse: 'collapse', fontSize: '13px' }}>
|
||||
<thead>
|
||||
<tr style={{ textAlign: 'left', borderBottom: '1px solid var(--border)' }}>
|
||||
<th style={{ padding: '8px 6px' }}>Von</th>
|
||||
<th style={{ padding: '8px 6px' }} />
|
||||
<th style={{ padding: '8px 6px' }}>Nach</th>
|
||||
<th style={{ padding: '8px 6px' }}>Art</th>
|
||||
<th style={{ padding: '8px 6px' }}>Notiz</th>
|
||||
<th style={{ padding: '8px 6px' }} />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{filteredEdges.map((row) => (
|
||||
<tr key={row.id} style={{ borderBottom: '1px solid var(--border)' }}>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<Link to={`/exercises/${row.from_exercise_id}`}>
|
||||
{row.from_exercise_title || `#${row.from_exercise_id}`}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', color: 'var(--text3)', verticalAlign: 'top' }}>
|
||||
{row.edge_type === 'sibling' ? '·' : '→'}
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<Link to={`/exercises/${row.to_exercise_id}`}>
|
||||
{row.to_exercise_title || `#${row.to_exercise_id}`}
|
||||
</Link>
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>{edgeTypeLabel(row.edge_type)}</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top', maxWidth: '280px' }}>
|
||||
{editingEdgeNotes === row.id ? (
|
||||
<>
|
||||
<textarea
|
||||
className="form-input"
|
||||
rows={2}
|
||||
value={notesDraft}
|
||||
onChange={(e) => setNotesDraft(e.target.value)}
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
style={{ marginTop: '6px', fontSize: '12px', padding: '4px 8px' }}
|
||||
onClick={() => saveNotes(row.id)}
|
||||
>
|
||||
Speichern
|
||||
</button>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{row.notes || '—'}
|
||||
<button
|
||||
type="button"
|
||||
className="btn"
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
padding: '4px 8px',
|
||||
background: 'var(--danger)',
|
||||
color: '#fff',
|
||||
border: 'none',
|
||||
}}
|
||||
onClick={() => handleDeleteEdge(row.id)}
|
||||
style={{ marginLeft: '8px', fontSize: '12px', padding: '4px 8px' }}
|
||||
onClick={() => startEditNotes(row)}
|
||||
>
|
||||
Löschen
|
||||
Bearbeiten
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</td>
|
||||
<td style={{ padding: '8px 6px', verticalAlign: 'top' }}>
|
||||
<button
|
||||
type="button"
|
||||
className="btn"
|
||||
style={{
|
||||
fontSize: '12px',
|
||||
padding: '4px 8px',
|
||||
background: 'var(--danger)',
|
||||
color: '#fff',
|
||||
border: 'none',
|
||||
}}
|
||||
onClick={() => handleDeleteEdge(row.id)}
|
||||
>
|
||||
Löschen
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
</>
|
||||
) : null}
|
||||
)}
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default forwardRef(ExerciseProgressionGraphPanel)
|
||||
Reference in new issue
Block a user