From 32d48146bf9af8606403cc63dcb06871c439f46e Mon Sep 17 00:00:00 2001 From: chihlasm Date: Mon, 30 Mar 2026 01:26:35 +0000 Subject: [PATCH] refactor: Script Library and Builder design critique fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Library: - Clear CTA hierarchy: "Build New Script" primary, "Import Script" ghost, "Manage" demoted to text link - "New from Script" → "Import Script" (clearer label) Script Builder: - Add suggestion chips for first-time users (4 common MSP tasks) - Chips auto-hide after first message Design system normalization: - ScriptPreviewModal: bg-black/80 → bg-black/40, text-blue-400 → text-accent-text, emerald save button → primary, inline rgba → CSS variables - ScriptCodeBlock: bg-[rgba(0,0,0,0.3)] → bg-code, text-blue-400 → text-accent-text, text-text-muted typo fixed, emerald button → ghost style - TemplateCard: emerald/amber/rose badges → success-dim/warning-dim/danger-dim, ShieldAlert amber → warning token - ParameterDetectorStepper: blue focus ring → orange, amber → warning token, "Candidate" → "Variable" in stepper progress Jargon clarification: - "Detect Parameters" → "Find Variables" - "Detected Parameters" → "Configurable Variables" - "Parameters (N)" → "Variables (N)" - Detection summary copy reworded for clarity Co-Authored-By: Claude Opus 4.6 (1M context) --- .../script-builder/ScriptBuilderInput.tsx | 88 ++++++++++++------- .../script-builder/ScriptCodeBlock.tsx | 28 ++---- .../script-builder/ScriptPreviewModal.tsx | 32 +++---- .../ParameterDetectorStepper.tsx | 8 +- .../scripts/ParameterizeAndSavePanel.tsx | 12 +-- .../src/components/scripts/TemplateCard.tsx | 10 +-- frontend/src/pages/ScriptBuilderPage.tsx | 1 + frontend/src/pages/ScriptLibraryPage.tsx | 34 +++---- 8 files changed, 112 insertions(+), 101 deletions(-) diff --git a/frontend/src/components/script-builder/ScriptBuilderInput.tsx b/frontend/src/components/script-builder/ScriptBuilderInput.tsx index 47bb10ab..f4a7a527 100644 --- a/frontend/src/components/script-builder/ScriptBuilderInput.tsx +++ b/frontend/src/components/script-builder/ScriptBuilderInput.tsx @@ -1,17 +1,27 @@ import { useState, useRef, useCallback, useEffect } from 'react' -import { Send } from 'lucide-react' +import { Send, Terminal, UserPlus, HardDrive, RotateCcw } from 'lucide-react' +import type { LucideIcon } from 'lucide-react' import { cn } from '@/lib/utils' +const SUGGESTIONS: { icon: LucideIcon; label: string }[] = [ + { icon: UserPlus, label: 'Create a new AD user' }, + { icon: HardDrive, label: 'Check disk space on all servers' }, + { icon: RotateCcw, label: 'Restart a Windows service' }, + { icon: Terminal, label: 'Reset MFA for a user' }, +] + interface ScriptBuilderInputProps { onSend: (content: string) => void disabled: boolean placeholder?: string + showSuggestions?: boolean } export function ScriptBuilderInput({ onSend, disabled, placeholder = 'Describe the script you need...', + showSuggestions = false, }: ScriptBuilderInputProps) { const [value, setValue] = useState('') const textareaRef = useRef(null) @@ -44,35 +54,53 @@ export function ScriptBuilderInput({ const canSend = value.trim().length > 0 && !disabled return ( -
-