From d27068b11ae80d2639bbbe9eaafb4633a48dee47 Mon Sep 17 00:00:00 2001 From: Jaakko Vanhala Date: Sun, 12 Apr 2026 20:18:39 +0300 Subject: [PATCH] UI-korjaus korjattu (GTFO gemini) --- .../frontend/src/components/Editor.astro | 5 +- network-poc/frontend/src/pages/index.astro | 46 ++++--------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/network-poc/frontend/src/components/Editor.astro b/network-poc/frontend/src/components/Editor.astro index 8349b81..be1ade6 100644 --- a/network-poc/frontend/src/components/Editor.astro +++ b/network-poc/frontend/src/components/Editor.astro @@ -2,7 +2,10 @@
-
Tiedostot
+
+ Tiedostot + +
Generoi projekti:
kpn project "..."
diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro index 6780698..14f59cf 100644 --- a/network-poc/frontend/src/pages/index.astro +++ b/network-poc/frontend/src/pages/index.astro @@ -1430,7 +1430,9 @@ Blog → Author: name,email,bio(Text|None) / Post: title, content(Text), author_ // Oppimispolku renderLearnView(promptLog); - renderProjectCard(files, task); + termLog(`\nSiirretään tiedostot Editoriin...`); + window._currentProjectName = task; + setTimeout(() => window.openInEditor(files), 1000); } async function kpnPipelineSimple(task) { @@ -1456,41 +1458,7 @@ Blog → Author: name,email,bio(Text|None) / Post: title, content(Text), author_ termLog(`\n━━━ Done ━━━`); } - // === Project card === - window._projectFiles = {}; // id → files - - function renderProjectCard(files, name) { - const entries = Object.entries(files); - if (!entries.length) return; - const id = 'proj-' + Date.now(); - window._projectFiles[id] = files; - - const tabs = entries.map(([n],i) => - `
${esc(n)}
` - ).join(''); - - const panels = entries.map(([n,c],i) => - `
` + - `
` + - `
` + - `
${highlightCode(c)}
` - ).join(''); - - const html = `
` + - `
` + - `${esc(name||'Projekti')} (${entries.length})` + - `` + - `` + - `` + - `` + - `
` + - `
${tabs}
${panels}
`; - - const div = document.createElement('div'); - div.innerHTML = html; - termPanel.appendChild(div.firstElementChild); - termPanel.scrollTop = termPanel.scrollHeight; - } + // === Poistettiin renderProjectCard ja siirryttiin suoraan Editorin käyttöön === window.copyProjectFile = function(id, name) { const files = window._projectFiles[id]; if (files && files[name]) navigator.clipboard.writeText(files[name]); @@ -1501,8 +1469,9 @@ Blog → Author: name,email,bio(Text|None) / Post: title, content(Text), author_ const text = Object.entries(files).map(([n,c]) => '# --- ' + n + ' ---\n' + c).join('\n\n'); navigator.clipboard.writeText(text); }; - window.downloadProjectZip = function(id, name) { - const files = window._projectFiles[id]; + window.downloadProjectZip = function() { + const files = window._currentEditorFiles; + const name = window._currentProjectName || 'projekti'; if (!files) return; const enc = new TextEncoder(); const entries = Object.entries(files); @@ -1618,6 +1587,7 @@ Blog → Author: name,email,bio(Text|None) / Post: title, content(Text), author_ const langMap = {py:'python',rs:'rust',js:'javascript',ts:'typescript',toml:'toml',json:'json',html:'html',css:'css',md:'markdown',txt:'plaintext'}; window.openInEditor = async function(files) { + window._currentEditorFiles = files; switchTab('editor'); try { await initMonaco(); } catch(e) { console.error('Monaco-virhe:', e); return; } const m = window.monaco;