+ Download these files.
+ {files.map((file) => (
+
+ }
+ onClick={() => {
+ const dotIndex = file.name.lastIndexOf('.');
+ const baseName =
+ dotIndex !== -1 ? file.name.substring(0, dotIndex) : file.name;
+ const extension =
+ dotIndex !== -1 ? file.name.substring(dotIndex + 1) : 'txt';
+
+ downloadFile(file.content, baseName, extension);
+ }}
+ >
+ {file.name}
+
+
+
+ {file.content}
+
+
+ ))}
+
+ );
+};
+
+// Watches for changes in the current step, then calls onChangeCurrentTask so
+// that Creator can update the live preview.
+const WizardSpy = () => {
+ const wizardContext = useContext(DdfWizardContext);
+ const creatorContext = useContext(CreatorWizardContext);
+
+ useEffect(() => {
+ creatorContext.onChangeCurrentTask(
+ taskFromStepName(wizardContext.currentStep.name)
+ );
+ }, [wizardContext.currentStep.name]);
+
+ return undefined;
+};
+
+const CreatorWizard = ({
+ onChangeKind,
+ onChangeQuickStartSpec,
+ onChangeBundles,
+ onChangeTaskContents,
+ onChangeCurrentTask,
+ files,
+ errors,
+}: CreatorWizardProps) => {
+ const chrome = useChrome();
+ const schema = useMemo(() => makeSchema(chrome), []);
+
+ const context = useMemo(
+ () => ({
+ errors,
+ files,
+ onChangeCurrentTask,
+ }),
+ [errors, files]
+ );
+
+ const componentMapper = {
+ ...pf4ComponentMapper,
+ 'lr-task-error': TaskErrorPreview,
+ 'lr-download-files': FileDownload,
+ 'lr-wizard-spy': WizardSpy,
+ };
+
+ return (
+