From daa813f51150422d62cfadd656a341bb07b1d330 Mon Sep 17 00:00:00 2001 From: a2nr Date: Fri, 21 Aug 2026 23:46:15 +0700 Subject: [PATCH] feat(content-editor): remove Preview tab, load Circuit/Velxio/Flowchart components - Remove Preview tab (preview already shown in left content panel) - Circuit tab loads actual CircuitEditor component with extracted initial_circuit - Velxio tab loads velxio iframe with embed mode - Flowchart tab loads flowchart iframe - C/Python tabs remain as read-only CodeEditor with extracted code --- .../src/routes/teacher/content/+page.svelte | 92 +++++++++++++++---- 1 file changed, 73 insertions(+), 19 deletions(-) diff --git a/frontend/src/routes/teacher/content/+page.svelte b/frontend/src/routes/teacher/content/+page.svelte index c1886cb..5b9f625 100644 --- a/frontend/src/routes/teacher/content/+page.svelte +++ b/frontend/src/routes/teacher/content/+page.svelte @@ -3,6 +3,7 @@ import { authIsTeacher } from '$stores/auth'; import { createFloatingPanel } from '$actions/floatingPanel.svelte'; import CodeEditor from '$components/CodeEditor.svelte'; + import CircuitEditor from '$components/CircuitEditor.svelte'; import ContentFileTree from '$components/ContentFileTree.svelte'; import LessonContentView from '$components/LessonContentView.svelte'; import QuizPreviewReadonly from '$components/QuizPreviewReadonly.svelte'; @@ -14,6 +15,7 @@ const float = createFloatingPanel(); let editorRef = $state(null); + let circuitEditorRef = $state(null); // Mobile: show tree or editor let mobileShowTree = $state(true); @@ -84,7 +86,6 @@ // Tab label map for chrome tabs let allTabs = $derived([ { id: 'editor', label: 'Editor' }, - { id: 'preview', label: 'Preview', show: !!mgr.previewHtml }, ...dynamicTabs, { id: 'exercise', label: 'Exercise', show: hasExercise }, { id: 'quiz', label: 'Quiz', show: hasQuiz }, @@ -525,21 +526,6 @@ {/if} - -
- {#if mgr.previewLoading} -
Memuat preview...
- {:else if mgr.previewHtml} -
- {@html mgr.previewHtml} -
- {:else} -
-

Buka file materi dan edit untuk melihat preview.

-
- {/if} -
-
{#if mgr.previewExerciseHtml} @@ -565,10 +551,38 @@ {/if}
- + {#each dynamicTabs as dynTab}
- {#if extractedCodes[dynTab.id]} + {#if dynTab.id === 'circuit'} +
+ {#if extractedCodes.circuit} + + {:else} +

Belum ada data circuit.

+ {/if} +
+ {:else if dynTab.id === 'velxio'} +
+ +
+ {:else if dynTab.id === 'flowchart'} +
+ +
+ {:else if extractedCodes[dynTab.id]}
{:else}
-

Belum ada kode {dynTab.label} di konten ini.

+

Belum ada konten {dynTab.label}.

{/if}
@@ -966,6 +980,46 @@ height: 100%; } + /* Circuit tab */ + .circuit-tab-content { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; + min-height: 0; + } + .circuit-tab-content :global(.panel) { + flex: 1; + } + + /* Velxio / Arduino tab */ + .velxio-tab-content { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; + min-height: 0; + } + .velxio-iframe { + width: 100%; + flex: 1; + border: none; + } + + /* Flowchart tab */ + .flowchart-tab-content { + flex: 1; + display: flex; + flex-direction: column; + overflow: hidden; + min-height: 0; + } + .flowchart-iframe { + width: 100%; + flex: 1; + border: none; + } + /* Asset Preview */ .asset-preview { display: flex;