fix: improve layout and accessibility of workflow header and buttons
This commit is contained in:
@@ -441,7 +441,6 @@ export default function WorkflowEditorPage() {
|
||||
<DashboardLayout>
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div className="space-y-4">
|
||||
<div className="flex items-center gap-3 sm:gap-4">
|
||||
<Link href="/workflows">
|
||||
<Button variant="ghost" size="sm">
|
||||
@@ -473,28 +472,30 @@ export default function WorkflowEditorPage() {
|
||||
<p className="text-neutral-500 mt-1 text-sm sm:text-base">{workflow.description}</p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap items-center gap-2">
|
||||
<Button variant="outline" onClick={() => setShowSettingsDialog(true)} className="flex-1 sm:flex-none">
|
||||
<div className="flex items-center gap-1.5 flex-shrink-0">
|
||||
<Button variant="ghost" size="icon" onClick={() => setShowSettingsDialog(true)} aria-label="Settings">
|
||||
<Settings className="h-4 w-4" />
|
||||
<span className="hidden sm:inline">Settings</span>
|
||||
</Button>
|
||||
<Button variant="destructive" onClick={() => setShowDeleteDialog(true)} className="flex-1 sm:flex-none">
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
onClick={() => setShowDeleteDialog(true)}
|
||||
aria-label="Delete workflow"
|
||||
className="text-neutral-400 hover:text-red-600 hover:bg-red-50"
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
<span className="hidden sm:inline">Delete</span>
|
||||
</Button>
|
||||
<Button onClick={handleToggleEnabled} className="flex-1 sm:flex-none">
|
||||
<div className="h-5 w-px bg-neutral-200 mx-1" />
|
||||
<Button variant={workflow.enabled ? 'outline' : 'default'} onClick={handleToggleEnabled}>
|
||||
{workflow.enabled ? (
|
||||
<>
|
||||
<PowerOff className="h-4 w-4" />
|
||||
<span className="hidden sm:inline">Disable</span>
|
||||
<span className="sm:hidden">Off</span>
|
||||
Disable
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Power className="h-4 w-4" />
|
||||
<span className="hidden sm:inline">Enable</span>
|
||||
<span className="sm:hidden">On</span>
|
||||
Enable
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
@@ -528,7 +529,7 @@ export default function WorkflowEditorPage() {
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{/* Validation Warning Banner */}
|
||||
{/* Validation Warning Banner / Ready-to-enable Banner */}
|
||||
{!workflow.enabled &&
|
||||
(() => {
|
||||
const validation = validateWorkflow(workflow);
|
||||
@@ -548,6 +549,21 @@ export default function WorkflowEditorPage() {
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
if (workflow.steps.length > 0) {
|
||||
return (
|
||||
<Alert>
|
||||
<Power className="h-4 w-4" />
|
||||
<AlertTitle>Workflow is disabled</AlertTitle>
|
||||
<AlertDescription className="flex items-center justify-between gap-4">
|
||||
<span>Contacts won't be processed until this workflow is enabled.</span>
|
||||
<Button size="sm" onClick={handleToggleEnabled} className="shrink-0">
|
||||
<Power className="h-3.5 w-3.5" />
|
||||
Enable
|
||||
</Button>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
})()}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user