From 214a68e4eb271251dde5fa1974109d2ec22522fd Mon Sep 17 00:00:00 2001 From: Kawa Date: Mon, 30 Mar 2026 09:37:25 +0200 Subject: [PATCH] feat(05-02): add scriptTargets filtering and Back button to ReviewStep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Destructure dispatch from useWizard() alongside state - Derive showIntune and showRmm booleans from state.deployment.scriptTargets - Conditionally unmount Intune OutputBlocks (showIntune) and RMM OutputBlock (showRmm) - rclone.conf OutputBlock always rendered regardless of scriptTargets - handleDownloadZip builds files array dynamically — filters by showIntune/showRmm - Add Back button dispatching SET_STEP(2) following DeploymentStep pattern - All 15 ReviewStep tests green including new TECH-01 and TECH-02 cases --- src/components/wizard/ReviewStep.tsx | 80 ++++++++++++++++++---------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/src/components/wizard/ReviewStep.tsx b/src/components/wizard/ReviewStep.tsx index 6ee9a0b..ba92c7d 100644 --- a/src/components/wizard/ReviewStep.tsx +++ b/src/components/wizard/ReviewStep.tsx @@ -15,7 +15,7 @@ import { downloadZip } from '../../utils/downloadZip'; const PLACEHOLDER = '# Fill in the wizard steps to generate your rclone.conf'; export function ReviewStep() { - const { state } = useWizard(); + const { state, dispatch } = useWizard(); const [acknowledged, setAcknowledged] = useState(false); // CONF-02: live preview — updates on every state change @@ -51,17 +51,22 @@ export function ReviewStep() { } }, [state]); - // DOWN-05: ZIP bundle — always include all 4 files + const showIntune = state.deployment.scriptTargets.includes('intune'); + const showRmm = state.deployment.scriptTargets.includes('rmm'); + + // DOWN-05: ZIP bundle — filtered by scriptTargets (TECH-01) async function handleDownloadZip() { - await downloadZip( - [ - { name: 'rclone.conf', content: rcloneConf }, - { name: 'intune-install.ps1', content: intuneInstall }, - { name: 'intune-detection.ps1', content: intuneDetection }, - { name: 'rmm-script.ps1', content: rmmScript }, - ], - 'rclone-deployment.zip' - ); + const files: { name: string; content: string }[] = [ + { name: 'rclone.conf', content: rcloneConf }, + ]; + if (showIntune) { + files.push({ name: 'intune-install.ps1', content: intuneInstall }); + files.push({ name: 'intune-detection.ps1', content: intuneDetection }); + } + if (showRmm) { + files.push({ name: 'rmm-script.ps1', content: rmmScript }); + } + await downloadZip(files, 'rclone-deployment.zip'); } return ( @@ -93,24 +98,41 @@ export function ReviewStep() { filename="rclone.conf" disabled={!acknowledged} /> - - - + {showIntune && ( + + )} + {showIntune && ( + + )} + {showRmm && ( + + )} + + {/* TECH-02: Back button — dispatches SET_STEP(2) */} +
+ +
{/* DOWN-05: ZIP bundle */}