Skip to content

Commit 483c994

Browse files
dsactiviclaude
andcommitted
Fix Settings button - add agent configuration dialog
- Fixed sonner import (removed version suffix) - Added Dialog for agent-specific settings - Settings include: Auto Restart, Log Level, Max Retries, Timeout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 050a23f commit 483c994

1 file changed

Lines changed: 105 additions & 3 deletions

File tree

‎src/App.tsx‎

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,23 @@ import {
2929
LogOut,
3030
Settings as SettingsIcon,
3131
} from 'lucide-react';
32-
import { toast } from 'sonner@2.0.3';
32+
import { toast } from 'sonner';
33+
import {
34+
Dialog,
35+
DialogContent,
36+
DialogDescription,
37+
DialogHeader,
38+
DialogTitle,
39+
} from './components/ui/dialog';
40+
import { Label } from './components/ui/label';
41+
import { Switch } from './components/ui/switch';
42+
import {
43+
Select,
44+
SelectContent,
45+
SelectItem,
46+
SelectTrigger,
47+
SelectValue,
48+
} from './components/ui/select';
3349

3450
interface Agent {
3551
id: string;
@@ -137,6 +153,13 @@ export default function App() {
137153
const [dialogOpen, setDialogOpen] = useState(false);
138154
const [searchQuery, setSearchQuery] = useState('');
139155
const [currentTab, setCurrentTab] = useState('dashboard');
156+
const [configureAgentId, setConfigureAgentId] = useState<string | null>(null);
157+
const [agentSettings, setAgentSettings] = useState({
158+
autoRestart: true,
159+
logLevel: 'info',
160+
maxRetries: '3',
161+
timeout: '30',
162+
});
140163

141164
const handleStartAgent = (id: string) => {
142165
setAgents(
@@ -177,8 +200,14 @@ export default function App() {
177200
};
178201

179202
const handleConfigureAgent = (id: string) => {
180-
const agent = agents.find((a) => a.id === id);
181-
toast.info(`Opening configuration for ${agent?.name}`);
203+
setConfigureAgentId(id);
204+
};
205+
206+
const configuredAgent = agents.find((a) => a.id === configureAgentId);
207+
208+
const handleSaveAgentSettings = () => {
209+
toast.success(`Settings saved for ${configuredAgent?.name}`);
210+
setConfigureAgentId(null);
182211
};
183212

184213
const handleDeleteAgent = (id: string) => {
@@ -456,6 +485,79 @@ export default function App() {
456485
onOpenChange={setDialogOpen}
457486
onCreate={handleCreateAgent}
458487
/>
488+
489+
{/* Agent Settings Dialog */}
490+
<Dialog open={!!configureAgentId} onOpenChange={(open) => !open && setConfigureAgentId(null)}>
491+
<DialogContent className="sm:max-w-md">
492+
<DialogHeader>
493+
<DialogTitle>Configure {configuredAgent?.name}</DialogTitle>
494+
<DialogDescription>
495+
Adjust settings for this agent
496+
</DialogDescription>
497+
</DialogHeader>
498+
<div className="space-y-6 py-4">
499+
<div className="flex items-center justify-between">
500+
<div>
501+
<Label>Auto Restart</Label>
502+
<p className="text-sm text-muted-foreground">
503+
Automatically restart on failure
504+
</p>
505+
</div>
506+
<Switch
507+
checked={agentSettings.autoRestart}
508+
onCheckedChange={(checked) =>
509+
setAgentSettings({ ...agentSettings, autoRestart: checked })
510+
}
511+
/>
512+
</div>
513+
<div className="space-y-2">
514+
<Label>Log Level</Label>
515+
<Select
516+
value={agentSettings.logLevel}
517+
onValueChange={(value) =>
518+
setAgentSettings({ ...agentSettings, logLevel: value })
519+
}
520+
>
521+
<SelectTrigger>
522+
<SelectValue />
523+
</SelectTrigger>
524+
<SelectContent>
525+
<SelectItem value="debug">Debug</SelectItem>
526+
<SelectItem value="info">Info</SelectItem>
527+
<SelectItem value="warning">Warning</SelectItem>
528+
<SelectItem value="error">Error</SelectItem>
529+
</SelectContent>
530+
</Select>
531+
</div>
532+
<div className="space-y-2">
533+
<Label>Max Retries</Label>
534+
<Input
535+
type="number"
536+
value={agentSettings.maxRetries}
537+
onChange={(e) =>
538+
setAgentSettings({ ...agentSettings, maxRetries: e.target.value })
539+
}
540+
/>
541+
</div>
542+
<div className="space-y-2">
543+
<Label>Timeout (seconds)</Label>
544+
<Input
545+
type="number"
546+
value={agentSettings.timeout}
547+
onChange={(e) =>
548+
setAgentSettings({ ...agentSettings, timeout: e.target.value })
549+
}
550+
/>
551+
</div>
552+
</div>
553+
<div className="flex justify-end gap-2">
554+
<Button variant="outline" onClick={() => setConfigureAgentId(null)}>
555+
Cancel
556+
</Button>
557+
<Button onClick={handleSaveAgentSettings}>Save Settings</Button>
558+
</div>
559+
</DialogContent>
560+
</Dialog>
459561
</div>
460562
);
461563
}

0 commit comments

Comments
 (0)