diff --git a/network-poc/frontend/src/pages/index.astro b/network-poc/frontend/src/pages/index.astro index 3e9ebfd..cc3fd47 100644 --- a/network-poc/frontend/src/pages/index.astro +++ b/network-poc/frontend/src/pages/index.astro @@ -491,18 +491,49 @@ import AgentBar from "../components/AgentBar.astro"; } // === Project card === + window._projectFiles = {}; // id → files + function renderProjectCard(files, name) { const entries = Object.entries(files); if (!entries.length) return; const id = 'proj-' + Date.now(); - 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}
`; + 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; } + window.copyProjectFile = function(id, name) { + const files = window._projectFiles[id]; + if (files && files[name]) navigator.clipboard.writeText(files[name]); + }; + window.copyAllProjectFiles = function(id) { + const files = window._projectFiles[id]; + if (!files) return; + const text = Object.entries(files).map(([n,c]) => '# --- ' + n + ' ---\n' + c).join('\n\n'); + navigator.clipboard.writeText(text); + }; window.switchProjTab = function(id,i) { document.querySelectorAll(`.project-tab[data-card="${id}"]`).forEach((t,j) => t.classList.toggle('active', j===i)); document.querySelectorAll(`.proj-panel[data-card="${id}"]`).forEach((p,j) => p.style.display = j===i ? '' : 'none');