Implement Comparison Logic for Progression Path Suggestions
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m18s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 45s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 14s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m18s
- Added `compare_with_assignments` flag to `ProgressionPathSuggestRequest` to enable comparison of proposed paths with existing slot assignments. - Introduced `_assignment_preservation_active` function to determine if existing assignments should be preserved during path suggestions. - Enhanced `suggest_progression_path` to handle comparison logic, including validation for minimum slot assignments required for comparison. - Implemented `_build_progression_compare_response` to structure the response for comparison results, including slot differences and quality scores. - Updated frontend components to support new comparison features, including handling of slot assignments and optimization comparisons. - Bumped version to reflect the new features and improvements.
This commit is contained in:
1 parent
b8f65e04c5
commit
5ed06002d9
7 files changed
+695
-26
No files matched your search
@@ -16,6 +16,9 @@ import {
|
||||
pathQaShowsStrongResult,
|
||||
setCatalogSelectItems,
|
||||
splitPathQaHints,
|
||||
draftHasLibrarySlotAssignments,
|
||||
slotsToSlotAssignments,
|
||||
draftRetrievalBoostExerciseIds,
|
||||
} from '../utils/progressionGraphDraft'
|
||||
import {
|
||||
aiPreviewToQuickCreateDraft,
|
||||
@@ -1245,6 +1248,22 @@ export default function ExerciseProgressionPathBuilder({
|
||||
setError('')
|
||||
try {
|
||||
const override = majorStepsToOverridePayload(validSteps)
|
||||
const preserveAssignments = draftHasLibrarySlotAssignments({
|
||||
slots: validSteps.map((s, i) => ({
|
||||
majorStepIndex: i,
|
||||
phase: s.phase,
|
||||
learning_goal: s.learning_goal,
|
||||
primary:
|
||||
pathSteps[i]?.exerciseId != null
|
||||
? {
|
||||
kind: 'library',
|
||||
exerciseId: pathSteps[i].exerciseId,
|
||||
exerciseTitle: pathSteps[i].exerciseTitle,
|
||||
variantId: pathSteps[i].variantId,
|
||||
}
|
||||
: { kind: 'empty' },
|
||||
})),
|
||||
})
|
||||
const res = await api.suggestProgressionPath({
|
||||
query: q,
|
||||
max_steps: validSteps.length,
|
||||
@@ -1257,6 +1276,21 @@ export default function ExerciseProgressionPathBuilder({
|
||||
include_llm_roadmap: false,
|
||||
roadmap_first: true,
|
||||
roadmap_override: override,
|
||||
preserve_slot_assignments: preserveAssignments,
|
||||
slot_assignments: pathSteps
|
||||
.map((row, i) => {
|
||||
if (row.exerciseId == null) return null
|
||||
return {
|
||||
exercise_id: row.exerciseId,
|
||||
variant_id: row.variantId || null,
|
||||
title: row.exerciseTitle || null,
|
||||
is_ai_proposal: false,
|
||||
roadmap_major_step_index: i,
|
||||
roadmap_phase: validSteps[i]?.phase || null,
|
||||
roadmap_learning_goal: validSteps[i]?.learning_goal || null,
|
||||
}
|
||||
})
|
||||
.filter(Boolean),
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(startSituation, targetState, roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
|
||||
@@ -162,6 +162,9 @@ export default function ProgressionFindingsPanel({
|
||||
onInsertGapSlot,
|
||||
onGenerateGapAi,
|
||||
onRematchSlots = null,
|
||||
onOptimizeCompare = null,
|
||||
canOptimizeCompare = false,
|
||||
optimizeCompareBusy = false,
|
||||
rematchBusy = false,
|
||||
generatingOfferId = null,
|
||||
aiBusy = false,
|
||||
@@ -174,6 +177,9 @@ export default function ProgressionFindingsPanel({
|
||||
const rematchLog = Array.isArray(pathQa?.rematch_log) ? pathQa.rematch_log : []
|
||||
const refineLog = Array.isArray(pathQa?.refine_log) ? pathQa.refine_log : []
|
||||
const showRematchAction = hasRematchSlotHints(pathQa) && typeof onRematchSlots === 'function'
|
||||
const showOptimizeCompare =
|
||||
typeof onOptimizeCompare === 'function'
|
||||
&& (canOptimizeCompare || pathQa?.assignments_preserved || showRematchAction)
|
||||
const qualityPct = pathQaQualityPercent(pathQa)
|
||||
const strongResult = pathQaShowsStrongResult(pathQa)
|
||||
|
||||
@@ -214,6 +220,12 @@ export default function ProgressionFindingsPanel({
|
||||
Pfad-QS: {pathQa.overall_ok ? 'OK' : 'Hinweise'}
|
||||
{qualityPct != null ? ` (${qualityPct} %)` : ''}
|
||||
</strong>
|
||||
{pathQa.assignments_preserved ? (
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--text2)', fontSize: '11px' }}>
|
||||
Bestehende Slot-Zuordnungen beibehalten — QS wie „Graph bewerten“, ohne Auto-Rematch.
|
||||
{showOptimizeCompare ? ' „Übungen matchen“ oder „Optimierung vergleichen“ prüft Alternativen.' : ''}
|
||||
</p>
|
||||
) : null}
|
||||
{strongResult ? (
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--accent-dark)', fontWeight: 600 }}>
|
||||
Starker Pfad — KI-Empfehlungen unten können Feinschliff oder optionale Vertiefung sein.
|
||||
@@ -350,7 +362,18 @@ export default function ProgressionFindingsPanel({
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
{showRematchAction ? (
|
||||
{showOptimizeCompare ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary btn-full"
|
||||
style={{ marginTop: '8px', fontSize: '12px' }}
|
||||
disabled={optimizeCompareBusy || evaluateDisabled}
|
||||
onClick={onOptimizeCompare}
|
||||
>
|
||||
{optimizeCompareBusy ? 'Vergleich läuft…' : 'Optimierung vergleichen'}
|
||||
</button>
|
||||
) : null}
|
||||
{showRematchAction && !showOptimizeCompare ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-full"
|
||||
|
||||
@@ -22,11 +22,17 @@ import {
|
||||
initialStageLearningGoalFromOffer,
|
||||
} from '../utils/planningContextForExerciseAi'
|
||||
import ExerciseAiSuggestPreviewModal from './ExerciseAiSuggestPreviewModal'
|
||||
import ProgressionOptimizeCompareModal from './ProgressionOptimizeCompareModal'
|
||||
import {
|
||||
addSlotToDraft,
|
||||
applyEvaluateResponseToDraft,
|
||||
applyGapOfferToDraft,
|
||||
applyMatchResponseToDraft,
|
||||
applySelectedCompareSteps,
|
||||
compareResponseHasCuratedSlotChanges,
|
||||
compareResponseHasSlotChanges,
|
||||
curatedSlotDiffs,
|
||||
pathQaQualityPercent,
|
||||
applyResolvedStructuredToDraft,
|
||||
buildPlanningArtifactFromDraft,
|
||||
hydrateProgressionGraphDraft,
|
||||
@@ -43,6 +49,7 @@ import {
|
||||
slotsAsPathStepRows,
|
||||
slotsToEvaluateSteps,
|
||||
draftRetrievalBoostExerciseIds,
|
||||
draftHasLibrarySlotAssignments,
|
||||
slotsToSlotAssignments,
|
||||
syncProgressionRoadmapFromSlots,
|
||||
syncSlotPhasesFromRoadmap,
|
||||
@@ -111,6 +118,10 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
const [slotQuickSaving, setSlotQuickSaving] = useState(false)
|
||||
const [slotQuickError, setSlotQuickError] = useState('')
|
||||
const [activePlanningContextLines, setActivePlanningContextLines] = useState([])
|
||||
const [compareOpen, setCompareOpen] = useState(false)
|
||||
const [comparePayload, setComparePayload] = useState(null)
|
||||
const [comparing, setComparing] = useState(false)
|
||||
const [compareApplying, setCompareApplying] = useState(false)
|
||||
|
||||
const loadGraph = useCallback(async () => {
|
||||
if (!graphId) return
|
||||
@@ -424,6 +435,76 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
}
|
||||
}
|
||||
|
||||
const buildMatchRequestBase = (synced) => {
|
||||
const override = majorStepsToOverridePayload(synced.slots)
|
||||
return {
|
||||
query: (synced.goalQuery || '').trim(),
|
||||
max_steps: synced.slots.length,
|
||||
include_llm_intent: true,
|
||||
include_path_qa: true,
|
||||
include_llm_path_qa: true,
|
||||
include_path_reorder: false,
|
||||
include_ai_gap_fill: true,
|
||||
include_roadmap_preview: true,
|
||||
include_llm_roadmap: false,
|
||||
roadmap_first: true,
|
||||
roadmap_override: override,
|
||||
slot_assignments: slotsToSlotAssignments(synced),
|
||||
retrieval_boost_exercise_ids: draftRetrievalBoostExerciseIds(synced),
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(synced.startSituation, synced.targetState, synced.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
}
|
||||
}
|
||||
|
||||
const fetchOptimizeCompare = async (synced) => {
|
||||
const res = await api.suggestProgressionPath({
|
||||
...buildMatchRequestBase(synced),
|
||||
preserve_slot_assignments: false,
|
||||
compare_with_assignments: true,
|
||||
})
|
||||
if (!res?.comparison_mode) {
|
||||
throw new Error('Kein Vergleich in der Antwort')
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
const presentOptimizeCompare = (res, { source = 'manual' } = {}) => {
|
||||
setSemanticBrief(res?.semantic_brief_summary || null)
|
||||
setTargetSummary(res?.target_profile_summary || null)
|
||||
const baselineQa = res?.baseline_path_qa || null
|
||||
const proposedQa = res?.proposed_path_qa || res?.path_qa || null
|
||||
setPathQa(baselineQa)
|
||||
|
||||
const openCompareDialog = (diffCount, noticePrefix) => {
|
||||
setComparePayload(res)
|
||||
setCompareOpen(true)
|
||||
const bPct = pathQaQualityPercent(baselineQa)
|
||||
const pPct = pathQaQualityPercent(proposedQa)
|
||||
let notice = `${noticePrefix}${diffCount} Slot-Anpassung(en) — Vergleichsdialog geöffnet.`
|
||||
if (bPct != null && pPct != null && pPct !== bPct) {
|
||||
notice += ` QS ${bPct} % → ${pPct} %.`
|
||||
}
|
||||
setMatchNotice(notice)
|
||||
}
|
||||
|
||||
if (source === 'match') {
|
||||
if (compareResponseHasCuratedSlotChanges(res)) {
|
||||
openCompareDialog(curatedSlotDiffs(res).length, 'KI schlägt ')
|
||||
return { opened: true, res }
|
||||
}
|
||||
return { opened: false, res }
|
||||
}
|
||||
|
||||
setComparePayload(res)
|
||||
setCompareOpen(true)
|
||||
if (compareResponseHasSlotChanges(res)) {
|
||||
const diffCount = res.slot_diff_count ?? res.slot_diffs?.length ?? 0
|
||||
openCompareDialog(diffCount, 'KI schlägt ')
|
||||
}
|
||||
return { opened: true, res }
|
||||
}
|
||||
|
||||
const runMatch = async () => {
|
||||
const q = (draft?.goalQuery || '').trim()
|
||||
if (q.length < 3) {
|
||||
@@ -439,24 +520,46 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
setMatchNotice('')
|
||||
try {
|
||||
const synced = syncProgressionRoadmapFromSlots(draft)
|
||||
const override = majorStepsToOverridePayload(synced.slots)
|
||||
const hasAssignments = draftHasLibrarySlotAssignments(synced)
|
||||
|
||||
if (hasAssignments) {
|
||||
const res = await fetchOptimizeCompare(synced)
|
||||
const { opened, res: compareRes } = presentOptimizeCompare(res, { source: 'match' })
|
||||
if (opened) return
|
||||
|
||||
const { draft: matched, remainingOffers } = applyMatchResponseToDraft(
|
||||
{
|
||||
...synced,
|
||||
progressionRoadmap: compareRes?.progression_roadmap || synced.progressionRoadmap,
|
||||
pathSkillExpectations:
|
||||
compareRes?.path_skill_expectations || synced.pathSkillExpectations,
|
||||
},
|
||||
compareRes,
|
||||
)
|
||||
setDraft(matched)
|
||||
setPathQa(compareRes?.proposed_path_qa || compareRes?.path_qa || null)
|
||||
setGapFillOffers(remainingOffers)
|
||||
const ms = compareRes?.match_summary
|
||||
if (ms) {
|
||||
setMatchNotice(
|
||||
`Match: ${ms.library_matches ?? 0}/${ms.slot_count ?? '?'} Slots aus Bibliothek, ${ms.gap_fill_offer_count ?? 0} KI-Angebote. Bestehende Zuordnungen unverändert.`,
|
||||
)
|
||||
}
|
||||
try {
|
||||
await saveProgressionGraphDraft(api, graphId, {
|
||||
...matched,
|
||||
lastFindings: compareRes?.proposed_path_qa || compareRes?.path_qa || null,
|
||||
})
|
||||
setDraft((prev) => (prev ? { ...prev, dirty: false } : prev))
|
||||
} catch (saveErr) {
|
||||
console.warn('Match-Artefakt konnte nicht gespeichert werden', saveErr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
const res = await api.suggestProgressionPath({
|
||||
query: q,
|
||||
max_steps: synced.slots.length,
|
||||
include_llm_intent: true,
|
||||
include_path_qa: true,
|
||||
include_llm_path_qa: true,
|
||||
include_path_reorder: false,
|
||||
include_ai_gap_fill: true,
|
||||
include_roadmap_preview: true,
|
||||
include_llm_roadmap: false,
|
||||
roadmap_first: true,
|
||||
roadmap_override: override,
|
||||
slot_assignments: slotsToSlotAssignments(synced),
|
||||
retrieval_boost_exercise_ids: draftRetrievalBoostExerciseIds(synced),
|
||||
progression_graph_id: Number(graphId),
|
||||
...roadmapStructuredPayload(draft.startSituation, draft.targetState, draft.roadmapNotes),
|
||||
...catalogApiPayload,
|
||||
...buildMatchRequestBase(synced),
|
||||
preserve_slot_assignments: false,
|
||||
})
|
||||
const { draft: matched, remainingOffers } = applyMatchResponseToDraft(
|
||||
{
|
||||
@@ -505,6 +608,58 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
}
|
||||
}
|
||||
|
||||
const runOptimizeCompare = async () => {
|
||||
const q = (draft?.goalQuery || '').trim()
|
||||
if (q.length < 3) {
|
||||
alert('Ziel-Anfrage: mindestens 3 Zeichen.')
|
||||
return
|
||||
}
|
||||
if (!draftHasLibrarySlotAssignments(draft)) {
|
||||
alert('Mindestens ein Slot mit Bibliotheks-Übung nötig für einen Vergleich.')
|
||||
return
|
||||
}
|
||||
setComparing(true)
|
||||
setActionErr('')
|
||||
setMatchNotice('')
|
||||
try {
|
||||
const synced = syncProgressionRoadmapFromSlots(draft)
|
||||
const res = await fetchOptimizeCompare(synced)
|
||||
presentOptimizeCompare(res, { source: 'manual' })
|
||||
} catch (e) {
|
||||
setActionErr(e.message || 'Optimierungs-Vergleich fehlgeschlagen')
|
||||
} finally {
|
||||
setComparing(false)
|
||||
}
|
||||
}
|
||||
|
||||
const applyOptimizeCompare = async (selectedMajorIndices) => {
|
||||
if (!comparePayload || !draft) return
|
||||
setCompareApplying(true)
|
||||
try {
|
||||
const synced = syncProgressionRoadmapFromSlots(draft)
|
||||
const nextDraft = applySelectedCompareSteps(
|
||||
synced,
|
||||
comparePayload.proposed_steps || comparePayload.steps,
|
||||
selectedMajorIndices,
|
||||
)
|
||||
const proposedQa = comparePayload.proposed_path_qa || comparePayload.path_qa
|
||||
setDraft({ ...nextDraft, lastFindings: proposedQa || null })
|
||||
setPathQa(proposedQa || null)
|
||||
setCompareOpen(false)
|
||||
setComparePayload(null)
|
||||
setMatchNotice('Ausgewählte Optimierungen übernommen.')
|
||||
await saveProgressionGraphDraft(api, graphId, {
|
||||
...nextDraft,
|
||||
lastFindings: proposedQa || null,
|
||||
})
|
||||
setDraft((prev) => (prev ? { ...prev, dirty: false } : prev))
|
||||
} catch (e) {
|
||||
setActionErr(e.message || 'Übernahme fehlgeschlagen')
|
||||
} finally {
|
||||
setCompareApplying(false)
|
||||
}
|
||||
}
|
||||
|
||||
const runEvaluate = async () => {
|
||||
const q = (draft?.goalQuery || '').trim()
|
||||
if (q.length < 3) {
|
||||
@@ -951,9 +1106,25 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
className="btn btn-secondary"
|
||||
disabled={busy || matching}
|
||||
onClick={runMatch}
|
||||
title={
|
||||
draftHasLibrarySlotAssignments(draft)
|
||||
? 'Voller Match mit Auto-Optimierung — bei Abweichungen öffnet sich der Vergleichsdialog'
|
||||
: 'Bibliotheks-Übungen für leere Slots finden'
|
||||
}
|
||||
>
|
||||
{matching ? 'Match…' : 'Übungen matchen'}
|
||||
</button>
|
||||
{draftHasLibrarySlotAssignments(draft) ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
disabled={busy || comparing || matching}
|
||||
onClick={runOptimizeCompare}
|
||||
title="Aktuellen Pfad vs. voller Match mit Auto-Optimierung — du wählst pro Slot"
|
||||
>
|
||||
{comparing ? 'Vergleich…' : 'Optimierung vergleichen'}
|
||||
</button>
|
||||
) : null}
|
||||
<button type="button" className="btn btn-primary" disabled={busy} onClick={handleSave}>
|
||||
{busy ? 'Speichern…' : 'Graph speichern'}
|
||||
</button>
|
||||
@@ -1015,6 +1186,9 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
onInsertGapSlot={handleInsertGapSlot}
|
||||
onGenerateGapAi={openGapFillPrep}
|
||||
onRematchSlots={runMatch}
|
||||
onOptimizeCompare={runOptimizeCompare}
|
||||
canOptimizeCompare={draftHasLibrarySlotAssignments(draft)}
|
||||
optimizeCompareBusy={comparing}
|
||||
rematchBusy={matching}
|
||||
generatingOfferId={generatingOfferId}
|
||||
aiBusy={gapAiBusy}
|
||||
@@ -1054,6 +1228,18 @@ export default function ProgressionGraphEditor({ graphId, embedded = false, onSa
|
||||
zIndex={2100}
|
||||
/>
|
||||
|
||||
<ProgressionOptimizeCompareModal
|
||||
open={compareOpen}
|
||||
comparison={comparePayload}
|
||||
onClose={() => {
|
||||
if (compareApplying) return
|
||||
setCompareOpen(false)
|
||||
setComparePayload(null)
|
||||
}}
|
||||
onApplySelected={applyOptimizeCompare}
|
||||
applying={compareApplying}
|
||||
/>
|
||||
|
||||
<ExerciseGapFillPrepModal
|
||||
open={gapPrepOpen}
|
||||
offer={activeOffer}
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
* Gegenüberstellung: bestehender Pfad vs. optimierter Match-Vorschlag.
|
||||
*/
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import { pathQaQualityPercent } from '../utils/progressionGraphDraft'
|
||||
|
||||
function qaLabel(pathQa) {
|
||||
const pct = pathQaQualityPercent(pathQa)
|
||||
const ok = pathQa?.overall_ok
|
||||
if (pct != null) return `${ok ? 'OK' : 'Hinweise'} (${pct} %)`
|
||||
return ok ? 'OK' : 'Hinweise'
|
||||
}
|
||||
|
||||
export default function ProgressionOptimizeCompareModal({
|
||||
open,
|
||||
comparison,
|
||||
onClose,
|
||||
onApplySelected,
|
||||
applying = false,
|
||||
}) {
|
||||
const slotDiffs = Array.isArray(comparison?.slot_diffs) ? comparison.slot_diffs : []
|
||||
const [selected, setSelected] = useState(() => new Set())
|
||||
|
||||
const allKeys = useMemo(
|
||||
() => slotDiffs.map((d) => Number(d.roadmap_major_step_index)),
|
||||
[slotDiffs],
|
||||
)
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!open) return
|
||||
setSelected(new Set(allKeys))
|
||||
}, [open, allKeys])
|
||||
|
||||
if (!open || !comparison) return null
|
||||
|
||||
const baselineQa = comparison.baseline_path_qa
|
||||
const proposedQa = comparison.proposed_path_qa || comparison.path_qa
|
||||
const baselinePct = pathQaQualityPercent(baselineQa)
|
||||
const proposedPct = pathQaQualityPercent(proposedQa)
|
||||
|
||||
const toggle = (midx) => {
|
||||
setSelected((prev) => {
|
||||
const next = new Set(prev)
|
||||
if (next.has(midx)) next.delete(midx)
|
||||
else next.add(midx)
|
||||
return next
|
||||
})
|
||||
}
|
||||
|
||||
const toggleAll = (on) => {
|
||||
setSelected(on ? new Set(allKeys) : new Set())
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="modal-overlay"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-labelledby="optimize-compare-title"
|
||||
onClick={(e) => {
|
||||
if (e.target === e.currentTarget && !applying) onClose()
|
||||
}}
|
||||
>
|
||||
<div
|
||||
className="card modal-content"
|
||||
style={{ maxWidth: '720px', width: '100%', maxHeight: '90vh', overflow: 'auto' }}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
<h3 id="optimize-compare-title" style={{ marginTop: 0 }}>
|
||||
Optimierung vergleichen
|
||||
</h3>
|
||||
<p style={{ fontSize: '12px', color: 'var(--text3)', marginTop: 0, lineHeight: 1.45 }}>
|
||||
Links dein aktueller Pfad, rechts der Vorschlag nach vollem Match inkl. Auto-Optimierung.
|
||||
Wähle die Slots, die du übernehmen möchtest.
|
||||
</p>
|
||||
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr',
|
||||
gap: '12px',
|
||||
marginBottom: '14px',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
padding: '10px 12px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid var(--border)',
|
||||
background: 'var(--surface2)',
|
||||
fontSize: '12px',
|
||||
}}
|
||||
>
|
||||
<strong>Aktuell</strong>
|
||||
<div style={{ marginTop: '6px' }}>{qaLabel(baselineQa)}</div>
|
||||
{baselineQa?.topic_coverage ? (
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--text2)' }}>{baselineQa.topic_coverage}</p>
|
||||
) : null}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
padding: '10px 12px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid color-mix(in srgb, var(--accent) 35%, var(--border))',
|
||||
background: 'color-mix(in srgb, var(--accent) 8%, var(--surface2))',
|
||||
fontSize: '12px',
|
||||
}}
|
||||
>
|
||||
<strong>Vorschlag (Match + Optimierung)</strong>
|
||||
<div style={{ marginTop: '6px' }}>{qaLabel(proposedQa)}</div>
|
||||
{proposedPct != null && baselinePct != null && proposedPct !== baselinePct ? (
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--text2)' }}>
|
||||
Δ {proposedPct - baselinePct > 0 ? '+' : ''}
|
||||
{proposedPct - baselinePct} Prozentpunkte
|
||||
</p>
|
||||
) : null}
|
||||
{proposedQa?.topic_coverage ? (
|
||||
<p style={{ margin: '6px 0 0', color: 'var(--text2)' }}>{proposedQa.topic_coverage}</p>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{slotDiffs.length === 0 ? (
|
||||
<p style={{ fontSize: '12px', color: 'var(--text2)' }}>
|
||||
Keine abweichenden Slot-Zuordnungen — der optimierte Lauf liefert denselben Pfad.
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
<div style={{ display: 'flex', gap: '8px', marginBottom: '8px', flexWrap: 'wrap' }}>
|
||||
<button type="button" className="btn btn-secondary" style={{ fontSize: '11px' }} onClick={() => toggleAll(true)}>
|
||||
Alle wählen
|
||||
</button>
|
||||
<button type="button" className="btn btn-secondary" style={{ fontSize: '11px' }} onClick={() => toggleAll(false)}>
|
||||
Keine
|
||||
</button>
|
||||
</div>
|
||||
<ul style={{ listStyle: 'none', padding: 0, margin: 0, display: 'flex', flexDirection: 'column', gap: '8px' }}>
|
||||
{slotDiffs.map((diff) => {
|
||||
const midx = Number(diff.roadmap_major_step_index)
|
||||
const checked = selected.has(midx)
|
||||
return (
|
||||
<li
|
||||
key={`diff-${midx}`}
|
||||
style={{
|
||||
padding: '10px 12px',
|
||||
borderRadius: '8px',
|
||||
border: '1px solid var(--border)',
|
||||
background: checked ? 'var(--surface2)' : 'var(--surface)',
|
||||
fontSize: '12px',
|
||||
}}
|
||||
>
|
||||
<label style={{ display: 'flex', gap: '8px', alignItems: 'flex-start', cursor: 'pointer' }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={checked}
|
||||
onChange={() => toggle(midx)}
|
||||
disabled={applying}
|
||||
style={{ marginTop: '3px' }}
|
||||
/>
|
||||
<span style={{ flex: 1 }}>
|
||||
<strong>Slot {midx + 1}</strong>
|
||||
<div
|
||||
style={{
|
||||
display: 'grid',
|
||||
gridTemplateColumns: '1fr 1fr',
|
||||
gap: '8px',
|
||||
marginTop: '6px',
|
||||
}}
|
||||
>
|
||||
<span style={{ color: 'var(--text2)' }}>
|
||||
Bisher: {diff.baseline_title || '— leer —'}
|
||||
</span>
|
||||
<span style={{ color: 'var(--accent-dark)' }}>
|
||||
Neu: {diff.proposed_title || '— leer —'}
|
||||
</span>
|
||||
</div>
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
)
|
||||
})}
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '8px', marginTop: '16px', justifyContent: 'flex-end' }}>
|
||||
<button type="button" className="btn btn-secondary" disabled={applying} onClick={onClose}>
|
||||
Abbrechen
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
disabled={applying || selected.size === 0 || slotDiffs.length === 0}
|
||||
onClick={() => onApplySelected([...selected])}
|
||||
>
|
||||
{applying ? 'Übernehmen …' : `Auswahl übernehmen (${selected.size})`}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in new issue
Block a user