// Minimal add-in taskpane script — one button that calls the playground server // Wait for Office to be ready before attaching event handlers Office.onReady(function(info) { // info.host will be 'Excel' when running in Excel console.log('Office.onReady fired, host:', info.host); const uploadBtn = document.getElementById('uploadBtn'); const status = document.getElementById('status'); function setStatus(text, ok) { status.innerHTML = '
' + text + '
'; } uploadBtn.addEventListener('click', async function() { uploadBtn.disabled = true; setStatus('Starting upload...'); try { const res = await fetch('http://localhost:3002/api/upload-managers', { method: 'POST' }); const json = await res.json(); if (!res.ok) throw new Error(json && json.error ? json.error : 'Unknown response'); var link = (json.result && json.result.share && json.result.share.link) ? json.result.share.link.webUrl : 'unknown'; setStatus('Upload finished. Share link: ' + link, true); } catch (err) { console.error(err); setStatus('Upload failed: ' + (err.message || err), false); } finally { uploadBtn.disabled = false; } }); });