diff --git a/toolbar-app/vonage-toolbar/app.ts b/toolbar-app/vonage-toolbar/app.ts index 6e05799..2d9384f 100644 --- a/toolbar-app/vonage-toolbar/app.ts +++ b/toolbar-app/vonage-toolbar/app.ts @@ -8,6 +8,7 @@ let tutorial: { starterFiles: string[]; capabilities: string[]; version: string; + filename: string; } = { files: [], openFiles: [], @@ -16,12 +17,14 @@ let tutorial: { starterFiles: [], capabilities: [], version: '', + filename: '' }; export default defineToolbarApp({ init(canvas, app, server) { const myWindow = document.createElement('astro-dev-toolbar-window'); const myContent = document.createElement('div'); + myContent.style.overflowY = 'auto'; myContent.innerHTML = `
Step 1: Select panels needed @@ -86,7 +89,12 @@ export default defineToolbarApp({
- Step 9: Finish up + Step 9: Enter filename for the zip file + This will be used also for the repo's folder name +
+
+
+ Step 10: Finish up Click to start generating the tutorial:

@@ -102,6 +110,15 @@ export default defineToolbarApp({ const astroToolbarWindow = canvas.querySelector('astro-dev-toolbar-window'); + const filenameInput = astroToolbarWindow?.querySelector( + '#filename' + ) as HTMLInputElement; + filenameInput.value = tutorial.filename !== '' ? tutorial.filename : ''; + filenameInput?.addEventListener('change', (event) => { + tutorial.filename = filenameInput?.value; + saveTutorial(); + }); + const versionInput = astroToolbarWindow?.querySelector( '#version' ) as HTMLInputElement; @@ -182,6 +199,7 @@ export default defineToolbarApp({ } versionInput.value = tutorial.version; repositoryInput.value = tutorial.repository; + filenameInput.value = tutorial.filename; } function checkLocalStorage() { @@ -432,7 +450,7 @@ export default defineToolbarApp({ astroToolbarWindow?.querySelector( '#download-link' ) as HTMLAnchorElement - ).href = `${window.location.origin}/product_name-language-topic.zip`; + ).href = `${window.location.origin}/${tutorial.filename}.zip`; generateButton.disabled = false; completeSpan.style.display = 'block'; // clear local storage diff --git a/toolbar-app/vonage-toolbar/integration.ts b/toolbar-app/vonage-toolbar/integration.ts index b36816a..0c17fea 100644 --- a/toolbar-app/vonage-toolbar/integration.ts +++ b/toolbar-app/vonage-toolbar/integration.ts @@ -61,7 +61,7 @@ export default { const zip = new AdmZip(); let exclude = ['node_modules', 'dist']; const sourceDir = './'; - const zipFile = './public/product_name-language-topic.zip'; + const zipFile = data.tutorial.filename === '' ? './public/product_name-language-topic.zip' : `./public/${data.tutorial.filename}.zip`; await zip.addLocalFolderPromise(sourceDir, { filter: (filePath) => !exclude.some((ex) => filePath.includes(ex)), });