diff --git a/frontend/src/components/scripts/ScriptGeneratorPanel.tsx b/frontend/src/components/scripts/ScriptGeneratorPanel.tsx new file mode 100644 index 00000000..b7122ecd --- /dev/null +++ b/frontend/src/components/scripts/ScriptGeneratorPanel.tsx @@ -0,0 +1,113 @@ +import { Terminal, Download, Loader2, AlertTriangle } from 'lucide-react' +import { useScriptGeneratorStore } from '@/store/scriptGeneratorStore' +import { usePermissions } from '@/hooks/usePermissions' +import { ScriptParameterForm } from './ScriptParameterForm' +import { ScriptPreview } from './ScriptPreview' + +export function ScriptGeneratorPanel() { + const selectedTemplate = useScriptGeneratorStore(s => s.selectedTemplate) + const isLoadingDetail = useScriptGeneratorStore(s => s.isLoadingDetail) + const generatedScript = useScriptGeneratorStore(s => s.generatedScript) + const generationWarnings = useScriptGeneratorStore(s => s.generationWarnings) + const isGenerating = useScriptGeneratorStore(s => s.isGenerating) + const generateError = useScriptGeneratorStore(s => s.generateError) + const generate = useScriptGeneratorStore(s => s.generate) + + const { isEngineer } = usePermissions() + const canGenerate = isEngineer + + // No template selected + if (!selectedTemplate && !isLoadingDetail) { + return ( +
Select a template to get started
+{selectedTemplate.description}
+ )} +{w}
+ ))} +{generateError}
+ )} +