Skip to content

Self-improving AI Employees for everyone

feat(ui): Phase 4 (partial) - migrate credentials-section Buttons to shadcn

trohitga3c4314b4e19
diff --git a/client/src/components/credentials/panels/EmailPanel.tsx b/client/src/components/credentials/panels/EmailPanel.tsx
index 8408bda1..8742677d 100644
--- a/client/src/components/credentials/panels/EmailPanel.tsx
+++ b/client/src/components/credentials/panels/EmailPanel.tsx
@@ -10,7 +10,10 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, Select, Input, InputNumber, Button } from 'antd';
+import { Form, Select, Input, InputNumber } from 'antd';
+import { Loader2 } from 'lucide-react';
+
+import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import { useAppTheme } from '../../../hooks/useAppTheme';
import { useApiKeys } from '../../../hooks/useApiKeys';
@@ -230,13 +233,31 @@ const EmailPanel: React.FC<{ config: ProviderConfig; visible: boolean }> = ({ co
<div className="flex-1" />
<div className="flex justify-center gap-2 border-t border-border pt-3">
- <Button onClick={handleSave} loading={loading === 'save'}
- style={{ backgroundColor: `${theme.dracula.green}25`, borderColor: `${theme.dracula.green}60`, color: theme.dracula.green }}>
+ <Button
+ variant="outline"
+ onClick={handleSave}
+ disabled={loading === 'save'}
+ style={{
+ backgroundColor: `${theme.dracula.green}25`,
+ borderColor: `${theme.dracula.green}60`,
+ color: theme.dracula.green,
+ }}
+ >
+ {loading === 'save' && <Loader2 className="h-4 w-4 animate-spin" />}
Save
</Button>
{stored && (
- <Button onClick={handleRemove} loading={loading === 'remove'}
- style={{ backgroundColor: `${theme.dracula.pink}25`, borderColor: `${theme.dracula.pink}60`, color: theme.dracula.pink }}>
+ <Button
+ variant="outline"
+ onClick={handleRemove}
+ disabled={loading === 'remove'}
+ style={{
+ backgroundColor: `${theme.dracula.pink}25`,
+ borderColor: `${theme.dracula.pink}60`,
+ color: theme.dracula.pink,
+ }}
+ >
+ {loading === 'remove' && <Loader2 className="h-4 w-4 animate-spin" />}
Remove
</Button>
)}
diff --git a/client/src/components/credentials/sections/ApiUsageSection.tsx b/client/src/components/credentials/sections/ApiUsageSection.tsx
index 0ee06c2c..4cd76872 100644
--- a/client/src/components/credentials/sections/ApiUsageSection.tsx
+++ b/client/src/components/credentials/sections/ApiUsageSection.tsx
@@ -4,9 +4,9 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Button } from 'antd';
import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';
+import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import { Alert, AlertDescription } from '@/components/ui/alert';
import {
@@ -94,7 +94,8 @@ const ApiUsageSection: React.FC<Props> = ({ service, serviceName }) => {
</div>
)}
- <Button size="small" icon={<RefreshCw className="h-3 w-3" />} onClick={load} loading={loading}>
+ <Button size="sm" variant="outline" onClick={load} disabled={loading}>
+ {loading ? <Loader2 className="h-3 w-3 animate-spin" /> : <RefreshCw className="h-3 w-3" />}
Refresh
</Button>
</div>
diff --git a/client/src/components/credentials/sections/LlmUsageSection.tsx b/client/src/components/credentials/sections/LlmUsageSection.tsx
index 72c907d6..d81c25ea 100644
--- a/client/src/components/credentials/sections/LlmUsageSection.tsx
+++ b/client/src/components/credentials/sections/LlmUsageSection.tsx
@@ -3,9 +3,9 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Button } from 'antd';
import { DollarSign, RefreshCw, Loader2 } from 'lucide-react';
+import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import {
Accordion,
@@ -131,7 +131,8 @@ const LlmUsageSection: React.FC<Props> = ({ providerId, providerName }) => {
</div>
)}
- <Button size="small" icon={<RefreshCw className="h-3 w-3" />} onClick={load} loading={loading}>
+ <Button size="sm" variant="outline" onClick={load} disabled={loading}>
+ {loading ? <Loader2 className="h-3 w-3 animate-spin" /> : <RefreshCw className="h-3 w-3" />}
Refresh
</Button>
</div>
diff --git a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx b/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
index 2cc46e17..4458dfff 100644
--- a/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
+++ b/client/src/components/credentials/sections/ProviderDefaultsSection.tsx
@@ -10,9 +10,10 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, Select, InputNumber, Switch, Button } from 'antd';
-import { Settings } from 'lucide-react';
+import { Form, Select, InputNumber, Switch } from 'antd';
+import { Settings, Loader2 } from 'lucide-react';
+import { Button } from '@/components/ui/button';
import { Badge } from '@/components/ui/badge';
import {
Accordion,
@@ -173,12 +174,22 @@ const ProviderDefaultsSection: React.FC<Props> = ({ providerId }) => {
</Form.Item>
)}
- <Button onClick={handleSave} disabled={!dirty} loading={loading} block
- style={{
- backgroundColor: dirty ? `${theme.dracula.green}25` : undefined,
- borderColor: dirty ? `${theme.dracula.green}60` : undefined,
- color: dirty ? theme.dracula.green : undefined,
- }}>
+ <Button
+ onClick={handleSave}
+ disabled={!dirty || loading}
+ variant="outline"
+ className="w-full"
+ style={
+ dirty
+ ? {
+ backgroundColor: `${theme.dracula.green}25`,
+ borderColor: `${theme.dracula.green}60`,
+ color: theme.dracula.green,
+ }
+ : undefined
+ }
+ >
+ {loading && <Loader2 className="h-4 w-4 animate-spin" />}
Save Defaults
</Button>
</Form>
diff --git a/client/src/components/credentials/sections/RateLimitSection.tsx b/client/src/components/credentials/sections/RateLimitSection.tsx
index 034267a0..bf88516a 100644
--- a/client/src/components/credentials/sections/RateLimitSection.tsx
+++ b/client/src/components/credentials/sections/RateLimitSection.tsx
@@ -4,8 +4,10 @@
*/
import React, { useState, useEffect, useCallback } from 'react';
-import { Form, InputNumber, Switch, Button } from 'antd';
+import { Form, InputNumber, Switch } from 'antd';
+import { Loader2 } from 'lucide-react';
+import { Button } from '@/components/ui/button';
import { Alert, AlertDescription } from '@/components/ui/alert';
import {
Accordion,
@@ -109,7 +111,7 @@ const RateLimitSection: React.FC = () => {
<Alert variant="warning" className="mb-3">
<AlertDescription className="flex items-center justify-between gap-3">
<span>{stats.pause_reason || 'Paused'}</span>
- <Button size="small" onClick={handleUnpause}>Unpause</Button>
+ <Button size="sm" variant="outline" onClick={handleUnpause}>Unpause</Button>
</AlertDescription>
</Alert>
)}
@@ -156,12 +158,22 @@ const RateLimitSection: React.FC = () => {
</Form.Item>
</div>
- <Button onClick={handleSave} loading={loading} disabled={!dirty} block
- style={{
- backgroundColor: dirty ? `${theme.dracula.green}25` : undefined,
- borderColor: dirty ? `${theme.dracula.green}60` : undefined,
- color: dirty ? theme.dracula.green : undefined,
- }}>
+ <Button
+ onClick={handleSave}
+ disabled={!dirty || loading}
+ variant="outline"
+ className="w-full"
+ style={
+ dirty
+ ? {
+ backgroundColor: `${theme.dracula.green}25`,
+ borderColor: `${theme.dracula.green}60`,
+ color: theme.dracula.green,
+ }
+ : undefined
+ }
+ >
+ {loading && <Loader2 className="h-4 w-4 animate-spin" />}
Save Changes
</Button>
</Form>