diff --git a/docs/api.md b/docs/api.md index 8e042a8..c94ff0a 100644 --- a/docs/api.md +++ b/docs/api.md @@ -99,6 +99,14 @@ Wyłączenie `viewer.nvim.sync` automatycznie wyłącza również `viewer.nvim.control`. Samo ponowne włączenie synchronizacji nie uzbraja sterowania klawiaturą bez jawnego `control: true`. +### Podział odpowiedzialności widoków + +Interaktywny diagram UML pokazuje przepływ i służy do wyboru kroku. Nie +renderuje pod SVG osobnych paneli kodu, terminala, rejestrów, pamięci ani ramki +stosu. Te dane prezentuje `Nvim view`, ustawiany przez snapshot wybranego +kroku. Snapshoty pozostają w JSON/API, mimo że nie są powielane wizualnie pod +diagramem. + ## Postęp zajęć i raport | Metoda i endpoint | Znaczenie | diff --git a/react/src/main.tsx b/react/src/main.tsx index 4e8106d..70cefb9 100644 --- a/react/src/main.tsx +++ b/react/src/main.tsx @@ -1991,7 +1991,6 @@ function SnapshotInteractiveUmlSequence({ phase.steps.map((step) => ({ phase, step })), ); const storageKey = `${config.storage_key ?? asset.label}-uml-step`; - const viewStorageKey = `${config.storage_key ?? asset.label}-evidence-view`; const focusStorageKey = `${config.storage_key ?? asset.label}-navigation-level`; const rootRef = useRef(null); const canvasRef = useRef(null); @@ -2001,10 +2000,6 @@ function SnapshotInteractiveUmlSequence({ const [svgMarkup, setSvgMarkup] = useState(""); const [svgFailed, setSvgFailed] = useState(false); const [revealRevision, setRevealRevision] = useState(0); - const [approvalBusy, setApprovalBusy] = useState(false); - const [evidenceView, setEvidenceView] = useState<"code" | "terminal">(() => - localStorage.getItem(viewStorageKey) === "terminal" ? "terminal" : "code", - ); const [stepIndex, setStepIndex] = useState(() => Math.max( 0, @@ -2026,10 +2021,6 @@ function SnapshotInteractiveUmlSequence({ () => localStorage.setItem(storageKey, String(stepIndex)), [stepIndex, storageKey], ); - useEffect( - () => localStorage.setItem(viewStorageKey, evidenceView), - [evidenceView, viewStorageKey], - ); useEffect( () => localStorage.setItem(focusStorageKey, focusLevel), [focusLevel, focusStorageKey], @@ -2405,53 +2396,7 @@ function SnapshotInteractiveUmlSequence({ }, [active, entries, focusLevel, onSetStatus, progress]); if (!active) return null; const { phase, step } = active; - const snapshot = step.snapshot; - const completed = Boolean( - step.progress_id && - progress?.items?.[step.progress_id]?.status === "approved", - ); const phaseEntries = entries.filter((entry) => entry.phase.id === phase.id); - const arena = snapshot.memory.arena; - const arenaPercent = arena?.offset == null - ? 0 - : Math.min(100, (arena.offset / arena.size_bytes) * 100); - const terminalView = config.terminal_view; - const visibleEvidenceView = - evidenceView === "terminal" && terminalView?.href ? "terminal" : "code"; - const frameFields = [...snapshot.frame.fields].sort( - (left, right) => - Number.parseInt(left.address, 16) - Number.parseInt(right.address, 16), - ); - const frameStart = Number.parseInt(snapshot.frame.sp, 16); - const frameEnd = Number.parseInt(snapshot.frame.fp, 16); - const frameSegments: Array< - | { kind: "gap"; address: number; sizeBytes: number } - | { kind: "field"; field: UmlSnapshotFrameField; sizeBytes: number } - > = []; - let frameCursor = frameStart; - if (Number.isFinite(frameStart) && Number.isFinite(frameEnd)) { - frameFields.forEach((field) => { - const address = Number.parseInt(field.address, 16); - const sizeBytes = field.size_bytes ?? 4; - if (!Number.isFinite(address) || address < frameStart || address >= frameEnd) return; - if (address > frameCursor) { - frameSegments.push({ - kind: "gap", - address: frameCursor, - sizeBytes: address - frameCursor, - }); - } - frameSegments.push({ kind: "field", field, sizeBytes }); - frameCursor = Math.max(frameCursor, address + sizeBytes); - }); - if (frameCursor < frameEnd) { - frameSegments.push({ - kind: "gap", - address: frameCursor, - sizeBytes: frameEnd - frameCursor, - }); - } - } return (
- -
-
-
- - {visibleEvidenceView === "terminal" - ? "DOWÓD REFERENCYJNY · TERMDEBUG" - : `DOWÓD · KROK ${String(step.number).padStart(2, "0")}`} - - - {visibleEvidenceView === "terminal" - ? terminalView?.title ?? "Termdebug" - : step.label} - -
-
- - -
-
- {visibleEvidenceView === "terminal" && terminalView?.href ? ( -
- {terminalView.alt} - {(terminalView.title || terminalView.caption) && ( -
- {terminalView.title && {terminalView.title}} - {terminalView.caption && {terminalView.caption}} -
- )} -
- ) : ( -
-
-
- C - {snapshot.code?.source_ref ?? step.code_ref ?? "źródło"} -
-
{snapshot.code?.source ?? step.label}
-
-
-
- RV32 - pc = {snapshot.pc} -
-
{snapshot.code?.assembly ?? step.code_ref ?? snapshot.pc}
-
- {snapshot.code?.note &&

{snapshot.code.note}

} -
- )} -
- - - {step.progress_id && ( - - )} ); }