Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

Add setup debug logging & refactor security UI

Juan Denise734fd6d2761
diff --git a/.gitignore b/.gitignore
index 29f74047..6c620389 100644
--- a/.gitignore
+++ b/.gitignore
@@ -96,3 +96,4 @@ nul
SECURITY_AUDIT.md
APP_IMPROVEMENTS.md
*.png
+/agent/packaging
diff --git a/agent/cmd/agent/debuglog.go b/agent/cmd/agent/debuglog.go
new file mode 100644
index 00000000..3b75f566
--- /dev/null
+++ b/agent/cmd/agent/debuglog.go
@@ -0,0 +1,51 @@
+package main
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "sync"
+ "time"
+)
+
+type debugLog struct {
+ mu sync.Mutex
+ f *os.File
+ path string
+}
+
+func (d *debugLog) Path() string { return d.path }
+
+func (d *debugLog) Logf(format string, args ...interface{}) {
+ if d == nil {
+ return
+ }
+ d.mu.Lock()
+ defer d.mu.Unlock()
+ line := fmt.Sprintf("[%s] %s\n", time.Now().Format("15:04:05.000"), fmt.Sprintf(format, args...))
+ if d.f != nil {
+ _, _ = d.f.WriteString(line)
+ _ = d.f.Sync()
+ }
+}
+
+func (d *debugLog) Close() {
+ if d == nil || d.f == nil {
+ return
+ }
+ _ = d.f.Close()
+}
+
+func openSetupDebugLog() *debugLog {
+ dir := os.TempDir()
+ if d, err := os.UserCacheDir(); err == nil {
+ dir = filepath.Join(d, "ServerKit")
+ _ = os.MkdirAll(dir, 0o755)
+ }
+ path := filepath.Join(dir, "serverkit-agent-setup.log")
+ f, err := os.OpenFile(path, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o644)
+ if err != nil {
+ return &debugLog{path: path}
+ }
+ return &debugLog{f: f, path: path}
+}
diff --git a/agent/cmd/agent/main.go b/agent/cmd/agent/main.go
index 4d3a85b6..b7ed450e 100644
--- a/agent/cmd/agent/main.go
+++ b/agent/cmd/agent/main.go
@@ -6,6 +6,7 @@ import (
"os"
"os/signal"
"path/filepath"
+ "runtime"
"syscall"
"github.com/serverkit/agent/internal/agent"
@@ -390,14 +391,35 @@ servers, use 'serverkit-agent pair' instead.`,
}
func runSetup() error {
+ // WebView2 / OS UI must run on the main OS thread on Windows.
+ runtime.LockOSThread()
+
+ // Diagnostic file log — invaluable when launched from a Start Menu
+ // shortcut (no console) and the wizard "does nothing".
+ dbg := openSetupDebugLog()
+ defer dbg.Close()
+ dbg.Logf("--- runSetup start, version=%s pid=%d ---", Version, os.Getpid())
+
+ // Catch panics so they end up in the log + a MessageBox instead of vanishing.
+ defer func() {
+ if r := recover(); r != nil {
+ msg := fmt.Sprintf("panic: %v", r)
+ dbg.Logf(msg)
+ showFatalError(fmt.Errorf("%s\n\nLog: %s", msg, dbg.Path()))
+ }
+ }()
+
log := logger.New(config.LoggingConfig{Level: "info"})
+ dbg.Logf("logger ready")
configPath := cfgFile
if configPath == "" {
configPath = config.DefaultConfigPath()
}
+ dbg.Logf("configPath=%s", configPath)
srv := setupui.New(log, configPath)
+ dbg.Logf("setupui.New OK")
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -410,7 +432,16 @@ func runSetup() error {
cancel()
}()
- return srv.Run(ctx)
+ dbg.Logf("calling srv.Run …")
+ err := srv.Run(ctx)
+ dbg.Logf("srv.Run returned: %v", err)
+ if err != nil {
+ // We're built with -H windowsgui so there's no console. Surface
+ // failures via a MessageBox so the user isn't left staring at a
+ // shortcut that "does nothing".
+ showFatalError(fmt.Errorf("%w\n\nLog: %s", err, dbg.Path()))
+ }
+ return err
}
func trayCmd() *cobra.Command {
diff --git a/agent/cmd/agent/msgbox_other.go b/agent/cmd/agent/msgbox_other.go
new file mode 100644
index 00000000..494a04d0
--- /dev/null
+++ b/agent/cmd/agent/msgbox_other.go
@@ -0,0 +1,12 @@
+//go:build !windows
+
+package main
+
+import (
+ "fmt"
+ "os"
+)
+
+func showFatalError(err error) {
+ fmt.Fprintln(os.Stderr, err)
+}
diff --git a/agent/cmd/agent/msgbox_windows.go b/agent/cmd/agent/msgbox_windows.go
new file mode 100644
index 00000000..7a551547
--- /dev/null
+++ b/agent/cmd/agent/msgbox_windows.go
@@ -0,0 +1,17 @@
+//go:build windows
+
+package main
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+func showFatalError(err error) {
+ user32 := syscall.NewLazyDLL("user32.dll")
+ messageBox := user32.NewProc("MessageBoxW")
+ title, _ := syscall.UTF16PtrFromString("ServerKit Agent")
+ body, _ := syscall.UTF16PtrFromString("Setup failed:\n\n" + err.Error())
+ const MB_ICONERROR = 0x00000010
+ _, _, _ = messageBox.Call(0, uintptr(unsafe.Pointer(body)), uintptr(unsafe.Pointer(title)), MB_ICONERROR)
+}
diff --git a/agent/internal/setupui/setupui.go b/agent/internal/setupui/setupui.go
index 2dc32e34..30facd52 100644
--- a/agent/internal/setupui/setupui.go
+++ b/agent/internal/setupui/setupui.go
@@ -65,6 +65,13 @@ func New(log *logger.Logger, configPath string) *Server {
// Run starts the HTTP server, opens a browser and blocks until pairing
// completes (success or user cancel) or ctx is cancelled.
+// Run starts the wizard. It returns when the user closes the window/browser
+// or when ctx is cancelled.
+//
+// On Windows the WebView2 window must be created on the *main* OS thread, so
+// the caller is expected to invoke Run from the program's main goroutine
+// (i.e. directly from cobra RunE, not from a background goroutine). The HTTP
+// server runs in a background goroutine.
func (s *Server) Run(ctx context.Context) error {
ln, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
@@ -92,44 +99,25 @@ func (s *Server) Run(ctx context.Context) error {
url := fmt.Sprintf("http://%s/", ln.Addr().String())
fmt.Printf("ServerKit Agent — pairing wizard:\n %s\n\n", url)
- // Try native window first (Windows: WebView2). On failure or non-Windows,
- // fall back to opening in the user's default browser.
- useBrowser := true
- go func() {
- err := openInNativeWindow(url, "ServerKit Agent · Setup")
- if err == nil {
- // Window closed — signal done so we shut down.
- s.signalDone()
- }
- // errNoWebView2 means we never got a window; the browser fallback
- // runs synchronously below, so nothing else to do here.
- _ = err
- }()
-
- // Give the native window a brief moment to come up before deciding to
- // open the browser. If the goroutine has already errored, fall back.
- time.Sleep(150 * time.Millisecond)
- if runtime.GOOS == "windows" {
- // On Windows we trust WebView2 (ships with Win10+). If WebView2 is
- // missing the native call returns errNoWebView2 quickly — but the
- // goroutine may still be initializing, so we don't open a browser
- // here. The user will see the native window.
- useBrowser = false
- fmt.Println("Opening setup window…")
- fmt.Println("Leave this terminal open until pairing completes. Press Ctrl+C to cancel.")
- }
- if useBrowser {
+ // Try the native WebView2 window on the *main* goroutine. It blocks
+ // until the window is closed. If WebView2 isn't available we fall
+ // back to the system browser.
+ winErr := openInNativeWindow(url, "ServerKit Agent · Setup")
+ if winErr == nil {
+ // Window closed by the user — tear down.
+ s.signalDone()
+ } else {
fmt.Println("Opening in your default browser…")
fmt.Println("Leave this terminal open until pairing completes. Press Ctrl+C to cancel.")
if err := openBrowser(url); err != nil {
s.log.Warn("could not open browser automatically", "error", err)
fmt.Println("(Couldn't open browser automatically — copy the URL above into your browser.)")
}
- }
-
- select {
- case <-ctx.Done():
- case <-s.doneCh:
+ // Wait for either context cancel or the user pressing "Done" in the wizard.
+ select {
+ case <-ctx.Done():
+ case <-s.doneCh:
+ }
}
shutdownCtx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
diff --git a/frontend/src/components/security/AuditTab.jsx b/frontend/src/components/security/AuditTab.jsx
index ab043345..1659bd0f 100644
--- a/frontend/src/components/security/AuditTab.jsx
+++ b/frontend/src/components/security/AuditTab.jsx
@@ -1,5 +1,7 @@
import React, { useState } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const AuditTab = () => {
const [audit, setAudit] = useState(null);
@@ -19,13 +21,13 @@ const AuditTab = () => {
}
};
- const getSeverityClass = (severity) => {
+ const getSeverityVariant = (severity) => {
switch (severity) {
- case 'pass': return 'badge-success';
- case 'critical': return 'badge-danger';
- case 'warning': return 'badge-warning';
- case 'info': return 'badge-info';
- default: return 'badge-secondary';
+ case 'pass': return 'success';
+ case 'critical': return 'destructive';
+ case 'warning': return 'warning';
+ case 'info': return 'info';
+ default: return 'secondary';
}
};
@@ -41,9 +43,9 @@ const AuditTab = () => {
<div className="card">
<div className="card-header">
<h3>Security Audit</h3>
- <button className="btn btn-primary" onClick={runAudit} disabled={loading}>
+ <Button variant="default" onClick={runAudit} disabled={loading}>
{loading ? 'Running Audit...' : 'Run Audit'}
- </button>
+ </Button>
</div>
<div className="card-body">
{error && <div className="alert alert-danger">{error}</div>}
@@ -81,9 +83,9 @@ const AuditTab = () => {
<div className="findings-list">
{data.findings?.map((finding, idx) => (
<div key={idx} className="finding-item">
- <span className={`badge ${getSeverityClass(finding.severity)}`}>
+ <Badge variant={getSeverityVariant(finding.severity)}>
{finding.severity}
- </span>
+ </Badge>
<span className="finding-message">{finding.message}</span>
</div>
))}
diff --git a/frontend/src/components/security/AutoUpdatesTab.jsx b/frontend/src/components/security/AutoUpdatesTab.jsx
index 3a5fb2d9..d39b9a92 100644
--- a/frontend/src/components/security/AutoUpdatesTab.jsx
+++ b/frontend/src/components/security/AutoUpdatesTab.jsx
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const AutoUpdatesTab = () => {
const [status, setStatus] = useState(null);
@@ -86,7 +88,7 @@ const AutoUpdatesTab = () => {
<div className="card">
<div className="card-header">
<h3>Automatic Security Updates</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadStatus}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadStatus}>Refresh</Button>
</div>
<div className="card-body">
<div className="info-list">
@@ -96,31 +98,31 @@ const AutoUpdatesTab = () => {
</div>
<div className="info-item">
<span className="info-label">Installed</span>
- <span className={`badge ${status.installed ? 'badge-success' : 'badge-warning'}`}>
+ <Badge variant={status.installed ? 'success' : 'warning'}>
{status.installed ? 'Yes' : 'No'}
- </span>
+ </Badge>
</div>
<div className="info-item">
<span className="info-label">Status</span>
- <span className={`badge ${status.enabled ? 'badge-success' : 'badge-secondary'}`}>
+ <Badge variant={status.enabled ? 'success' : 'secondary'}>
{status.enabled ? 'Enabled' : 'Disabled'}
- </span>
+ </Badge>
</div>
</div>
<div className="auto-updates-actions" style={{ marginTop: '1.5rem' }}>
{!status.installed ? (
- <button className="btn btn-primary" onClick={handleInstall} disabled={actionLoading}>
+ <Button variant="default" onClick={handleInstall} disabled={actionLoading}>
{actionLoading ? 'Installing...' : 'Install Auto-Updates'}
- </button>
+ </Button>
) : status.enabled ? (
- <button className="btn btn-warning" onClick={handleDisable} disabled={actionLoading}>
+ <Button variant="secondary" onClick={handleDisable} disabled={actionLoading}>
{actionLoading ? 'Disabling...' : 'Disable Auto-Updates'}
- </button>
+ </Button>
) : (
- <button className="btn btn-success" onClick={handleEnable} disabled={actionLoading}>
+ <Button variant="default" onClick={handleEnable} disabled={actionLoading}>
{actionLoading ? 'Enabling...' : 'Enable Auto-Updates'}
- </button>
+ </Button>
)}
</div>
diff --git a/frontend/src/components/security/EventsTab.jsx b/frontend/src/components/security/EventsTab.jsx
index ded62ed3..33613d39 100644
--- a/frontend/src/components/security/EventsTab.jsx
+++ b/frontend/src/components/security/EventsTab.jsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
const EventsTab = () => {
const [events, setEvents] = useState([]);
@@ -47,7 +48,7 @@ const EventsTab = () => {
<div className={`card ${failedLogins.alert_triggered ? 'card-warning' : ''}`}>
<div className="card-header">
<h3>Failed Login Attempts (24h)</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadFailedLogins}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadFailedLogins}>Refresh</Button>
</div>
<div className="card-body">
<div className="failed-login-summary">
@@ -69,7 +70,7 @@ const EventsTab = () => {
<div className="card">
<div className="card-header">
<h3>Security Events</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadEvents}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadEvents}>Refresh</Button>
</div>
<div className="card-body">
{loading ? (
diff --git a/frontend/src/components/security/Fail2banTab.jsx b/frontend/src/components/security/Fail2banTab.jsx
index 1f0079c9..872341cd 100644
--- a/frontend/src/components/security/Fail2banTab.jsx
+++ b/frontend/src/components/security/Fail2banTab.jsx
@@ -3,6 +3,11 @@ import api from '../../services/api';
import ConfirmDialog from '../ConfirmDialog';
import { useToast } from '../../contexts/ToastContext';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const Fail2banTab = () => {
const [status, setStatus] = useState(null);
@@ -97,9 +102,9 @@ const Fail2banTab = () => {
</svg>
<h3>Fail2ban Not Installed</h3>
<p>Install Fail2ban to protect against brute force attacks.</p>
- <button className="btn btn-primary" onClick={handleInstall} disabled={actionLoading}>
+ <Button variant="default" onClick={handleInstall} disabled={actionLoading}>
{actionLoading ? 'Installing...' : 'Install Fail2ban'}
- </button>
+ </Button>
</div>
) : (
<>
@@ -107,21 +112,21 @@ const Fail2banTab = () => {
<div className="card-header">
<h3>Fail2ban Status</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-primary" onClick={() => setShowBanModal(true)}>
+ <Button variant="default" size="sm" onClick={() => setShowBanModal(true)}>
Ban IP
- </button>
- <button className="btn btn-sm btn-secondary" onClick={loadData}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={loadData}>
Refresh
- </button>
+ </Button>
</div>
</div>
<div className="card-body">
<div className="info-list">
<div className="info-item">
<span className="info-label">Service</span>
- <span className={`badge ${status.service_running ? 'badge-success' : 'badge-danger'}`}>
+ <Badge variant={status.service_running ? 'success' : 'destructive'}>
{status.service_running ? 'Running' : 'Stopped'}
- </span>
+ </Badge>
</div>
<div className="info-item">
<span className="info-label">Version</span>
@@ -159,11 +164,11 @@ const Fail2banTab = () => {
{bans.map((ban, index) => (
<tr key={index}>
<td><code>{ban.ip}</code></td>
- <td><span className="badge badge-info">{ban.jail}</span></td>
+ <td><Badge variant="info">{ban.jail}</Badge></td>
<td>
- <button className="btn btn-sm btn-warning" onClick={() => handleUnban(ban.ip, ban.jail)}>
+ <Button variant="secondary" size="sm" onClick={() => handleUnban(ban.ip, ban.jail)}>
Unban
- </button>
+ </Button>
</td>
</tr>
))}
@@ -176,29 +181,34 @@ const Fail2banTab = () => {
)}
<Modal open={showBanModal} onClose={() => setShowBanModal(false)} title="Ban IP Address">
- <div className="form-group">
- <label>IP Address</label>
- <input
- type="text"
- value={banIP}
- onChange={(e) => setBanIP(e.target.value)}
- placeholder="192.168.1.100"
- />
- </div>
- <div className="form-group">
- <label>Jail</label>
- <select value={banJail} onChange={(e) => setBanJail(e.target.value)}>
- {status?.jails?.map(jail => (
- <option key={jail} value={jail}>{jail}</option>
- ))}
- </select>
- </div>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowBanModal(false)}>Cancel</button>
- <button className="btn btn-danger" onClick={handleBan} disabled={actionLoading || !banIP.trim()}>
- {actionLoading ? 'Banning...' : 'Ban IP'}
- </button>
- </div>
+ <div className="form-group">
+ <Label>IP Address</Label>
+ <Input
+ type="text"
+ value={banIP}
+ onChange={(e) => setBanIP(e.target.value)}
+ placeholder="192.168.1.100"
+ />
+ </div>
+ <div className="form-group">
+ <Label>Jail</Label>
+ <Select value={banJail} onValueChange={setBanJail}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {status?.jails?.map(jail => (
+ <SelectItem key={jail} value={jail}>{jail}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowBanModal(false)}>Cancel</Button>
+ <Button variant="destructive" onClick={handleBan} disabled={actionLoading || !banIP.trim()}>
+ {actionLoading ? 'Banning...' : 'Ban IP'}
+ </Button>
+ </div>
</Modal>
{confirmDialog && (
diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsx
index 53a871e8..371b11bd 100644
--- a/frontend/src/components/security/FirewallTab.jsx
+++ b/frontend/src/components/security/FirewallTab.jsx
@@ -3,6 +3,11 @@ import api from '../../services/api';
import ConfirmDialog from '../ConfirmDialog';
import { useToast } from '../../contexts/ToastContext';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const FirewallTab = () => {
const [status, setStatus] = useState(null);
@@ -227,9 +232,9 @@ const FirewallTab = () => {
</svg>
<h3>No Firewall Installed</h3>
<p>Install a firewall to protect your server from unauthorized access.</p>
- <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ <Button variant="default" onClick={() => setShowInstallModal(true)}>
Install Firewall
- </button>
+ </Button>
</div>
) : (
<>
@@ -243,20 +248,20 @@ const FirewallTab = () => {
<span className="firewall-type">({activeFirewall?.toUpperCase()})</span>
</div>
<div className="firewall-actions">
- <button className="btn btn-sm btn-secondary" onClick={() => setShowBlockIPModal(true)}>
+ <Button variant="outline" size="sm" onClick={() => setShowBlockIPModal(true)}>
Block IP
- </button>
- <button className="btn btn-sm btn-secondary" onClick={() => setShowPortModal(true)}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={() => setShowPortModal(true)}>
Allow Port
- </button>
+ </Button>
{isActive ? (
- <button className="btn btn-sm btn-danger" onClick={handleDisable} disabled={actionLoading}>
+ <Button variant="destructive" size="sm" onClick={handleDisable} disabled={actionLoading}>
Disable
- </button>
+ </Button>
) : (
- <button className="btn btn-sm btn-success" onClick={handleEnable} disabled={actionLoading}>
+ <Button variant="default" size="sm" onClick={handleEnable} disabled={actionLoading}>
Enable
- </button>
+ </Button>
)}
</div>
</div>
@@ -296,7 +301,7 @@ const FirewallTab = () => {
<div className="card">
<div className="card-header">
<h3>Firewall Information</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadData}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadData}>Refresh</Button>
</div>
<div className="card-body">
<div className="info-list">
@@ -306,9 +311,9 @@ const FirewallTab = () => {
</div>
<div className="info-item">
<span className="info-label">Status</span>
- <span className={`badge ${isActive ? 'badge-success' : 'badge-danger'}`}>
+ <Badge variant={isActive ? 'success' : 'destructive'}>
{isActive ? 'Active' : 'Inactive'}
- </span>
+ </Badge>
</div>
{activeFirewall === 'firewalld' && status?.firewalld?.default_zone && (
<div className="info-item">
@@ -325,7 +330,7 @@ const FirewallTab = () => {
<div className="card">
<div className="card-header">
<h3>Firewall Rules</h3>
- <button className="btn btn-sm btn-primary" onClick={() => setShowPortModal(true)}>Add Rule</button>
+ <Button variant="default" size="sm" onClick={() => setShowPortModal(true)}>Add Rule</Button>
</div>
<div className="card-body">
{rules.length === 0 ? (
@@ -343,7 +348,7 @@ const FirewallTab = () => {
<tbody>
{rules.map((rule, index) => (
<tr key={index}>
- <td><span className="badge badge-info">{rule.type}</span></td>
+ <td><Badge variant="info">{rule.type}</Badge></td>
<td>
{rule.type === 'service' && rule.service}
{rule.type === 'port' && rule.port}
@@ -352,9 +357,9 @@ const FirewallTab = () => {
<td>{rule.protocol || '-'}</td>
<td>
{rule.type === 'port' && (
- <button className="btn btn-sm btn-danger" onClick={() => handleRemovePort(rule.port, rule.protocol)}>
+ <Button variant="destructive" size="sm" onClick={() => handleRemovePort(rule.port, rule.protocol)}>
Remove
- </button>
+ </Button>
)}
</td>
</tr>
@@ -370,7 +375,7 @@ const FirewallTab = () => {
<div className="card">
<div className="card-header">
<h3>Blocked IP Addresses</h3>
- <button className="btn btn-sm btn-primary" onClick={() => setShowBlockIPModal(true)}>Block IP</button>
+ <Button variant="default" size="sm" onClick={() => setShowBlockIPModal(true)}>Block IP</Button>
</div>
<div className="card-body">
{blockedIPs.length === 0 ? (
@@ -384,9 +389,9 @@ const FirewallTab = () => {
<div className="blocked-info">
<span className="blocked-ip">{item.ip}</span>
</div>
- <button className="btn btn-sm btn-warning" onClick={() => handleUnblockIP(item.ip)}>
+ <Button variant="secondary" size="sm" onClick={() => handleUnblockIP(item.ip)}>
Unblock
- </button>
+ </Button>
</div>
))}
</div>
@@ -414,13 +419,13 @@ const FirewallTab = () => {
<span className="port-number">{port}/{protocol}</span>
</div>
{isAllowed ? (
- <button className="btn btn-sm btn-danger" onClick={() => handleRemovePort(port, protocol)} disabled={actionLoading}>
+ <Button variant="destructive" size="sm" onClick={() => handleRemovePort(port, protocol)} disabled={actionLoading}>
Block
- </button>
+ </Button>
) : (
- <button className="btn btn-sm btn-success" onClick={() => handleQuickAllowPort(port, protocol)} disabled={actionLoading}>
+ <Button variant="default" size="sm" onClick={() => handleQuickAllowPort(port, protocol)} disabled={actionLoading}>
Allow
- </button>
+ </Button>
)}
</div>
);
@@ -434,76 +439,86 @@ const FirewallTab = () => {
{/* Block IP Modal */}
<Modal open={showBlockIPModal} onClose={() => setShowBlockIPModal(false)} title="Block IP Address">
- <div className="form-group">
- <label>IP Address</label>
- <input
- type="text"
- value={blockIP}
- onChange={(e) => setBlockIP(e.target.value)}
- placeholder="192.168.1.100 or 10.0.0.0/24"
- />
- </div>
- <p className="text-muted">You can block a single IP or a range using CIDR notation.</p>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowBlockIPModal(false)}>Cancel</button>
- <button className="btn btn-danger" onClick={handleBlockIP} disabled={actionLoading || !blockIP.trim()}>
- {actionLoading ? 'Blocking...' : 'Block IP'}
- </button>
- </div>
+ <div className="form-group">
+ <Label>IP Address</Label>
+ <Input
+ type="text"
+ value={blockIP}
+ onChange={(e) => setBlockIP(e.target.value)}
+ placeholder="192.168.1.100 or 10.0.0.0/24"
+ />
+ </div>
+ <p className="text-muted">You can block a single IP or a range using CIDR notation.</p>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowBlockIPModal(false)}>Cancel</Button>
+ <Button variant="destructive" onClick={handleBlockIP} disabled={actionLoading || !blockIP.trim()}>
+ {actionLoading ? 'Blocking...' : 'Block IP'}
+ </Button>
+ </div>
</Modal>
{/* Allow Port Modal */}
<Modal open={showPortModal} onClose={() => setShowPortModal(false)} title="Allow Port">
- <div className="form-row">
- <div className="form-group">
- <label>Port Number</label>
- <input
- type="number"
- value={newPort.port}
- onChange={(e) => setNewPort({ ...newPort, port: e.target.value })}
- placeholder="8080"
- min="1"
- max="65535"
- />
- </div>
- <div className="form-group">
- <label>Protocol</label>
- <select value={newPort.protocol} onChange={(e) => setNewPort({ ...newPort, protocol: e.target.value })}>
- <option value="tcp">TCP</option>
- <option value="udp">UDP</option>
- </select>
- </div>
- </div>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowPortModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleAllowPort} disabled={actionLoading || !newPort.port}>
- {actionLoading ? 'Adding...' : 'Allow Port'}
- </button>
- </div>
+ <div className="form-row">
+ <div className="form-group">
+ <Label>Port Number</Label>
+ <Input
+ type="number"
+ value={newPort.port}
+ onChange={(e) => setNewPort({ ...newPort, port: e.target.value })}
+ placeholder="8080"
+ min="1"
+ max="65535"
+ />
+ </div>
+ <div className="form-group">
+ <Label>Protocol</Label>
+ <Select value={newPort.protocol} onValueChange={(value) => setNewPort({ ...newPort, protocol: value })}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="tcp">TCP</SelectItem>
+ <SelectItem value="udp">UDP</SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowPortModal(false)}>Cancel</Button>
+ <Button variant="default" onClick={handleAllowPort} disabled={actionLoading || !newPort.port}>
+ {actionLoading ? 'Adding...' : 'Allow Port'}
+ </Button>
+ </div>
</Modal>
{/* Install Firewall Modal */}
<Modal open={showInstallModal} onClose={() => setShowInstallModal(false)} title="Install Firewall">
- <div className="form-group">
- <label>Select Firewall</label>
- <select value={selectedFirewall} onChange={(e) => setSelectedFirewall(e.target.value)}>
- <option value="ufw">UFW (Recommended for Ubuntu)</option>
- <option value="firewalld">firewalld (CentOS/RHEL)</option>
- </select>
- </div>
- <div className="install-info">
- {selectedFirewall === 'ufw' ? (
- <p><strong>UFW (Uncomplicated Firewall)</strong> is simple and easy to use for Ubuntu/Debian systems.</p>
- ) : (
- <p><strong>firewalld</strong> is a dynamically managed firewall with zone-based configuration for CentOS/RHEL.</p>
- )}
- </div>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowInstallModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleInstall} disabled={actionLoading}>
- {actionLoading ? 'Installing...' : 'Install'}
- </button>
- </div>
+ <div className="form-group">
+ <Label>Select Firewall</Label>
+ <Select value={selectedFirewall} onValueChange={setSelectedFirewall}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="ufw">UFW (Recommended for Ubuntu)</SelectItem>
+ <SelectItem value="firewalld">firewalld (CentOS/RHEL)</SelectItem>
+ </SelectContent>
+ </Select>
+ </div>
+ <div className="install-info">
+ {selectedFirewall === 'ufw' ? (
+ <p><strong>UFW (Uncomplicated Firewall)</strong> is simple and easy to use for Ubuntu/Debian systems.</p>
+ ) : (
+ <p><strong>firewalld</strong> is a dynamically managed firewall with zone-based configuration for CentOS/RHEL.</p>
+ )}
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>Cancel</Button>
+ <Button variant="default" onClick={handleInstall} disabled={actionLoading}>
+ {actionLoading ? 'Installing...' : 'Install'}
+ </Button>
+ </div>
</Modal>
{confirmDialog && (
diff --git a/frontend/src/components/security/IPListsTab.jsx b/frontend/src/components/security/IPListsTab.jsx
index 136c73b0..fc8fe779 100644
--- a/frontend/src/components/security/IPListsTab.jsx
+++ b/frontend/src/components/security/IPListsTab.jsx
@@ -3,6 +3,9 @@ import api from '../../services/api';
import ConfirmDialog from '../ConfirmDialog';
import { useToast } from '../../contexts/ToastContext';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
const IPListsTab = () => {
const [lists, setLists] = useState({ allowlist: [], blocklist: [] });
@@ -74,9 +77,9 @@ const IPListsTab = () => {
<div className="card">
<div className="card-header">
<h3>{title}</h3>
- <button className="btn btn-sm btn-primary" onClick={() => setShowAddModal(listType)}>
+ <Button variant="default" size="sm" onClick={() => setShowAddModal(listType)}>
Add IP
- </button>
+ </Button>
</div>
<div className="card-body">
{items.length === 0 ? (
@@ -90,9 +93,9 @@ const IPListsTab = () => {
{item.comment && <span className="ip-comment">{item.comment}</span>}
<span className="ip-date">{new Date(item.added_at).toLocaleDateString()}</span>
</div>
- <button className="btn btn-sm btn-danger" onClick={() => handleRemove(item.ip, listType)}>
+ <Button variant="destructive" size="sm" onClick={() => handleRemove(item.ip, listType)}>
Remove
- </button>
+ </Button>
</div>
))}
</div>
@@ -113,30 +116,30 @@ const IPListsTab = () => {
</div>
<Modal open={!!showAddModal} onClose={() => setShowAddModal(null)} title={`Add to ${showAddModal || ''}`}>
- <div className="form-group">
- <label>IP Address or CIDR</label>
- <input
- type="text"
- value={newIP}
- onChange={(e) => setNewIP(e.target.value)}
- placeholder="192.168.1.100 or 10.0.0.0/24"
- />
- </div>
- <div className="form-group">
- <label>Comment (optional)</label>
- <input
- type="text"
- value={newComment}
- onChange={(e) => setNewComment(e.target.value)}
- placeholder="Office IP, VPN, etc."
- />
- </div>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowAddModal(null)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleAdd} disabled={actionLoading || !newIP.trim()}>
- {actionLoading ? 'Adding...' : 'Add'}
- </button>
- </div>
+ <div className="form-group">
+ <Label>IP Address or CIDR</Label>
+ <Input
+ type="text"
+ value={newIP}
+ onChange={(e) => setNewIP(e.target.value)}
+ placeholder="192.168.1.100 or 10.0.0.0/24"
+ />
+ </div>
+ <div className="form-group">
+ <Label>Comment (optional)</Label>
+ <Input
+ type="text"
+ value={newComment}
+ onChange={(e) => setNewComment(e.target.value)}
+ placeholder="Office IP, VPN, etc."
+ />
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowAddModal(null)}>Cancel</Button>
+ <Button variant="default" onClick={handleAdd} disabled={actionLoading || !newIP.trim()}>
+ {actionLoading ? 'Adding...' : 'Add'}
+ </Button>
+ </div>
</Modal>
{confirmDialog && (
diff --git a/frontend/src/components/security/IntegrityTab.jsx b/frontend/src/components/security/IntegrityTab.jsx
index c9972b12..6f63d7f9 100644
--- a/frontend/src/components/security/IntegrityTab.jsx
+++ b/frontend/src/components/security/IntegrityTab.jsx
@@ -1,5 +1,7 @@
import React, { useState } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const IntegrityTab = () => {
const [checking, setChecking] = useState(false);
@@ -57,20 +59,20 @@ const IntegrityTab = () => {
</p>
<div className="integrity-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleInitialize}
disabled={initializing}
>
{initializing ? 'Initializing...' : 'Initialize Baseline'}
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
+ variant="default"
onClick={handleCheck}
disabled={checking}
>
{checking ? 'Checking...' : 'Check Integrity'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -79,7 +81,7 @@ const IntegrityTab = () => {
<div className="card">
<div className="card-header">
<h3>Changes Detected</h3>
- <span className="badge badge-warning">{results.total_changes} changes</span>
+ <Badge variant="warning">{results.total_changes} changes</Badge>
</div>
<div className="card-body">
{results.changes.modified?.length > 0 && (
diff --git a/frontend/src/components/security/OverviewTab.jsx b/frontend/src/components/security/OverviewTab.jsx
index 0f006086..e1516c96 100644
--- a/frontend/src/components/security/OverviewTab.jsx
+++ b/frontend/src/components/security/OverviewTab.jsx
@@ -1,5 +1,7 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const InstallClamAVButton = ({ onInstalled }) => {
const [installing, setInstalling] = useState(false);
@@ -20,9 +22,9 @@ const InstallClamAVButton = ({ onInstalled }) => {
return (
<div>
- <button className="btn btn-primary" onClick={handleInstall} disabled={installing}>
+ <Button variant="default" onClick={handleInstall} disabled={installing}>
{installing ? 'Installing...' : 'Install ClamAV'}
- </button>
+ </Button>
{error && <p className="error-text" style={{ marginTop: '0.5rem' }}>{error}</p>}
</div>
);
@@ -108,7 +110,7 @@ const OverviewTab = ({ status, onRefresh }) => {
<div className="card">
<div className="card-header">
<h3>ClamAV Antivirus</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadClamavStatus}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadClamavStatus}>Refresh</Button>
</div>
<div className="card-body">
{loading ? (
@@ -121,9 +123,9 @@ const OverviewTab = ({ status, onRefresh }) => {
</div>
<div className="info-item">
<span className="info-label">Service</span>
- <span className={`badge ${clamavStatus.service_running ? 'badge-success' : 'badge-warning'}`}>
+ <Badge variant={clamavStatus.service_running ? 'success' : 'warning'}>
{clamavStatus.service_running ? 'Running' : 'Stopped'}
- </span>
+ </Badge>
</div>
<div className="info-item">
<span className="info-label">Last Definition Update</span>
@@ -149,15 +151,15 @@ const OverviewTab = ({ status, onRefresh }) => {
<div className="info-list">
<div className="info-item">
<span className="info-label">Status</span>
- <span className={`badge ${status?.file_integrity?.enabled ? 'badge-success' : 'badge-secondary'}`}>
+ <Badge variant={status?.file_integrity?.enabled ? 'success' : 'secondary'}>
{status?.file_integrity?.enabled ? 'Enabled' : 'Disabled'}
- </span>
+ </Badge>
</div>
<div className="info-item">
<span className="info-label">Database</span>
- <span className={`badge ${status?.file_integrity?.database_exists ? 'badge-success' : 'badge-warning'}`}>
+ <Badge variant={status?.file_integrity?.database_exists ? 'success' : 'warning'}>
{status?.file_integrity?.database_exists ? 'Initialized' : 'Not Initialized'}
- </span>
+ </Badge>
</div>
<div className="info-item">
<span className="info-label">Changes Detected (24h)</span>
@@ -175,9 +177,9 @@ const OverviewTab = ({ status, onRefresh }) => {
<div className="info-list">
<div className="info-item">
<span className="info-label">Security Alerts</span>
- <span className={`badge ${status?.notifications_enabled ? 'badge-success' : 'badge-secondary'}`}>
+ <Badge variant={status?.notifications_enabled ? 'success' : 'secondary'}>
{status?.notifications_enabled ? 'Enabled' : 'Disabled'}
- </span>
+ </Badge>
</div>
</div>
<p className="help-text" style={{ marginTop: '1rem' }}>
diff --git a/frontend/src/components/security/QuarantineTab.jsx b/frontend/src/components/security/QuarantineTab.jsx
index 30cc4207..165e6bb3 100644
--- a/frontend/src/components/security/QuarantineTab.jsx
+++ b/frontend/src/components/security/QuarantineTab.jsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
const QuarantineTab = () => {
const [files, setFiles] = useState([]);
@@ -52,7 +53,7 @@ const QuarantineTab = () => {
<div className="card">
<div className="card-header">
<h3>Quarantined Files</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadFiles}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadFiles}>Refresh</Button>
</div>
<div className="card-body">
{loading ? (
@@ -83,12 +84,13 @@ const QuarantineTab = () => {
<td>{formatBytes(file.size)}</td>
<td>{new Date(file.quarantined_at).toLocaleString()}</td>
<td>
- <button
- className="btn btn-sm btn-danger"
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleDelete(file.name)}
>
Delete
- </button>
+ </Button>
</td>
</tr>
))}
diff --git a/frontend/src/components/security/SSHKeysTab.jsx b/frontend/src/components/security/SSHKeysTab.jsx
index 0a2ba7bf..0ba5cef0 100644
--- a/frontend/src/components/security/SSHKeysTab.jsx
+++ b/frontend/src/components/security/SSHKeysTab.jsx
@@ -3,6 +3,9 @@ import api from '../../services/api';
import ConfirmDialog from '../ConfirmDialog';
import { useToast } from '../../contexts/ToastContext';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Textarea } from '@/components/ui/textarea';
+import { Label } from '@/components/ui/label';
const SSHKeysTab = () => {
const [keys, setKeys] = useState([]);
@@ -71,12 +74,12 @@ const SSHKeysTab = () => {
<div className="card-header">
<h3>SSH Authorized Keys</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-primary" onClick={() => setShowAddModal(true)}>
+ <Button variant="default" size="sm" onClick={() => setShowAddModal(true)}>
Add Key
- </button>
- <button className="btn btn-sm btn-secondary" onClick={loadKeys}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={loadKeys}>
Refresh
- </button>
+ </Button>
</div>
</div>
<div className="card-body">
@@ -85,9 +88,9 @@ const SSHKeysTab = () => {
) : keys.length === 0 ? (
<div className="empty-state-sm">
<p>No SSH keys configured for root user.</p>
- <button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
+ <Button variant="default" onClick={() => setShowAddModal(true)}>
Add SSH Key
- </button>
+ </Button>
</div>
) : (
<table className="table">
@@ -106,9 +109,9 @@ const SSHKeysTab = () => {
<td><code className="fingerprint">{key.fingerprint}</code></td>
<td>{key.comment || '-'}</td>
<td>
- <button className="btn btn-sm btn-danger" onClick={() => handleRemoveKey(key.id, key.comment)}>
+ <Button variant="destructive" size="sm" onClick={() => handleRemoveKey(key.id, key.comment)}>
Remove
- </button>
+ </Button>
</td>
</tr>
))}
@@ -119,22 +122,22 @@ const SSHKeysTab = () => {
</div>
<Modal open={showAddModal} onClose={() => setShowAddModal(false)} title="Add SSH Public Key" size="lg">
- <div className="form-group">
- <label>Public Key</label>
- <textarea
- value={newKey}
- onChange={(e) => setNewKey(e.target.value)}
- placeholder="ssh-rsa AAAA... user@host or ssh-ed25519 AAAA... user@host"
- rows={4}
- />
- <p className="help-text">Paste your SSH public key (typically from ~/.ssh/id_rsa.pub or ~/.ssh/id_ed25519.pub)</p>
- </div>
- <div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowAddModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleAddKey} disabled={actionLoading || !newKey.trim()}>
- {actionLoading ? 'Adding...' : 'Add Key'}
- </button>
- </div>
+ <div className="form-group">
+ <Label>Public Key</Label>
+ <Textarea
+ value={newKey}
+ onChange={(e) => setNewKey(e.target.value)}
+ placeholder="ssh-rsa AAAA... user@host or ssh-ed25519 AAAA... user@host"
+ rows={4}
+ />
+ <p className="help-text">Paste your SSH public key (typically from ~/.ssh/id_rsa.pub or ~/.ssh/id_ed25519.pub)</p>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowAddModal(false)}>Cancel</Button>
+ <Button variant="default" onClick={handleAddKey} disabled={actionLoading || !newKey.trim()}>
+ {actionLoading ? 'Adding...' : 'Add Key'}
+ </Button>
+ </div>
</Modal>
{confirmDialog && (
diff --git a/frontend/src/components/security/ScannerTab.jsx b/frontend/src/components/security/ScannerTab.jsx
index 2b5481dc..9b5bce6c 100644
--- a/frontend/src/components/security/ScannerTab.jsx
+++ b/frontend/src/components/security/ScannerTab.jsx
@@ -1,5 +1,8 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
const ScannerTab = () => {
const [scanStatus, setScanStatus] = useState({ status: 'idle' });
@@ -96,13 +99,14 @@ const ScannerTab = () => {
</div>
<h4>Quick Scan</h4>
<span className="scan-desc">Scan common web directories</span>
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ variant="default"
+ size="sm"
onClick={(e) => { e.stopPropagation(); handleStartScan('quick'); }}
disabled={isScanning || scanning}
>
Start Scan
- </button>
+ </Button>
</div>
<div className="scan-card" onClick={() => !isScanning && !scanning && handleStartScan('full')}>
@@ -115,13 +119,14 @@ const ScannerTab = () => {
</div>
<h4>Full Scan</h4>
<span className="scan-desc">Scan entire system (slow)</span>
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ variant="default"
+ size="sm"
onClick={(e) => { e.stopPropagation(); handleStartScan('full'); }}
disabled={isScanning || scanning}
>
Start Scan
- </button>
+ </Button>
</div>
<div className="scan-card scan-card--custom">
@@ -133,7 +138,7 @@ const ScannerTab = () => {
<h4>Custom Path</h4>
<span className="scan-desc">Scan a specific directory</span>
<div className="scan-custom-input">
- <input
+ <Input
type="text"
value={scanPath}
onChange={(e) => setScanPath(e.target.value)}
@@ -141,35 +146,36 @@ const ScannerTab = () => {
disabled={isScanning}
onClick={(e) => e.stopPropagation()}
/>
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ variant="default"
+ size="sm"
onClick={() => handleStartScan('custom')}
disabled={isScanning || scanning || !scanPath}
>
Scan
- </button>
+ </Button>
</div>
</div>
</div>
<div className="scan-toolbar">
- <button className="btn btn-sm btn-secondary" onClick={handleUpdateDefinitions} disabled={updating}>
+ <Button variant="outline" size="sm" onClick={handleUpdateDefinitions} disabled={updating}>
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" y1="15" x2="12" y2="3"/>
</svg>
{updating ? 'Updating...' : 'Update Definitions'}
- </button>
+ </Button>
</div>
{isScanning && (
<div className="card scan-progress">
<div className="card-header">
<h3>Scan in Progress</h3>
- <button className="btn btn-sm btn-danger" onClick={handleCancelScan}>
+ <Button variant="destructive" size="sm" onClick={handleCancelScan}>
Cancel
- </button>
+ </Button>
</div>
<div className="card-body">
<div className="progress-info">
@@ -189,7 +195,7 @@ const ScannerTab = () => {
<div className="card">
<div className="card-header">
<h3>Scan History</h3>
- <button className="btn btn-sm btn-secondary" onClick={loadHistory}>Refresh</button>
+ <Button variant="outline" size="sm" onClick={loadHistory}>Refresh</Button>
</div>
<div className="card-body">
{history.length === 0 ? (
@@ -216,15 +222,15 @@ const ScannerTab = () => {
<td>{new Date(scan.started_at).toLocaleString()}</td>
<td className="path-cell">{scan.directory}</td>
<td>
- <span className={`badge badge-${scan.status === 'completed' ? 'success' : scan.status === 'error' ? 'danger' : 'warning'}`}>
+ <Badge variant={scan.status === 'completed' ? 'success' : scan.status === 'error' ? 'destructive' : 'warning'}>
{scan.status}
- </span>
+ </Badge>
</td>
<td>
{scan.infected_files?.length > 0 ? (
- <span className="badge badge-danger">{scan.infected_files.length} found</span>
+ <Badge variant="destructive">{scan.infected_files.length} found</Badge>
) : (
- <span className="badge badge-success">Clean</span>
+ <Badge variant="success">Clean</Badge>
)}
</td>
</tr>
diff --git a/frontend/src/components/security/SecurityConfigTab.jsx b/frontend/src/components/security/SecurityConfigTab.jsx
index 0976e98f..0697b126 100644
--- a/frontend/src/components/security/SecurityConfigTab.jsx
+++ b/frontend/src/components/security/SecurityConfigTab.jsx
@@ -1,5 +1,9 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Switch } from '@/components/ui/switch';
+import { Label } from '@/components/ui/label';
const SecurityConfigTab = () => {
const [config, setConfig] = useState(null);
@@ -63,36 +67,30 @@ const SecurityConfigTab = () => {
</div>
<div className="card-body">
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable ClamAV scanning</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.clamav?.enabled || false}
- onChange={(e) => updateConfig('clamav', 'enabled', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="clamav-enabled">Enable ClamAV scanning</Label>
+ <Switch
+ id="clamav-enabled"
+ checked={config?.clamav?.enabled || false}
+ onCheckedChange={(checked) => updateConfig('clamav', 'enabled', checked)}
+ />
+ </div>
</div>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Scan files on upload</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.clamav?.scan_on_upload || false}
- onChange={(e) => updateConfig('clamav', 'scan_on_upload', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="clamav-scan-upload">Scan files on upload</Label>
+ <Switch
+ id="clamav-scan-upload"
+ checked={config?.clamav?.scan_on_upload || false}
+ onCheckedChange={(checked) => updateConfig('clamav', 'scan_on_upload', checked)}
+ />
+ </div>
</div>
<div className="form-group">
- <label>Quarantine Path</label>
- <input
+ <Label>Quarantine Path</Label>
+ <Input
type="text"
value={config?.clamav?.quarantine_path || '/var/quarantine'}
onChange={(e) => updateConfig('clamav', 'quarantine_path', e.target.value)}
@@ -107,31 +105,25 @@ const SecurityConfigTab = () => {
</div>
<div className="card-body">
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable file integrity monitoring</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.file_integrity?.enabled || false}
- onChange={(e) => updateConfig('file_integrity', 'enabled', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="integrity-enabled">Enable file integrity monitoring</Label>
+ <Switch
+ id="integrity-enabled"
+ checked={config?.file_integrity?.enabled || false}
+ onCheckedChange={(checked) => updateConfig('file_integrity', 'enabled', checked)}
+ />
+ </div>
</div>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Alert on file changes</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.file_integrity?.alert_on_change || false}
- onChange={(e) => updateConfig('file_integrity', 'alert_on_change', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="integrity-alert">Alert on file changes</Label>
+ <Switch
+ id="integrity-alert"
+ checked={config?.file_integrity?.alert_on_change || false}
+ onCheckedChange={(checked) => updateConfig('file_integrity', 'alert_on_change', checked)}
+ />
+ </div>
</div>
</div>
</div>
@@ -142,53 +134,44 @@ const SecurityConfigTab = () => {
</div>
<div className="card-body">
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Notify on malware detection</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.notifications?.on_malware_found || false}
- onChange={(e) => updateConfig('notifications', 'on_malware_found', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="notify-malware">Notify on malware detection</Label>
+ <Switch
+ id="notify-malware"
+ checked={config?.notifications?.on_malware_found || false}
+ onCheckedChange={(checked) => updateConfig('notifications', 'on_malware_found', checked)}
+ />
+ </div>
</div>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Notify on integrity changes</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.notifications?.on_integrity_change || false}
- onChange={(e) => updateConfig('notifications', 'on_integrity_change', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="notify-integrity">Notify on integrity changes</Label>
+ <Switch
+ id="notify-integrity"
+ checked={config?.notifications?.on_integrity_change || false}
+ onCheckedChange={(checked) => updateConfig('notifications', 'on_integrity_change', checked)}
+ />
+ </div>
</div>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Notify on suspicious activity</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config?.notifications?.on_suspicious_activity || false}
- onChange={(e) => updateConfig('notifications', 'on_suspicious_activity', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="toggle-switch-label">
+ <Label htmlFor="notify-suspicious">Notify on suspicious activity</Label>
+ <Switch
+ id="notify-suspicious"
+ checked={config?.notifications?.on_suspicious_activity || false}
+ onCheckedChange={(checked) => updateConfig('notifications', 'on_suspicious_activity', checked)}
+ />
+ </div>
</div>
</div>
</div>
<div className="form-actions">
- <button className="btn btn-primary" onClick={handleSave} disabled={saving}>
+ <Button variant="default" onClick={handleSave} disabled={saving}>
{saving ? 'Saving...' : 'Save Settings'}
- </button>
+ </Button>
</div>
</div>
);
diff --git a/frontend/src/components/security/VulnerabilityTab.jsx b/frontend/src/components/security/VulnerabilityTab.jsx
index e9c7a37c..61358084 100644
--- a/frontend/src/components/security/VulnerabilityTab.jsx
+++ b/frontend/src/components/security/VulnerabilityTab.jsx
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
import { useToast } from '../../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const VulnerabilityTab = () => {
const [lynisStatus, setLynisStatus] = useState(null);
@@ -87,22 +89,22 @@ const VulnerabilityTab = () => {
</svg>
<h3>Lynis Not Installed</h3>
<p>Install Lynis to perform security audits and vulnerability scanning.</p>
- <button className="btn btn-primary" onClick={handleInstall} disabled={actionLoading}>
+ <Button variant="default" onClick={handleInstall} disabled={actionLoading}>
{actionLoading ? 'Installing...' : 'Install Lynis'}
- </button>
+ </Button>
</div>
) : (
<>
<div className="card">
<div className="card-header">
<h3>Lynis Vulnerability Scanner</h3>
- <button
- className="btn btn-primary"
+ <Button
+ variant="default"
onClick={handleStartScan}
disabled={actionLoading || scanStatus?.status === 'running'}
>
{scanStatus?.status === 'running' ? 'Scanning...' : 'Start Scan'}
- </button>
+ </Button>
</div>
<div className="card-body">
<div className="info-list">
@@ -112,9 +114,9 @@ const VulnerabilityTab = () => {
</div>
<div className="info-item">
<span className="info-label">Scan Status</span>
- <span className={`badge badge-${scanStatus?.status === 'completed' ? 'success' : scanStatus?.status === 'running' ? 'info' : 'secondary'}`}>
+ <Badge variant={scanStatus?.status === 'completed' ? 'success' : scanStatus?.status === 'running' ? 'info' : 'secondary'}>
{scanStatus?.status || 'Idle'}
- </span>
+ </Badge>
</div>
</div>
</div>
@@ -140,9 +142,9 @@ const VulnerabilityTab = () => {
<div className="card-header">
<h3>Scan Results</h3>
{scanStatus.hardening_index && (
- <span className={`badge badge-${scanStatus.hardening_index >= 70 ? 'success' : scanStatus.hardening_index >= 50 ? 'warning' : 'danger'}`}>
+ <Badge variant={scanStatus.hardening_index >= 70 ? 'success' : scanStatus.hardening_index >= 50 ? 'warning' : 'destructive'}>
Hardening Index: {scanStatus.hardening_index}
- </span>
+ </Badge>
)}
</div>
<div className="card-body">
diff --git a/frontend/src/components/settings/AboutTab.jsx b/frontend/src/components/settings/AboutTab.jsx
index b798e838..4c01e757 100644
--- a/frontend/src/components/settings/AboutTab.jsx
+++ b/frontend/src/components/settings/AboutTab.jsx
@@ -5,6 +5,7 @@ import {
RefreshCw, ExternalLink, Star, X
} from 'lucide-react';
import ServerKitLogo from '../ServerKitLogo';
+import { Button } from '@/components/ui/button';
const STAR_PROMPT_KEY = 'serverkit-star-prompt-dismissed';
@@ -64,8 +65,9 @@ const AboutTab = () => {
<div className="update-check">
{!updateInfo ? (
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={checkForUpdate}
disabled={checkingUpdate}
>
@@ -74,7 +76,7 @@ const AboutTab = () => {
) : (
<><Download size={14} /> Check for Updates</>
)}
- </button>
+ </Button>
) : updateInfo.error ? (
<div className="update-status error">
<span>{updateInfo.error}</span>
diff --git a/frontend/src/components/settings/ActivityTab.jsx b/frontend/src/components/settings/ActivityTab.jsx
index 53fd858b..41251ed2 100644
--- a/frontend/src/components/settings/ActivityTab.jsx
+++ b/frontend/src/components/settings/ActivityTab.jsx
@@ -2,6 +2,8 @@ import { useState, useEffect } from 'react';
import api from '../../services/api';
import ContributionGraph from './ContributionGraph';
import { Search, Filter, X, ChevronRight, User as UserIcon, Activity as ActivityIcon, Terminal } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const ActivityTab = () => {
const [summary, setSummary] = useState(null);
@@ -205,41 +207,53 @@ const ActivityTab = () => {
<div className="section-header">
<h4>Audit Log</h4>
</div>
-
+
<div className="filters-bar">
<div className="filter-group">
<label><Filter size={12} /> Action Type</label>
- <select
- className="form-control"
- value={filters.action}
- onChange={e => handleFilterChange('action', e.target.value)}
+ <Select
+ value={filters.action || '__all__'}
+ onValueChange={(val) => handleFilterChange('action', val === '__all__' ? '' : val)}
>
- <option value="">All Actions</option>
- {actions.map(action => (
- <option key={action} value={action}>{formatActionName(action)}</option>
- ))}
- </select>
+ <SelectTrigger>
+ <SelectValue placeholder="All Actions" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__all__">All Actions</SelectItem>
+ {actions.map(action => (
+ <SelectItem key={action} value={action}>{formatActionName(action)}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="filter-group">
<label><UserIcon size={12} /> User</label>
- <select
- className="form-control"
- value={filters.user_id}
- onChange={e => handleFilterChange('user_id', e.target.value)}
+ <Select
+ value={filters.user_id || '__all__'}
+ onValueChange={(val) => handleFilterChange('user_id', val === '__all__' ? '' : val)}
>
- <option value="">All Users</option>
- {users.map(u => (
- <option key={u.id} value={u.id}>{u.username}</option>
- ))}
- </select>
+ <SelectTrigger>
+ <SelectValue placeholder="All Users" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__all__">All Users</SelectItem>
+ {users.map(u => (
+ <SelectItem key={u.id} value={String(u.id)}>{u.username}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
{(filters.action || filters.user_id) && (
- <button className="btn btn-ghost btn-sm btn-clear" onClick={() => {
- setFilters({ action: '', user_id: '' });
- setPagination(prev => ({ ...prev, page: 1 }));
- }}>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => {
+ setFilters({ action: '', user_id: '' });
+ setPagination(prev => ({ ...prev, page: 1 }));
+ }}
+ >
<X size={14} /> Clear
- </button>
+ </Button>
)}
</div>
@@ -287,23 +301,25 @@ const ActivityTab = () => {
{pagination.pages > 1 && (
<div className="pagination">
- <button
- className="btn btn-sm btn-outline"
+ <Button
+ variant="outline"
+ size="sm"
disabled={pagination.page <= 1}
onClick={() => setPagination(prev => ({ ...prev, page: prev.page - 1 }))}
>
Previous
- </button>
+ </Button>
<span className="pagination-info">
Page {pagination.page} of {pagination.pages}
</span>
- <button
- className="btn btn-sm btn-outline"
+ <Button
+ variant="outline"
+ size="sm"
disabled={pagination.page >= pagination.pages}
onClick={() => setPagination(prev => ({ ...prev, page: prev.page + 1 }))}
>
Next
- </button>
+ </Button>
</div>
)}
</div>
diff --git a/frontend/src/components/settings/ApiKeyModal.jsx b/frontend/src/components/settings/ApiKeyModal.jsx
index ba77b203..eeb379cd 100644
--- a/frontend/src/components/settings/ApiKeyModal.jsx
+++ b/frontend/src/components/settings/ApiKeyModal.jsx
@@ -1,6 +1,10 @@
import { useState } from 'react';
-import { X, Copy, Check, AlertTriangle } from 'lucide-react';
+import { Copy, Check, AlertTriangle } from 'lucide-react';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Checkbox } from '@/components/ui/checkbox';
const SCOPE_OPTIONS = [
{ value: '*', label: 'Full Access' },
@@ -79,13 +83,13 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
</div>
<div className="api-key-modal__key-display">
<code>{createdKey}</code>
- <button className="btn btn-sm btn-secondary" onClick={copyKey}>
+ <Button variant="outline" size="sm" onClick={copyKey}>
{copied ? <Check size={14} /> : <Copy size={14} />}
{copied ? 'Copied' : 'Copy'}
- </button>
+ </Button>
</div>
<div className="modal-footer">
- <button className="btn btn-primary" onClick={onClose}>Done</button>
+ <Button variant="default" onClick={onClose}>Done</Button>
</div>
</Modal>
);
@@ -96,10 +100,9 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
<form onSubmit={handleSubmit}>
<div className="modal-body">
<div className="form-group">
- <label>Name</label>
- <input
+ <Label>Name</Label>
+ <Input
type="text"
- className="form-input"
value={name}
onChange={e => setName(e.target.value)}
placeholder="e.g. CI/CD Pipeline, Monitoring Script"
@@ -108,7 +111,7 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
</div>
<div className="form-group">
- <label>Tier</label>
+ <Label>Tier</Label>
<div className="api-key-modal__tiers">
{TIER_OPTIONS.map(t => (
<button
@@ -125,15 +128,14 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
</div>
<div className="form-group">
- <label>Scopes</label>
+ <Label>Scopes</Label>
<div className="api-key-modal__scopes">
{SCOPE_OPTIONS.map(s => (
<label key={s.value} className="api-key-modal__scope-item">
- <input
- type="checkbox"
+ <Checkbox
checked={scopes.includes(s.value) || (s.value !== '*' && scopes.includes('*'))}
disabled={s.value !== '*' && scopes.includes('*')}
- onChange={() => handleScopeToggle(s.value)}
+ onCheckedChange={() => handleScopeToggle(s.value)}
/>
<span>{s.label}</span>
</label>
@@ -142,10 +144,9 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
</div>
<div className="form-group">
- <label>Expiration (optional)</label>
- <input
+ <Label>Expiration (optional)</Label>
+ <Input
type="datetime-local"
- className="form-input"
value={expiresAt}
onChange={e => setExpiresAt(e.target.value)}
/>
@@ -153,10 +154,10 @@ const ApiKeyModal = ({ onClose, onSubmit, createdKey }) => {
</div>
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={onClose}>Cancel</button>
- <button type="submit" className="btn btn-primary" disabled={saving || !name.trim()}>
+ <Button type="button" variant="outline" onClick={onClose}>Cancel</Button>
+ <Button type="submit" variant="default" disabled={saving || !name.trim()}>
{saving ? 'Creating...' : 'Create Key'}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/frontend/src/components/settings/ApiSettingsTab.jsx b/frontend/src/components/settings/ApiSettingsTab.jsx
index d444c6f3..17550ab0 100644
--- a/frontend/src/components/settings/ApiSettingsTab.jsx
+++ b/frontend/src/components/settings/ApiSettingsTab.jsx
@@ -7,6 +7,10 @@ import {
Key, Plus, Trash2, RotateCcw, Activity, AlertCircle,
Check, Send, ChevronDown, ChevronUp, Zap, BarChart3, RefreshCw
} from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
const ApiSettingsTab = () => {
const { isAdmin } = useAuth();
@@ -72,9 +76,9 @@ const ApiKeysSection = () => {
<p>Manage programmatic access to the ServerKit API</p>
</div>
</div>
- <button className="btn btn-primary btn-sm" onClick={() => setShowModal(true)}>
+ <Button variant="default" size="sm" onClick={() => setShowModal(true)}>
<Plus size={14} /> Create Key
- </button>
+ </Button>
</div>
{loading ? (
@@ -103,7 +107,7 @@ const ApiKeysSection = () => {
<td className="api-settings__key-name">{key.name}</td>
<td><code className="api-settings__key-prefix">{key.key_prefix}...</code></td>
<td>
- <span className={`badge badge--${key.tier}`}>{key.tier}</span>
+ <Badge variant="outline">{key.tier}</Badge>
</td>
<td className="api-settings__muted">
{key.last_used_at
@@ -112,28 +116,31 @@ const ApiKeysSection = () => {
</td>
<td>
{key.is_active && !key.revoked_at ? (
- <span className="badge badge--success">Active</span>
+ <Badge variant="success">Active</Badge>
) : (
- <span className="badge badge--danger">Revoked</span>
+ <Badge variant="destructive">Revoked</Badge>
)}
</td>
<td className="api-settings__actions">
{key.is_active && !key.revoked_at && (
<>
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleRotate(key.id)}
title="Rotate"
>
<RotateCcw size={14} />
- </button>
- <button
- className="btn btn-sm btn-ghost btn-danger"
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleRevoke(key.id)}
title="Revoke"
+ className="text-destructive hover:text-destructive"
>
<Trash2 size={14} />
- </button>
+ </Button>
</>
)}
</td>
@@ -221,10 +228,9 @@ const RateLimitsSection = () => {
<div className="api-settings__rate-limits">
{Object.entries(limits).map(([key, value]) => (
<div key={key} className="form-group form-group--inline">
- <label>{labels[key]}</label>
- <input
+ <Label>{labels[key]}</Label>
+ <Input
type="text"
- className="form-input"
value={value}
onChange={e => setLimits(prev => ({ ...prev, [key]: e.target.value }))}
placeholder="e.g. 100 per minute"
@@ -234,9 +240,9 @@ const RateLimitsSection = () => {
</div>
<div className="settings-card__footer">
- <button className="btn btn-primary" onClick={handleSave} disabled={saving}>
+ <Button variant="default" onClick={handleSave} disabled={saving}>
{saving ? 'Saving...' : 'Save Rate Limits'}
- </button>
+ </Button>
</div>
</div>
);
@@ -311,9 +317,9 @@ const WebhookSection = () => {
<p>Receive HTTP notifications when events occur</p>
</div>
</div>
- <button className="btn btn-primary btn-sm" onClick={() => setShowModal(true)}>
+ <Button variant="default" size="sm" onClick={() => setShowModal(true)}>
<Plus size={14} /> Add Webhook
- </button>
+ </Button>
</div>
{loading ? (
@@ -333,35 +339,40 @@ const WebhookSection = () => {
<span className="api-settings__webhook-url">{sub.url}</span>
<div className="api-settings__webhook-events">
{sub.events.slice(0, 3).map(e => (
- <span key={e} className="badge badge--subtle">{e}</span>
+ <Badge key={e} variant="secondary">{e}</Badge>
))}
{sub.events.length > 3 && (
- <span className="badge badge--subtle">+{sub.events.length - 3}</span>
+ <Badge variant="secondary">+{sub.events.length - 3}</Badge>
)}
</div>
</div>
<div className="api-settings__webhook-controls">
- <span className={`badge ${sub.is_active ? 'badge--success' : 'badge--danger'}`}>
+ <Badge variant={sub.is_active ? 'success' : 'destructive'}>
{sub.is_active ? 'Active' : 'Inactive'}
- </span>
+ </Badge>
{expandedId === sub.id ? <ChevronUp size={16} /> : <ChevronDown size={16} />}
</div>
</div>
{expandedId === sub.id && (
<div className="api-settings__webhook-details">
<div className="api-settings__webhook-actions">
- <button className="btn btn-sm btn-secondary" onClick={() => handleTest(sub.id)}>
+ <Button variant="outline" size="sm" onClick={() => handleTest(sub.id)}>
<Send size={14} /> Test
- </button>
- <button className="btn btn-sm btn-secondary" onClick={() => setEditingSub(sub)}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={() => setEditingSub(sub)}>
Edit
- </button>
- <button className="btn btn-sm btn-ghost btn-danger" onClick={() => handleDelete(sub.id)}>
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ onClick={() => handleDelete(sub.id)}
+ className="text-destructive hover:text-destructive"
+ >
<Trash2 size={14} /> Delete
- </button>
- <button className="btn btn-sm btn-ghost" onClick={() => loadDeliveries(sub.id)}>
+ </Button>
+ <Button variant="ghost" size="sm" onClick={() => loadDeliveries(sub.id)}>
<RefreshCw size={14} />
- </button>
+ </Button>
</div>
{deliveries[sub.id] && (
<div className="api-settings__deliveries">
@@ -384,9 +395,9 @@ const WebhookSection = () => {
<tr key={d.id}>
<td><code>{d.event_type}</code></td>
<td>
- <span className={`badge badge--${d.status === 'success' ? 'success' : d.status === 'failed' ? 'danger' : 'warning'}`}>
+ <Badge variant={d.status === 'success' ? 'success' : d.status === 'failed' ? 'destructive' : 'warning'}>
{d.status}
- </span>
+ </Badge>
</td>
<td>{d.http_status || '-'}</td>
<td>{d.duration_ms ? `${d.duration_ms}ms` : '-'}</td>
@@ -461,13 +472,14 @@ const AnalyticsSection = () => {
</div>
<div className="api-settings__period-select">
{['1h', '24h', '7d', '30d'].map(p => (
- <button
+ <Button
key={p}
- className={`btn btn-sm ${period === p ? 'btn-primary' : 'btn-ghost'}`}
+ size="sm"
+ variant={period === p ? 'default' : 'ghost'}
onClick={() => setPeriod(p)}
>
{p}
- </button>
+ </Button>
))}
</div>
</div>
@@ -535,7 +547,7 @@ const AnalyticsSection = () => {
<tbody>
{endpoints.slice(0, 10).map((ep, i) => (
<tr key={i}>
- <td><span className={`badge badge--method badge--${ep.method.toLowerCase()}`}>{ep.method}</span></td>
+ <td><Badge variant="outline">{ep.method}</Badge></td>
<td><code>{ep.endpoint}</code></td>
<td>{ep.count.toLocaleString()}</td>
<td>{ep.avg_response_time_ms}ms</td>
diff --git a/frontend/src/components/settings/AppearanceTab.jsx b/frontend/src/components/settings/AppearanceTab.jsx
index 506df3d9..623cd664 100644
--- a/frontend/src/components/settings/AppearanceTab.jsx
+++ b/frontend/src/components/settings/AppearanceTab.jsx
@@ -1,6 +1,8 @@
import { useTheme } from '../../contexts/ThemeContext';
import useDashboardLayout from '../../hooks/useDashboardLayout';
import { ChevronDown, ChevronUp, RotateCcw } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Switch } from '@/components/ui/switch';
const ACCENT_PRESETS = [
{ label: 'Indigo', color: '#6366f1' },
@@ -106,14 +108,10 @@ const AppearanceTab = () => {
{widgets.map((widget, idx) => (
<div key={widget.id} className={`widget-item${!widget.visible ? ' widget-item--hidden' : ''}`}>
<div className="widget-item__info">
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={widget.visible}
- onChange={() => toggleWidget(widget.id)}
- />
- <span className="toggle-slider"></span>
- </label>
+ <Switch
+ checked={widget.visible}
+ onCheckedChange={() => toggleWidget(widget.id)}
+ />
<span className="widget-item__label">{widget.label}</span>
</div>
<div className="widget-item__controls">
@@ -137,10 +135,10 @@ const AppearanceTab = () => {
</div>
))}
</div>
- <button className="btn btn-secondary btn-sm" onClick={resetLayout} style={{ marginTop: '12px' }}>
+ <Button variant="outline" size="sm" onClick={resetLayout} style={{ marginTop: '12px' }}>
<RotateCcw size={14} />
Reset to defaults
- </button>
+ </Button>
</div>
</div>
diff --git a/frontend/src/components/settings/AuditLogTab.jsx b/frontend/src/components/settings/AuditLogTab.jsx
index d8b2aedf..1115ba78 100644
--- a/frontend/src/components/settings/AuditLogTab.jsx
+++ b/frontend/src/components/settings/AuditLogTab.jsx
@@ -1,5 +1,7 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const AuditLogTab = () => {
const [logs, setLogs] = useState([]);
@@ -56,12 +58,6 @@ const AuditLogTab = () => {
}
}
- function handleFilterChange(e) {
- const { name, value } = e.target;
- setFilters(prev => ({ ...prev, [name]: value }));
- setPagination(prev => ({ ...prev, page: 1 }));
- }
-
function handlePageChange(newPage) {
setPagination(prev => ({ ...prev, page: newPage }));
}
@@ -162,19 +158,31 @@ const AuditLogTab = () => {
<div className="filters-bar">
<div className="filter-group">
<label>Action Type</label>
- <select name="action" value={filters.action} onChange={handleFilterChange}>
- <option value="">All Actions</option>
- {actions.map(action => (
- <option key={action} value={action}>{formatActionName(action)}</option>
- ))}
- </select>
+ <Select
+ value={filters.action || '__all__'}
+ onValueChange={(val) => {
+ const value = val === '__all__' ? '' : val;
+ setFilters(prev => ({ ...prev, action: value }));
+ setPagination(prev => ({ ...prev, page: 1 }));
+ }}
+ >
+ <SelectTrigger>
+ <SelectValue placeholder="All Actions" />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__all__">All Actions</SelectItem>
+ {actions.map(action => (
+ <SelectItem key={action} value={action}>{formatActionName(action)}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
- <button className="btn btn-ghost" onClick={() => {
+ <Button variant="ghost" onClick={() => {
setFilters({ action: '', user_id: '' });
setPagination(prev => ({ ...prev, page: 1 }));
}}>
Clear Filters
- </button>
+ </Button>
</div>
{error && <div className="error-message">{error}</div>}
@@ -219,24 +227,26 @@ const AuditLogTab = () => {
{pagination.pages > 1 && (
<div className="pagination">
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
disabled={pagination.page <= 1}
onClick={() => handlePageChange(pagination.page - 1)}
>
Previous
- </button>
+ </Button>
<span className="pagination-info">
Page {pagination.page} of {pagination.pages}
({pagination.total} total)
</span>
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
disabled={pagination.page >= pagination.pages}
onClick={() => handlePageChange(pagination.page + 1)}
>
Next
- </button>
+ </Button>
</div>
)}
</>
diff --git a/frontend/src/components/settings/IconReferenceTab.jsx b/frontend/src/components/settings/IconReferenceTab.jsx
index 8dfcc068..92cc430f 100644
--- a/frontend/src/components/settings/IconReferenceTab.jsx
+++ b/frontend/src/components/settings/IconReferenceTab.jsx
@@ -11,6 +11,7 @@ import {
Sparkles, ArrowUpCircle, AlertCircle, XCircle, GitCompare, GitCommit, Rocket,
Minus, Unlock, ArrowDownLeft, ArrowUpRight
} from 'lucide-react';
+import { Input } from '@/components/ui/input';
const ICON_CATALOG = {
'General': {
@@ -87,12 +88,11 @@ const IconReferenceTab = () => {
<div className="form-group">
<div className="search-input-wrapper" style={{ position: 'relative' }}>
<Search size={16} style={{ position: 'absolute', left: 12, top: '50%', transform: 'translateY(-50%)', opacity: 0.5 }} />
- <input
+ <Input
type="text"
placeholder="Search icons..."
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}
- className="form-input"
style={{ paddingLeft: 36 }}
/>
</div>
diff --git a/frontend/src/components/settings/InvitationsTab.jsx b/frontend/src/components/settings/InvitationsTab.jsx
index becfd108..e94d1910 100644
--- a/frontend/src/components/settings/InvitationsTab.jsx
+++ b/frontend/src/components/settings/InvitationsTab.jsx
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
import InviteModal from './InviteModal';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const InvitationsTab = () => {
const [invitations, setInvitations] = useState([]);
@@ -55,14 +57,22 @@ const InvitationsTab = () => {
});
}
- function getStatusBadgeClass(status, isExpired) {
- if (isExpired && status === 'pending') return 'invitation-status expired';
+ function getRoleBadgeVariant(role) {
+ switch (role) {
+ case 'admin': return 'destructive';
+ case 'developer': return 'default';
+ default: return 'secondary';
+ }
+ }
+
+ function getStatusBadgeVariant(status, isExpired) {
+ if (isExpired && status === 'pending') return 'warning';
switch (status) {
- case 'pending': return 'invitation-status pending';
- case 'accepted': return 'invitation-status accepted';
- case 'expired': return 'invitation-status expired';
- case 'revoked': return 'invitation-status revoked';
- default: return 'invitation-status';
+ case 'pending': return 'info';
+ case 'accepted': return 'success';
+ case 'expired': return 'warning';
+ case 'revoked': return 'secondary';
+ default: return 'secondary';
}
}
@@ -73,7 +83,7 @@ const InvitationsTab = () => {
<h4>Invitations</h4>
<p>Manage team invitations</p>
</div>
- <button className="btn btn-primary btn-sm" onClick={() => setShowInviteModal(true)}>
+ <Button variant="default" size="sm" onClick={() => setShowInviteModal(true)}>
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"/>
<circle cx="8.5" cy="7" r="4"/>
@@ -81,7 +91,7 @@ const InvitationsTab = () => {
<line x1="23" y1="11" x2="17" y2="11"/>
</svg>
Invite User
- </button>
+ </Button>
</div>
{loading ? (
@@ -106,43 +116,47 @@ const InvitationsTab = () => {
<tr key={inv.id}>
<td>{inv.email || <span className="text-muted">Link only</span>}</td>
<td>
- <span className={`badge ${inv.role === 'admin' ? 'badge-danger' : inv.role === 'developer' ? 'badge-primary' : 'badge-secondary'}`}>
+ <Badge variant={getRoleBadgeVariant(inv.role)}>
{inv.role}
- </span>
+ </Badge>
</td>
<td>
- <span className={getStatusBadgeClass(inv.status, inv.is_expired)}>
+ <Badge variant={getStatusBadgeVariant(inv.status, inv.is_expired)}>
{inv.is_expired && inv.status === 'pending' ? 'expired' : inv.status}
- </span>
+ </Badge>
</td>
<td className="date-cell">{formatDate(inv.created_at)}</td>
<td className="date-cell">{formatDate(inv.expires_at)}</td>
<td className="actions-cell">
{inv.status === 'pending' && !inv.is_expired && (
<>
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => copyLink(inv.token)}
title="Copy invite link"
>
{copied === inv.token ? 'Copied!' : 'Copy Link'}
- </button>
+ </Button>
{inv.email && (
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleResend(inv.id)}
title="Resend email"
>
Resend
- </button>
+ </Button>
)}
- <button
- className="btn btn-sm btn-ghost text-danger"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleRevoke(inv.id)}
title="Revoke invitation"
+ className="text-destructive hover:text-destructive"
>
Revoke
- </button>
+ </Button>
</>
)}
</td>
diff --git a/frontend/src/components/settings/InviteModal.jsx b/frontend/src/components/settings/InviteModal.jsx
index 108a7050..f45dcff6 100644
--- a/frontend/src/components/settings/InviteModal.jsx
+++ b/frontend/src/components/settings/InviteModal.jsx
@@ -2,6 +2,10 @@ import React, { useState, useEffect } from 'react';
import api from '../../services/api';
import PermissionEditor from './PermissionEditor';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const InviteModal = ({ onClose, onCreated }) => {
const [email, setEmail] = useState('');
@@ -24,8 +28,7 @@ const InviteModal = ({ onClose, onCreated }) => {
}).catch(() => {});
}, []);
- function handleRoleChange(e) {
- const newRole = e.target.value;
+ function handleRoleChange(newRole) {
setRole(newRole);
if (templates[newRole]) {
setPermissions(templates[newRole]);
@@ -72,9 +75,9 @@ const InviteModal = ({ onClose, onCreated }) => {
<p>Share this invitation link:</p>
<div className="invite-link-display">
<code>{result.invite_url}</code>
- <button className="btn btn-sm btn-ghost" onClick={copyLink}>
+ <Button variant="ghost" size="sm" onClick={copyLink}>
{copied ? 'Copied!' : 'Copy'}
- </button>
+ </Button>
</div>
{result.email_sent && (
<p className="text-success" style={{ marginTop: 12 }}>
@@ -87,7 +90,7 @@ const InviteModal = ({ onClose, onCreated }) => {
</p>
)}
<div className="modal-footer">
- <button className="btn btn-primary" onClick={onClose}>Done</button>
+ <Button variant="default" onClick={onClose}>Done</Button>
</div>
</Modal>
);
@@ -100,8 +103,8 @@ const InviteModal = ({ onClose, onCreated }) => {
{error && <div className="error-message">{error}</div>}
<div className="form-group">
- <label htmlFor="invite-email">Email (optional)</label>
- <input
+ <Label htmlFor="invite-email">Email (optional)</Label>
+ <Input
type="email"
id="invite-email"
value={email}
@@ -115,31 +118,45 @@ const InviteModal = ({ onClose, onCreated }) => {
<div className="form-row">
<div className="form-group">
- <label htmlFor="invite-role">Role</label>
- <select id="invite-role" value={role} onChange={handleRoleChange}>
- <option value="admin">Admin</option>
- <option value="developer">Developer</option>
- <option value="viewer">Viewer</option>
- </select>
+ <Label htmlFor="invite-role">Role</Label>
+ <Select value={role} onValueChange={handleRoleChange}>
+ <SelectTrigger id="invite-role">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="admin">Admin</SelectItem>
+ <SelectItem value="developer">Developer</SelectItem>
+ <SelectItem value="viewer">Viewer</SelectItem>
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
- <label htmlFor="invite-expiry">Expires</label>
- <select id="invite-expiry" value={expiryDays} onChange={e => setExpiryDays(Number(e.target.value))}>
- <option value={1}>1 day</option>
- <option value={3}>3 days</option>
- <option value={7}>7 days</option>
- <option value={30}>30 days</option>
- <option value={0}>Never</option>
- </select>
+ <Label htmlFor="invite-expiry">Expires</Label>
+ <Select
+ value={String(expiryDays)}
+ onValueChange={(val) => setExpiryDays(Number(val))}
+ >
+ <SelectTrigger id="invite-expiry">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="1">1 day</SelectItem>
+ <SelectItem value="3">3 days</SelectItem>
+ <SelectItem value="7">7 days</SelectItem>
+ <SelectItem value="30">30 days</SelectItem>
+ <SelectItem value="0">Never</SelectItem>
+ </SelectContent>
+ </Select>
</div>
</div>
{role !== 'admin' && (
<div className="customize-permissions-section">
- <button
+ <Button
type="button"
- className="btn btn-ghost btn-sm"
+ variant="ghost"
+ size="sm"
onClick={() => {
if (!showPermissions && templates[role]) {
setPermissions(templates[role]);
@@ -154,7 +171,7 @@ const InviteModal = ({ onClose, onCreated }) => {
: <polyline points="6 9 12 15 18 9"/>
}
</svg>
- </button>
+ </Button>
{showPermissions && (
<PermissionEditor
permissions={permissions}
@@ -166,10 +183,10 @@ const InviteModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-ghost" onClick={onClose}>Cancel</button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ <Button type="button" variant="ghost" onClick={onClose}>Cancel</Button>
+ <Button type="submit" variant="default" disabled={loading}>
{loading ? 'Creating...' : 'Create Invitation'}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/frontend/src/components/settings/MigrationHistoryTab.jsx b/frontend/src/components/settings/MigrationHistoryTab.jsx
index 79a7a2af..4cf23885 100644
--- a/frontend/src/components/settings/MigrationHistoryTab.jsx
+++ b/frontend/src/components/settings/MigrationHistoryTab.jsx
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
import { Database, Loader, CheckCircle, ArrowUpCircle } from 'lucide-react';
+import { Badge } from '@/components/ui/badge';
const MigrationHistoryTab = () => {
const [revisions, setRevisions] = useState([]);
@@ -77,17 +78,17 @@ const MigrationHistoryTab = () => {
<td>{rev.description || 'Schema update'}</td>
<td>
{rev.is_current && (
- <span className="badge badge--success">
+ <Badge variant="success">
<CheckCircle size={12} /> Current
- </span>
+ </Badge>
)}
{rev.is_head && !rev.is_current && (
- <span className="badge badge--warning">
+ <Badge variant="warning">
<ArrowUpCircle size={12} /> Pending
- </span>
+ </Badge>
)}
{!rev.is_current && !rev.is_head && (
- <span className="badge badge--neutral">Applied</span>
+ <Badge variant="secondary">Applied</Badge>
)}
</td>
</tr>
diff --git a/frontend/src/components/settings/NotificationsTab.jsx b/frontend/src/components/settings/NotificationsTab.jsx
index 214f553d..5cf60c3c 100644
--- a/frontend/src/components/settings/NotificationsTab.jsx
+++ b/frontend/src/components/settings/NotificationsTab.jsx
@@ -1,6 +1,12 @@
import React, { useState, useEffect } from 'react';
import { useAuth } from '../../contexts/AuthContext';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Switch } from '@/components/ui/switch';
+import { Badge } from '@/components/ui/badge';
+import { Checkbox } from '@/components/ui/checkbox';
const NotificationsTab = () => {
const { isAdmin, user } = useAuth();
@@ -138,17 +144,13 @@ const NotificationsTab = () => {
<div className="user-notification-prefs">
<div className="settings-card">
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable notifications for my account</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={userPrefs.enabled}
- onChange={(e) => setUserPrefs({...userPrefs, enabled: e.target.checked})}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="flex items-center gap-3">
+ <Switch
+ checked={userPrefs.enabled}
+ onCheckedChange={(checked) => setUserPrefs({...userPrefs, enabled: checked})}
+ />
+ <Label>Enable notifications for my account</Label>
+ </div>
</div>
</div>
@@ -158,11 +160,10 @@ const NotificationsTab = () => {
<div className="channel-toggles">
{['email', 'discord', 'slack', 'telegram'].map(ch => (
<label key={ch} className="channel-toggle">
- <input
- type="checkbox"
+ <Checkbox
checked={userPrefs.channels?.includes(ch)}
- onChange={(e) => {
- const channels = e.target.checked
+ onCheckedChange={(checked) => {
+ const channels = checked
? [...(userPrefs.channels || []), ch]
: (userPrefs.channels || []).filter(c => c !== ch);
setUserPrefs({...userPrefs, channels});
@@ -178,8 +179,8 @@ const NotificationsTab = () => {
<div className="settings-card">
<h3>Email Settings</h3>
<div className="form-group">
- <label>Notification Email (optional)</label>
- <input
+ <Label>Notification Email (optional)</Label>
+ <Input
type="email"
value={userPrefs.email || ''}
onChange={(e) => setUserPrefs({...userPrefs, email: e.target.value})}
@@ -194,8 +195,8 @@ const NotificationsTab = () => {
<div className="settings-card">
<h3>Personal Discord Webhook</h3>
<div className="form-group">
- <label>Webhook URL</label>
- <input
+ <Label>Webhook URL</Label>
+ <Input
type="text"
value={userPrefs.discord_webhook || ''}
onChange={(e) => setUserPrefs({...userPrefs, discord_webhook: e.target.value})}
@@ -210,8 +211,8 @@ const NotificationsTab = () => {
<div className="settings-card">
<h3>Personal Telegram</h3>
<div className="form-group">
- <label>Your Chat ID</label>
- <input
+ <Label>Your Chat ID</Label>
+ <Input
type="text"
value={userPrefs.telegram_chat_id || ''}
onChange={(e) => setUserPrefs({...userPrefs, telegram_chat_id: e.target.value})}
@@ -228,11 +229,10 @@ const NotificationsTab = () => {
<div className="severity-toggles">
{severityOptions.map(severity => (
<label key={severity} className={`severity-toggle ${severity}`}>
- <input
- type="checkbox"
+ <Checkbox
checked={userPrefs.severities?.includes(severity)}
- onChange={(e) => {
- const severities = e.target.checked
+ onCheckedChange={(checked) => {
+ const severities = checked
? [...(userPrefs.severities || []), severity]
: (userPrefs.severities || []).filter(s => s !== severity);
setUserPrefs({...userPrefs, severities});
@@ -255,12 +255,11 @@ const NotificationsTab = () => {
apps: 'Application Events'
}).map(([key, label]) => (
<label key={key} className="category-toggle">
- <input
- type="checkbox"
+ <Checkbox
checked={userPrefs.categories?.[key] !== false}
- onChange={(e) => setUserPrefs({
+ onCheckedChange={(checked) => setUserPrefs({
...userPrefs,
- categories: { ...userPrefs.categories, [key]: e.target.checked }
+ categories: { ...userPrefs.categories, [key]: checked }
})}
/>
<span>{label}</span>
@@ -273,26 +272,22 @@ const NotificationsTab = () => {
<h3>Quiet Hours</h3>
<p>Pause non-critical notifications during these hours</p>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable quiet hours</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={userPrefs.quiet_hours?.enabled}
- onChange={(e) => setUserPrefs({
- ...userPrefs,
- quiet_hours: { ...userPrefs.quiet_hours, enabled: e.target.checked }
- })}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="flex items-center gap-3">
+ <Switch
+ checked={userPrefs.quiet_hours?.enabled}
+ onCheckedChange={(checked) => setUserPrefs({
+ ...userPrefs,
+ quiet_hours: { ...userPrefs.quiet_hours, enabled: checked }
+ })}
+ />
+ <Label>Enable quiet hours</Label>
+ </div>
</div>
{userPrefs.quiet_hours?.enabled && (
<div className="form-row">
<div className="form-group">
- <label>Start Time</label>
- <input
+ <Label>Start Time</Label>
+ <Input
type="time"
value={userPrefs.quiet_hours?.start || '22:00'}
onChange={(e) => setUserPrefs({
@@ -302,8 +297,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>End Time</label>
- <input
+ <Label>End Time</Label>
+ <Input
type="time"
value={userPrefs.quiet_hours?.end || '08:00'}
onChange={(e) => setUserPrefs({
@@ -317,20 +312,20 @@ const NotificationsTab = () => {
</div>
<div className="form-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleTestUserNotification}
disabled={testing === 'user' || !userPrefs.enabled}
>
{testing === 'user' ? 'Sending...' : 'Send Test Notification'}
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
+ variant="default"
onClick={handleSaveUserPrefs}
disabled={saving}
>
{saving ? 'Saving...' : 'Save Preferences'}
- </button>
+ </Button>
</div>
</div>
);
@@ -419,9 +414,9 @@ const NotificationsTab = () => {
<p>{channel.description}</p>
</div>
<div className="channel-status">
- <span className={`badge ${config[channel.id]?.enabled ? 'badge-success' : 'badge-secondary'}`}>
+ <Badge variant={config[channel.id]?.enabled ? 'success' : 'secondary'}>
{config[channel.id]?.enabled ? 'Enabled' : 'Disabled'}
- </span>
+ </Badge>
<svg
viewBox="0 0 24 24"
width="20"
@@ -436,24 +431,20 @@ const NotificationsTab = () => {
{expandedChannel === channel.id && (
<div className="channel-config">
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable {channel.name}</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config[channel.id]?.enabled || false}
- onChange={(e) => updateChannelConfig(channel.id, 'enabled', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="flex items-center gap-3">
+ <Switch
+ checked={config[channel.id]?.enabled || false}
+ onCheckedChange={(checked) => updateChannelConfig(channel.id, 'enabled', checked)}
+ />
+ <Label>Enable {channel.name}</Label>
+ </div>
</div>
{channel.id === 'discord' && (
<>
<div className="form-group">
- <label>Webhook URL</label>
- <input
+ <Label>Webhook URL</Label>
+ <Input
type="text"
value={config.discord.webhook_url || ''}
onChange={(e) => updateChannelConfig('discord', 'webhook_url', e.target.value)}
@@ -463,8 +454,8 @@ const NotificationsTab = () => {
</div>
<div className="form-row">
<div className="form-group">
- <label>Bot Username</label>
- <input
+ <Label>Bot Username</Label>
+ <Input
type="text"
value={config.discord.username || 'ServerKit'}
onChange={(e) => updateChannelConfig('discord', 'username', e.target.value)}
@@ -472,8 +463,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>Avatar URL (optional)</label>
- <input
+ <Label>Avatar URL (optional)</Label>
+ <Input
type="text"
value={config.discord.avatar_url || ''}
onChange={(e) => updateChannelConfig('discord', 'avatar_url', e.target.value)}
@@ -487,8 +478,8 @@ const NotificationsTab = () => {
{channel.id === 'slack' && (
<>
<div className="form-group">
- <label>Webhook URL</label>
- <input
+ <Label>Webhook URL</Label>
+ <Input
type="text"
value={config.slack.webhook_url || ''}
onChange={(e) => updateChannelConfig('slack', 'webhook_url', e.target.value)}
@@ -498,8 +489,8 @@ const NotificationsTab = () => {
</div>
<div className="form-row">
<div className="form-group">
- <label>Channel (optional)</label>
- <input
+ <Label>Channel (optional)</Label>
+ <Input
type="text"
value={config.slack.channel || ''}
onChange={(e) => updateChannelConfig('slack', 'channel', e.target.value)}
@@ -507,8 +498,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>Username</label>
- <input
+ <Label>Username</Label>
+ <Input
type="text"
value={config.slack.username || 'ServerKit'}
onChange={(e) => updateChannelConfig('slack', 'username', e.target.value)}
@@ -522,8 +513,8 @@ const NotificationsTab = () => {
{channel.id === 'telegram' && (
<>
<div className="form-group">
- <label>Bot Token</label>
- <input
+ <Label>Bot Token</Label>
+ <Input
type="password"
value={config.telegram.bot_token || ''}
onChange={(e) => updateChannelConfig('telegram', 'bot_token', e.target.value)}
@@ -532,8 +523,8 @@ const NotificationsTab = () => {
<span className="form-help">Get a bot token from @BotFather on Telegram</span>
</div>
<div className="form-group">
- <label>Chat ID</label>
- <input
+ <Label>Chat ID</Label>
+ <Input
type="text"
value={config.telegram.chat_id || ''}
onChange={(e) => updateChannelConfig('telegram', 'chat_id', e.target.value)}
@@ -548,8 +539,8 @@ const NotificationsTab = () => {
<>
<div className="form-row">
<div className="form-group">
- <label>SMTP Host</label>
- <input
+ <Label>SMTP Host</Label>
+ <Input
type="text"
value={config.email.smtp_host || ''}
onChange={(e) => updateChannelConfig('email', 'smtp_host', e.target.value)}
@@ -557,8 +548,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>SMTP Port</label>
- <input
+ <Label>SMTP Port</Label>
+ <Input
type="number"
value={config.email.smtp_port || 587}
onChange={(e) => updateChannelConfig('email', 'smtp_port', parseInt(e.target.value))}
@@ -568,8 +559,8 @@ const NotificationsTab = () => {
</div>
<div className="form-row">
<div className="form-group">
- <label>SMTP Username</label>
- <input
+ <Label>SMTP Username</Label>
+ <Input
type="text"
value={config.email.smtp_user || ''}
onChange={(e) => updateChannelConfig('email', 'smtp_user', e.target.value)}
@@ -577,8 +568,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>SMTP Password</label>
- <input
+ <Label>SMTP Password</Label>
+ <Input
type="password"
value={config.email.smtp_password || ''}
onChange={(e) => updateChannelConfig('email', 'smtp_password', e.target.value)}
@@ -588,8 +579,8 @@ const NotificationsTab = () => {
</div>
<div className="form-row">
<div className="form-group">
- <label>From Email</label>
- <input
+ <Label>From Email</Label>
+ <Input
type="email"
value={config.email.from_email || ''}
onChange={(e) => updateChannelConfig('email', 'from_email', e.target.value)}
@@ -597,8 +588,8 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label>From Name</label>
- <input
+ <Label>From Name</Label>
+ <Input
type="text"
value={config.email.from_name || 'ServerKit'}
onChange={(e) => updateChannelConfig('email', 'from_name', e.target.value)}
@@ -607,8 +598,8 @@ const NotificationsTab = () => {
</div>
</div>
<div className="form-group">
- <label>Recipient Emails (comma-separated)</label>
- <input
+ <Label>Recipient Emails (comma-separated)</Label>
+ <Input
type="text"
value={(config.email.to_emails || []).join(', ')}
onChange={(e) => updateChannelConfig('email', 'to_emails', e.target.value.split(',').map(s => s.trim()).filter(Boolean))}
@@ -616,25 +607,21 @@ const NotificationsTab = () => {
/>
</div>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Use TLS</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={config.email.smtp_tls !== false}
- onChange={(e) => updateChannelConfig('email', 'smtp_tls', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="flex items-center gap-3">
+ <Switch
+ checked={config.email.smtp_tls !== false}
+ onCheckedChange={(checked) => updateChannelConfig('email', 'smtp_tls', checked)}
+ />
+ <Label>Use TLS</Label>
+ </div>
</div>
</>
)}
{channel.id === 'generic_webhook' && (
<div className="form-group">
- <label>Webhook URL</label>
- <input
+ <Label>Webhook URL</Label>
+ <Input
type="text"
value={config.generic_webhook.url || ''}
onChange={(e) => updateChannelConfig('generic_webhook', 'url', e.target.value)}
@@ -645,14 +632,13 @@ const NotificationsTab = () => {
)}
<div className="form-group">
- <label>Alert Severities</label>
+ <Label>Alert Severities</Label>
<div className="severity-toggles">
{severityOptions.map(severity => (
<label key={severity} className={`severity-toggle ${severity}`}>
- <input
- type="checkbox"
+ <Checkbox
checked={config[channel.id]?.notify_on?.includes(severity) || false}
- onChange={() => toggleSeverity(channel.id, severity)}
+ onCheckedChange={() => toggleSeverity(channel.id, severity)}
/>
<span>{severity.charAt(0).toUpperCase() + severity.slice(1)}</span>
</label>
@@ -661,20 +647,20 @@ const NotificationsTab = () => {
</div>
<div className="channel-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => handleTestChannel(channel.id)}
disabled={testing === channel.id || !config[channel.id]?.enabled}
>
{testing === channel.id ? 'Testing...' : 'Send Test'}
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
+ variant="default"
onClick={() => handleSaveChannel(channel.id)}
disabled={saving}
>
{saving ? 'Saving...' : 'Save'}
- </button>
+ </Button>
</div>
</div>
)}
diff --git a/frontend/src/components/settings/PermissionEditor.jsx b/frontend/src/components/settings/PermissionEditor.jsx
index fbf80f05..d7a377ba 100644
--- a/frontend/src/components/settings/PermissionEditor.jsx
+++ b/frontend/src/components/settings/PermissionEditor.jsx
@@ -1,4 +1,5 @@
import React from 'react';
+import { Checkbox } from '@/components/ui/checkbox';
const PERMISSION_GROUPS = [
{
@@ -72,22 +73,20 @@ const PermissionEditor = ({ permissions = {}, onChange, disabled = false }) => {
<span className="permission-feature-name">
{FEATURE_LABELS[feature]}
</span>
- <label className="permission-checkbox">
- <input
- type="checkbox"
+ <div className="permission-checkbox">
+ <Checkbox
checked={!!featurePerms.read}
- onChange={() => handleToggle(feature, 'read')}
+ onCheckedChange={() => handleToggle(feature, 'read')}
disabled={disabled}
/>
- </label>
- <label className="permission-checkbox">
- <input
- type="checkbox"
+ </div>
+ <div className="permission-checkbox">
+ <Checkbox
checked={!!featurePerms.write}
- onChange={() => handleToggle(feature, 'write')}
+ onCheckedChange={() => handleToggle(feature, 'write')}
disabled={disabled}
/>
- </label>
+ </div>
</div>
);
})}
diff --git a/frontend/src/components/settings/ProfileTab.jsx b/frontend/src/components/settings/ProfileTab.jsx
index 3256a7b4..1746e189 100644
--- a/frontend/src/components/settings/ProfileTab.jsx
+++ b/frontend/src/components/settings/ProfileTab.jsx
@@ -1,5 +1,8 @@
import React, { useState, useEffect } from 'react';
import { useAuth } from '../../contexts/AuthContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
const ProfileTab = () => {
const { user, updateUser } = useAuth();
@@ -49,8 +52,8 @@ const ProfileTab = () => {
<form onSubmit={handleSubmit} className="settings-form">
<div className="form-group">
- <label>Username</label>
- <input
+ <Label>Username</Label>
+ <Input
type="text"
value={formData.username}
onChange={(e) => setFormData({ ...formData, username: e.target.value })}
@@ -59,8 +62,8 @@ const ProfileTab = () => {
</div>
<div className="form-group">
- <label>Email Address</label>
- <input
+ <Label>Email Address</Label>
+ <Input
type="email"
value={formData.email}
onChange={(e) => setFormData({ ...formData, email: e.target.value })}
@@ -69,14 +72,14 @@ const ProfileTab = () => {
</div>
<div className="form-group">
- <label>Role</label>
- <input type="text" value={user?.role || 'user'} disabled className="input-disabled" />
+ <Label>Role</Label>
+ <Input type="text" value={user?.role || 'user'} disabled className="input-disabled" />
<span className="form-help">Contact an administrator to change your role</span>
</div>
<div className="form-group">
- <label>Member Since</label>
- <input
+ <Label>Member Since</Label>
+ <Input
type="text"
value={user?.created_at ? new Date(user.created_at).toLocaleDateString() : '-'}
disabled
@@ -85,9 +88,9 @@ const ProfileTab = () => {
</div>
<div className="form-actions">
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ <Button type="submit" variant="default" disabled={loading}>
{loading ? 'Saving...' : 'Save Changes'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/components/settings/SSOConfigTab.jsx b/frontend/src/components/settings/SSOConfigTab.jsx
index ad99bf96..6f8408a5 100644
--- a/frontend/src/components/settings/SSOConfigTab.jsx
+++ b/frontend/src/components/settings/SSOConfigTab.jsx
@@ -5,6 +5,12 @@ import {
Save, RefreshCw, CheckCircle, XCircle, AlertTriangle, Shield, Globe,
ChevronDown, ChevronUp
} from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Textarea } from '@/components/ui/textarea';
+import { Switch } from '@/components/ui/switch';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const PROVIDERS = [
{ id: 'google', name: 'Google', fields: ['client_id', 'client_secret'] },
@@ -169,33 +175,34 @@ const SSOConfigTab = () => {
<div className="sso-general-form">
<div className="settings-row">
<div className="settings-label">
- <span>Auto-provision users</span>
+ <Label>Auto-provision users</Label>
<span className="settings-hint">Automatically create accounts for new SSO users</span>
</div>
<div className="settings-control">
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={autoProvision}
- onChange={e => setAutoProvision(e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
+ <Switch
+ checked={autoProvision}
+ onCheckedChange={setAutoProvision}
+ />
</div>
</div>
<div className="form-group">
- <label>Default role for new SSO users</label>
- <select value={defaultRole} onChange={e => setDefaultRole(e.target.value)}>
- <option value="viewer">Viewer</option>
- <option value="developer">Developer</option>
- <option value="admin">Admin</option>
- </select>
+ <Label>Default role for new SSO users</Label>
+ <Select value={defaultRole} onValueChange={setDefaultRole}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="viewer">Viewer</SelectItem>
+ <SelectItem value="developer">Developer</SelectItem>
+ <SelectItem value="admin">Admin</SelectItem>
+ </SelectContent>
+ </Select>
</div>
<div className="settings-row">
<div className="settings-label">
- <span>SSO-only mode</span>
+ <Label>SSO-only mode</Label>
<span className="settings-hint">
{forceSso ? (
<span className="text-warning">
@@ -207,20 +214,16 @@ const SSOConfigTab = () => {
</span>
</div>
<div className="settings-control">
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={forceSso}
- onChange={e => setForceSso(e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
+ <Switch
+ checked={forceSso}
+ onCheckedChange={setForceSso}
+ />
</div>
</div>
<div className="form-group">
- <label>Allowed email domains</label>
- <input
+ <Label>Allowed email domains</Label>
+ <Input
type="text"
value={allowedDomains}
onChange={e => setAllowedDomains(e.target.value)}
@@ -229,14 +232,14 @@ const SSOConfigTab = () => {
<span className="form-help">Comma-separated. Leave empty to allow all domains.</span>
</div>
- <button
- className="btn btn-primary"
+ <Button
+ variant="default"
onClick={handleSaveGeneral}
disabled={generalSaving}
>
<Save size={16} />
{generalSaving ? 'Saving...' : 'Save General Settings'}
- </button>
+ </Button>
</div>
</div>
@@ -268,32 +271,28 @@ const SSOConfigTab = () => {
<div className="sso-provider-config__body">
<div className="settings-row">
<div className="settings-label">
- <span>Enable {provider.name}</span>
+ <Label>Enable {provider.name}</Label>
</div>
<div className="settings-control">
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={enabled}
- onChange={e => setFieldValue(provider.id, 'enabled', e.target.checked)}
- />
- <span className="toggle-slider"></span>
- </label>
+ <Switch
+ checked={enabled}
+ onCheckedChange={(checked) => setFieldValue(provider.id, 'enabled', checked)}
+ />
</div>
</div>
{provider.fields.map(field => (
<div key={field} className="form-group">
- <label>{FIELD_LABELS[field] || field}</label>
+ <Label>{FIELD_LABELS[field] || field}</Label>
{field === 'idp_cert' ? (
- <textarea
+ <Textarea
rows={4}
value={getFieldValue(provider.id, field)}
onChange={e => setFieldValue(provider.id, field, e.target.value)}
placeholder={`Enter ${FIELD_LABELS[field]}`}
/>
) : (
- <input
+ <Input
type={field.includes('secret') ? 'password' : 'text'}
value={getFieldValue(provider.id, field)}
onChange={e => setFieldValue(provider.id, field, e.target.value)}
@@ -311,22 +310,22 @@ const SSOConfigTab = () => {
)}
<div className="sso-provider-config__actions">
- <button
- className="btn btn-primary"
+ <Button
+ variant="default"
onClick={() => handleSaveProvider(provider.id)}
disabled={saving[provider.id]}
>
<Save size={16} />
{saving[provider.id] ? 'Saving...' : 'Save'}
- </button>
- <button
- className="btn btn-secondary"
+ </Button>
+ <Button
+ variant="outline"
onClick={() => handleTestProvider(provider.id)}
disabled={testing[provider.id]}
>
<RefreshCw size={16} className={testing[provider.id] ? 'spinning' : ''} />
{testing[provider.id] ? 'Testing...' : 'Test Connection'}
- </button>
+ </Button>
</div>
</div>
)}
diff --git a/frontend/src/components/settings/SecuritySettingsTab.jsx b/frontend/src/components/settings/SecuritySettingsTab.jsx
index 9bb3fc57..d87666ea 100644
--- a/frontend/src/components/settings/SecuritySettingsTab.jsx
+++ b/frontend/src/components/settings/SecuritySettingsTab.jsx
@@ -3,6 +3,10 @@ import { useAuth } from '../../contexts/AuthContext';
import api from '../../services/api';
import SSOProviderIcon from '../SSOProviderIcon';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
const LinkedAccounts = () => {
const { ssoProviders } = useAuth();
@@ -78,13 +82,14 @@ const LinkedAccounts = () => {
<span className="linked-account__email">{identity.provider_email}</span>
</div>
</div>
- <button
- className="btn btn-sm btn-danger"
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleUnlink(identity.provider)}
disabled={unlinking === identity.provider}
>
{unlinking === identity.provider ? 'Unlinking...' : 'Unlink'}
- </button>
+ </Button>
</div>
))}
</div>
@@ -93,15 +98,16 @@ const LinkedAccounts = () => {
{availableToLink.length > 0 && (
<div className="linked-accounts-available">
{availableToLink.map(p => (
- <button
+ <Button
key={p.id}
- className="btn btn-secondary btn-sm"
+ variant="outline"
+ size="sm"
onClick={() => handleLink(p.id)}
disabled={linkingProvider === p.id}
>
<SSOProviderIcon provider={p.id} />
{linkingProvider === p.id ? 'Redirecting...' : `Link ${p.name}`}
- </button>
+ </Button>
))}
</div>
)}
@@ -308,7 +314,7 @@ Keep these codes in a safe place.`;
) : twoFAStatus?.enabled ? (
<div className="two-fa-enabled">
<div className="two-fa-status">
- <span className="badge badge-success">Enabled</span>
+ <Badge variant="success">Enabled</Badge>
<span className="two-fa-info">
Enabled on {new Date(twoFAStatus.confirmed_at).toLocaleDateString()}
</span>
@@ -320,8 +326,8 @@ Keep these codes in a safe place.`;
)}
</div>
<div className="two-fa-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => {
setVerificationCode('');
setTwoFAError('');
@@ -329,9 +335,9 @@ Keep these codes in a safe place.`;
}}
>
Regenerate Backup Codes
- </button>
- <button
- className="btn btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
onClick={() => {
setVerificationCode('');
setTwoFAError('');
@@ -339,7 +345,7 @@ Keep these codes in a safe place.`;
}}
>
Disable 2FA
- </button>
+ </Button>
</div>
</div>
) : (
@@ -348,13 +354,13 @@ Keep these codes in a safe place.`;
Two-factor authentication adds an additional layer of security to your account
by requiring a code from your authenticator app in addition to your password.
</p>
- <button
- className="btn btn-primary"
+ <Button
+ variant="default"
onClick={handleInitiate2FA}
disabled={twoFALoading}
>
Enable Two-Factor Authentication
- </button>
+ </Button>
</div>
)}
</div>
@@ -363,8 +369,8 @@ Keep these codes in a safe place.`;
<h3>Change Password</h3>
<div className="form-group">
- <label>Current Password</label>
- <input
+ <Label>Current Password</Label>
+ <Input
type="password"
value={formData.currentPassword}
onChange={(e) => setFormData({ ...formData, currentPassword: e.target.value })}
@@ -373,8 +379,8 @@ Keep these codes in a safe place.`;
</div>
<div className="form-group">
- <label>New Password</label>
- <input
+ <Label>New Password</Label>
+ <Input
type="password"
value={formData.newPassword}
onChange={(e) => setFormData({ ...formData, newPassword: e.target.value })}
@@ -385,8 +391,8 @@ Keep these codes in a safe place.`;
</div>
<div className="form-group">
- <label>Confirm New Password</label>
- <input
+ <Label>Confirm New Password</Label>
+ <Input
type="password"
value={formData.confirmPassword}
onChange={(e) => setFormData({ ...formData, confirmPassword: e.target.value })}
@@ -396,9 +402,9 @@ Keep these codes in a safe place.`;
</div>
<div className="form-actions">
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ <Button type="submit" variant="default" disabled={loading}>
{loading ? 'Changing...' : 'Change Password'}
- </button>
+ </Button>
</div>
</form>
@@ -417,7 +423,7 @@ Keep these codes in a safe place.`;
<span className="session-details">This device - Active now</span>
</div>
</div>
- <span className="badge badge-success">Current</span>
+ <Badge variant="success">Current</Badge>
</div>
</div>
@@ -456,7 +462,7 @@ Keep these codes in a safe place.`;
<div className="step-content">
<h4>Enter Verification Code</h4>
<p>Enter the 6-digit code from your authenticator app to verify setup.</p>
- <input
+ <Input
type="text"
value={verificationCode}
onChange={(e) => setVerificationCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
@@ -469,16 +475,16 @@ Keep these codes in a safe place.`;
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowSetupModal(false)}>
+ <Button variant="outline" onClick={() => setShowSetupModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
+ variant="default"
onClick={handleConfirm2FA}
disabled={twoFALoading || verificationCode.length !== 6}
>
{twoFALoading ? 'Verifying...' : 'Enable 2FA'}
- </button>
+ </Button>
</div>
</Modal>
)}
@@ -495,8 +501,8 @@ Keep these codes in a safe place.`;
<p>Disabling 2FA will make your account less secure. You will only need your password to log in.</p>
</div>
<div className="form-group">
- <label>Enter a verification code or backup code to disable 2FA:</label>
- <input
+ <Label>Enter a verification code or backup code to disable 2FA:</Label>
+ <Input
type="text"
value={verificationCode}
onChange={(e) => setVerificationCode(e.target.value)}
@@ -506,16 +512,16 @@ Keep these codes in a safe place.`;
{twoFAError && <p className="error-text">{twoFAError}</p>}
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowDisableModal(false)}>
+ <Button variant="outline" onClick={() => setShowDisableModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
onClick={handleDisable2FA}
disabled={twoFALoading || !verificationCode}
>
{twoFALoading ? 'Disabling...' : 'Disable 2FA'}
- </button>
+ </Button>
</div>
</Modal>
)}
@@ -539,27 +545,27 @@ Keep these codes in a safe place.`;
))}
</div>
<div className="backup-codes-actions">
- <button className="btn btn-secondary" onClick={downloadBackupCodes}>
+ <Button variant="outline" onClick={downloadBackupCodes}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/>
</svg>
Download
- </button>
- <button className="btn btn-secondary" onClick={copyBackupCodes}>
+ </Button>
+ <Button variant="outline" onClick={copyBackupCodes}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<rect x="9" y="9" width="13" height="13" rx="2" ry="2"/>
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/>
</svg>
Copy
- </button>
+ </Button>
</div>
</>
) : (
<>
<p>Enter a code from your authenticator app to generate new backup codes. This will invalidate all existing backup codes.</p>
<div className="form-group">
- <label>Verification Code</label>
- <input
+ <Label>Verification Code</Label>
+ <Input
type="text"
value={verificationCode}
onChange={(e) => setVerificationCode(e.target.value.replace(/\D/g, '').slice(0, 6))}
@@ -571,21 +577,21 @@ Keep these codes in a safe place.`;
</>
)}
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => {
+ <Button variant="outline" onClick={() => {
setShowBackupCodesModal(false);
setBackupCodes([]);
setVerificationCode('');
}}>
{backupCodes.length > 0 ? 'Done' : 'Cancel'}
- </button>
+ </Button>
{backupCodes.length === 0 && (
- <button
- className="btn btn-primary"
+ <Button
+ variant="default"
onClick={handleRegenerateBackupCodes}
disabled={twoFALoading || verificationCode.length !== 6}
>
{twoFALoading ? 'Generating...' : 'Generate New Codes'}
- </button>
+ </Button>
)}
</div>
</Modal>
diff --git a/frontend/src/components/settings/SidebarSettings.jsx b/frontend/src/components/settings/SidebarSettings.jsx
index 6b9d0eb8..e59b35ad 100644
--- a/frontend/src/components/settings/SidebarSettings.jsx
+++ b/frontend/src/components/settings/SidebarSettings.jsx
@@ -8,6 +8,7 @@ import {
SIDEBAR_CATEGORIES,
CATEGORY_LABELS
} from '../sidebarItems';
+import { Button } from '@/components/ui/button';
const PRESET_ICONS = {
full: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>,
@@ -190,21 +191,21 @@ const SidebarSettings = () => {
</div>
<div className="sidebar-settings-actions">
- <button
- className="btn btn-ghost"
+ <Button
+ variant="ghost"
onClick={handleReset}
disabled={preset === 'full' && hiddenItems.length === 0}
>
<RotateCcw size={14} />
Reset to Default
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
+ variant="default"
onClick={handleSave}
disabled={saving || !hasChanges}
>
{saving ? 'Saving...' : 'Save Changes'}
- </button>
+ </Button>
</div>
{message && (
diff --git a/frontend/src/components/settings/SiteSettingsTab.jsx b/frontend/src/components/settings/SiteSettingsTab.jsx
index b04ae896..a6aebf72 100644
--- a/frontend/src/components/settings/SiteSettingsTab.jsx
+++ b/frontend/src/components/settings/SiteSettingsTab.jsx
@@ -1,5 +1,7 @@
import React, { useState, useEffect } from 'react';
import api from '../../services/api';
+import { Switch } from '@/components/ui/switch';
+import { Label } from '@/components/ui/label';
const SiteSettingsTab = ({ onDevModeChange }) => {
const [settings, setSettings] = useState({
@@ -65,18 +67,16 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
<p>Allow new users to create accounts on the login page.</p>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable public registration</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={settings.registration_enabled}
- onChange={() => handleToggleSetting('registration_enabled', 'User registration')}
- disabled={saving}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="settings-row">
+ <div className="settings-label">
+ <Label>Enable public registration</Label>
+ </div>
+ <Switch
+ checked={settings.registration_enabled}
+ onCheckedChange={() => handleToggleSetting('registration_enabled', 'User registration')}
+ disabled={saving}
+ />
+ </div>
<span className="form-help">
When disabled, only administrators can create new user accounts.
</span>
@@ -88,18 +88,16 @@ const SiteSettingsTab = ({ onDevModeChange }) => {
<p>Enable developer tools and diagnostics.</p>
<div className="form-group">
- <label className="toggle-switch-label">
- <span>Enable developer mode</span>
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={settings.dev_mode}
- onChange={() => handleToggleSetting('dev_mode', 'Developer mode')}
- disabled={saving}
- />
- <span className="toggle-slider"></span>
- </label>
- </label>
+ <div className="settings-row">
+ <div className="settings-label">
+ <Label>Enable developer mode</Label>
+ </div>
+ <Switch
+ checked={settings.dev_mode}
+ onCheckedChange={() => handleToggleSetting('dev_mode', 'Developer mode')}
+ disabled={saving}
+ />
+ </div>
<span className="form-help">
Enables the Developer tab with icon reference and diagnostic tools.
</span>
diff --git a/frontend/src/components/settings/SystemTab.jsx b/frontend/src/components/settings/SystemTab.jsx
index e4c935a8..80e25d1e 100644
--- a/frontend/src/components/settings/SystemTab.jsx
+++ b/frontend/src/components/settings/SystemTab.jsx
@@ -1,6 +1,8 @@
import React, { useState, useEffect } from 'react';
import { useAuth } from '../../contexts/AuthContext';
import api from '../../services/api';
+import { Button } from '@/components/ui/button';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
function formatBytes(bytes) {
if (!bytes) return '-';
@@ -228,23 +230,27 @@ const SystemTab = () => {
<div className="form-group">
<label>Change Timezone</label>
<div className="timezone-selector">
- <select
- value={selectedTimezone}
- onChange={(e) => setSelectedTimezone(e.target.value)}
- className="form-control"
+ <Select
+ value={selectedTimezone || '__none__'}
+ onValueChange={(val) => setSelectedTimezone(val === '__none__' ? '' : val)}
>
- <option value="">Select timezone...</option>
- {timezones.map((tz) => (
- <option key={tz} value={tz}>{tz}</option>
- ))}
- </select>
- <button
- className="btn btn-primary"
+ <SelectTrigger>
+ <SelectValue placeholder="Select timezone..." />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="__none__">Select timezone...</SelectItem>
+ {timezones.map((tz) => (
+ <SelectItem key={tz} value={tz}>{tz}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
+ <Button
+ variant="default"
onClick={handleTimezoneChange}
disabled={savingTimezone || !selectedTimezone || selectedTimezone === metrics?.time?.timezone_id}
>
{savingTimezone ? 'Saving...' : 'Apply'}
- </button>
+ </Button>
</div>
{timezoneMessage && (
<div className={`timezone-message ${timezoneMessage.type}`}>
diff --git a/frontend/src/components/settings/UserModal.jsx b/frontend/src/components/settings/UserModal.jsx
index cec19333..bce902cd 100644
--- a/frontend/src/components/settings/UserModal.jsx
+++ b/frontend/src/components/settings/UserModal.jsx
@@ -3,6 +3,11 @@ import { useAuth } from '../../contexts/AuthContext';
import api from '../../services/api';
import PermissionEditor from './PermissionEditor';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Checkbox } from '@/components/ui/checkbox';
+import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';
const UserModal = ({ user, onSave, onClose }) => {
const [formData, setFormData] = useState({
@@ -60,6 +65,13 @@ const UserModal = ({ user, onSave, onClose }) => {
}
}
+ function handleRoleChange(newRole) {
+ setFormData(prev => ({ ...prev, role: newRole }));
+ if (templates[newRole]) {
+ setPermissions(templates[newRole]);
+ }
+ }
+
async function handleSubmit(e) {
e.preventDefault();
setError('');
@@ -120,8 +132,8 @@ const UserModal = ({ user, onSave, onClose }) => {
{error && <div className="error-message">{error}</div>}
<div className="form-group">
- <label htmlFor="email">Email</label>
- <input
+ <Label htmlFor="email">Email</Label>
+ <Input
type="email"
id="email"
name="email"
@@ -133,8 +145,8 @@ const UserModal = ({ user, onSave, onClose }) => {
</div>
<div className="form-group">
- <label htmlFor="username">Username</label>
- <input
+ <Label htmlFor="username">Username</Label>
+ <Input
type="text"
id="username"
name="username"
@@ -147,10 +159,10 @@ const UserModal = ({ user, onSave, onClose }) => {
<div className="form-row">
<div className="form-group">
- <label htmlFor="password">
+ <Label htmlFor="password">
{isEditing ? 'New Password (leave blank to keep current)' : 'Password'}
- </label>
- <input
+ </Label>
+ <Input
type="password"
id="password"
name="password"
@@ -162,8 +174,8 @@ const UserModal = ({ user, onSave, onClose }) => {
</div>
<div className="form-group">
- <label htmlFor="confirmPassword">Confirm Password</label>
- <input
+ <Label htmlFor="confirmPassword">Confirm Password</Label>
+ <Input
type="password"
id="confirmPassword"
name="confirmPassword"
@@ -176,18 +188,21 @@ const UserModal = ({ user, onSave, onClose }) => {
</div>
<div className="form-group">
- <label htmlFor="role">Role</label>
- <select
- id="role"
- name="role"
+ <Label htmlFor="role">Role</Label>
+ <Select
value={formData.role}
- onChange={handleChange}
+ onValueChange={handleRoleChange}
disabled={isSelf}
>
- <option value="admin">Admin - Full access</option>
- <option value="developer">Developer - Manage apps and deployments</option>
- <option value="viewer">Viewer - Read-only access</option>
- </select>
+ <SelectTrigger id="role">
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="admin">Admin - Full access</SelectItem>
+ <SelectItem value="developer">Developer - Manage apps and deployments</SelectItem>
+ <SelectItem value="viewer">Viewer - Read-only access</SelectItem>
+ </SelectContent>
+ </Select>
{isSelf && (
<span className="form-help">You cannot change your own role</span>
)}
@@ -195,11 +210,10 @@ const UserModal = ({ user, onSave, onClose }) => {
<div className="form-group">
<label className="checkbox-label">
- <input
- type="checkbox"
+ <Checkbox
name="is_active"
checked={formData.is_active}
- onChange={handleChange}
+ onCheckedChange={(checked) => setFormData(prev => ({ ...prev, is_active: checked }))}
disabled={isSelf}
/>
<span className="checkbox-text">Account is active</span>
@@ -227,9 +241,10 @@ const UserModal = ({ user, onSave, onClose }) => {
{formData.role !== 'admin' && (
<div className="customize-permissions-section">
- <button
+ <Button
type="button"
- className="btn btn-ghost btn-sm"
+ variant="ghost"
+ size="sm"
onClick={() => {
if (!showPermissions && templates[formData.role]) {
setPermissions(templates[formData.role]);
@@ -244,7 +259,7 @@ const UserModal = ({ user, onSave, onClose }) => {
: <polyline points="6 9 12 15 18 9"/>
}
</svg>
- </button>
+ </Button>
{showPermissions && (
<PermissionEditor
permissions={permissions}
@@ -256,12 +271,12 @@ const UserModal = ({ user, onSave, onClose }) => {
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-ghost" onClick={onClose}>
+ <Button type="button" variant="ghost" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" variant="default" disabled={loading}>
{loading ? 'Saving...' : (isEditing ? 'Save Changes' : 'Create User')}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/frontend/src/components/settings/UsersTab.jsx b/frontend/src/components/settings/UsersTab.jsx
index dce4a06f..9120faa9 100644
--- a/frontend/src/components/settings/UsersTab.jsx
+++ b/frontend/src/components/settings/UsersTab.jsx
@@ -4,6 +4,8 @@ import { useAuth } from '../../contexts/AuthContext';
import UserModal from './UserModal';
import InvitationsTab from './InvitationsTab';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
const UsersTab = () => {
const [users, setUsers] = useState([]);
@@ -79,16 +81,11 @@ const UsersTab = () => {
}
}
- function getRoleBadgeClass(role) {
+ function getRoleBadgeVariant(role) {
switch (role) {
- case 'admin':
- return 'badge-danger';
- case 'developer':
- return 'badge-primary';
- case 'viewer':
- return 'badge-secondary';
- default:
- return 'badge-secondary';
+ case 'admin': return 'destructive';
+ case 'developer': return 'default';
+ default: return 'secondary';
}
}
@@ -118,13 +115,13 @@ const UsersTab = () => {
<h3>User Management</h3>
<p>Manage user accounts and permissions</p>
</div>
- <button className="btn btn-primary" onClick={handleAddUser}>
+ <Button variant="default" onClick={handleAddUser}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<line x1="12" y1="5" x2="12" y2="19"/>
<line x1="5" y1="12" x2="19" y2="12"/>
</svg>
Add User
- </button>
+ </Button>
</div>
{error && <div className="error-message">{error}</div>}
@@ -159,9 +156,9 @@ const UsersTab = () => {
</div>
</td>
<td>
- <span className={`badge ${getRoleBadgeClass(user.role)}`}>
+ <Badge variant={getRoleBadgeVariant(user.role)}>
{user.role}
- </span>
+ </Badge>
</td>
<td>
<span className={`status-badge ${user.is_active ? 'active' : 'inactive'}`}>
@@ -171,8 +168,9 @@ const UsersTab = () => {
<td className="date-cell">{formatDate(user.last_login_at)}</td>
<td className="date-cell">{formatDate(user.created_at)}</td>
<td className="actions-cell">
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleEditUser(user)}
title="Edit user"
>
@@ -180,13 +178,15 @@ const UsersTab = () => {
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
- </button>
+ </Button>
{user.id !== currentUser?.id && (
<>
- <button
- className={`btn btn-sm btn-ghost ${user.is_active ? 'text-warning' : 'text-success'}`}
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => handleToggleActive(user)}
title={user.is_active ? 'Disable user' : 'Enable user'}
+ className={user.is_active ? 'text-warning' : 'text-success'}
>
{user.is_active ? (
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
@@ -199,17 +199,19 @@ const UsersTab = () => {
<circle cx="12" cy="12" r="3"/>
</svg>
)}
- </button>
- <button
- className="btn btn-sm btn-ghost text-danger"
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => setDeleteConfirm(user)}
title="Delete user"
+ className="text-destructive hover:text-destructive"
>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<polyline points="3 6 5 6 21 6"/>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
</svg>
- </button>
+ </Button>
</>
)}
</td>
@@ -232,12 +234,12 @@ const UsersTab = () => {
<p>Are you sure you want to delete <strong>{deleteConfirm.username}</strong>?</p>
<p className="text-muted">This action cannot be undone.</p>
<div className="modal-footer">
- <button className="btn btn-ghost" onClick={() => setDeleteConfirm(null)}>
+ <Button variant="ghost" onClick={() => setDeleteConfirm(null)}>
Cancel
- </button>
- <button className="btn btn-danger" onClick={() => handleDeleteUser(deleteConfirm)}>
+ </Button>
+ <Button variant="destructive" onClick={() => handleDeleteUser(deleteConfirm)}>
Delete User
- </button>
+ </Button>
</div>
</Modal>
)}
diff --git a/frontend/src/components/settings/WebhookSubscriptionModal.jsx b/frontend/src/components/settings/WebhookSubscriptionModal.jsx
index ddc1458c..d95ba1e2 100644
--- a/frontend/src/components/settings/WebhookSubscriptionModal.jsx
+++ b/frontend/src/components/settings/WebhookSubscriptionModal.jsx
@@ -1,7 +1,10 @@
import { useState, useEffect } from 'react';
-import { X } from 'lucide-react';
import api from '../../services/api';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Checkbox } from '@/components/ui/checkbox';
const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
const [name, setName] = useState('');
@@ -75,10 +78,9 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
<form onSubmit={handleSubmit}>
<div className="modal-body">
<div className="form-group">
- <label>Name</label>
- <input
+ <Label>Name</Label>
+ <Input
type="text"
- className="form-input"
value={name}
onChange={e => setName(e.target.value)}
placeholder="e.g. Slack Notifications, CI Trigger"
@@ -87,10 +89,9 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
</div>
<div className="form-group">
- <label>Payload URL</label>
- <input
+ <Label>Payload URL</Label>
+ <Input
type="url"
- className="form-input"
value={url}
onChange={e => setUrl(e.target.value)}
placeholder="https://example.com/webhook"
@@ -99,7 +100,7 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
</div>
<div className="form-group">
- <label>Events</label>
+ <Label>Events</Label>
<div className="webhook-modal__events">
{Object.entries(groupedEvents).map(([category, events]) => {
const categoryEvents = events.map(e => e.type);
@@ -107,20 +108,18 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
return (
<div key={category} className="webhook-modal__event-group">
<label className="webhook-modal__category">
- <input
- type="checkbox"
+ <Checkbox
checked={allSelected}
- onChange={() => handleCategoryToggle(category)}
+ onCheckedChange={() => handleCategoryToggle(category)}
/>
<strong>{category}</strong>
</label>
<div className="webhook-modal__event-list">
{events.map(event => (
<label key={event.type} className="webhook-modal__event-item">
- <input
- type="checkbox"
+ <Checkbox
checked={selectedEvents.includes(event.type)}
- onChange={() => handleEventToggle(event.type)}
+ onCheckedChange={() => handleEventToggle(event.type)}
/>
<span className="webhook-modal__event-type">{event.type}</span>
<span className="webhook-modal__event-desc">{event.description}</span>
@@ -135,10 +134,9 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
<div className="form-row">
<div className="form-group">
- <label>Retry Count</label>
- <input
+ <Label>Retry Count</Label>
+ <Input
type="number"
- className="form-input"
value={retryCount}
onChange={e => setRetryCount(parseInt(e.target.value) || 3)}
min={0}
@@ -146,10 +144,9 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
/>
</div>
<div className="form-group">
- <label>Timeout (seconds)</label>
- <input
+ <Label>Timeout (seconds)</Label>
+ <Input
type="number"
- className="form-input"
value={timeoutSeconds}
onChange={e => setTimeoutSeconds(parseInt(e.target.value) || 10)}
min={1}
@@ -159,14 +156,14 @@ const WebhookSubscriptionModal = ({ subscription, onClose, onSubmit }) => {
</div>
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={onClose}>Cancel</button>
- <button
+ <Button type="button" variant="outline" onClick={onClose}>Cancel</Button>
+ <Button
type="submit"
- className="btn btn-primary"
+ variant="default"
disabled={saving || !name.trim() || !url.trim() || selectedEvents.length === 0}
>
{saving ? 'Saving...' : (subscription ? 'Update' : 'Create')}
- </button>
+ </Button>
</div>
</form>
</Modal>
diff --git a/frontend/src/components/settings/WhiteLabelTab.jsx b/frontend/src/components/settings/WhiteLabelTab.jsx
index c85f44d6..04a32c5f 100644
--- a/frontend/src/components/settings/WhiteLabelTab.jsx
+++ b/frontend/src/components/settings/WhiteLabelTab.jsx
@@ -1,6 +1,10 @@
import { useRef } from 'react';
import { useTheme } from '../../contexts/ThemeContext';
import { Star, X, Layers, Image, Type, Upload } from 'lucide-react';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Switch } from '@/components/ui/switch';
const WHITELABEL_MODES = [
{ id: 'image_text', label: 'Logo + Text', icon: Layers, desc: 'Mini logo with brand name' },
@@ -25,18 +29,14 @@ const WhiteLabelTab = () => {
<div className="settings-row">
<div className="settings-label">
- <span>Enable custom branding</span>
+ <Label>Enable custom branding</Label>
<span className="settings-hint">Replaces the sidebar logo, name, and GitHub star link</span>
</div>
<div className="settings-control">
- <label className="toggle-switch">
- <input
- type="checkbox"
- checked={whiteLabel.enabled}
- onChange={(e) => setWhiteLabel({ enabled: e.target.checked })}
- />
- <span className="toggle-slider"></span>
- </label>
+ <Switch
+ checked={whiteLabel.enabled}
+ onCheckedChange={(checked) => setWhiteLabel({ enabled: checked })}
+ />
</div>
</div>
@@ -59,8 +59,8 @@ const WhiteLabelTab = () => {
<div className="whitelabel-fields">
{whiteLabel.mode !== 'image_full' && (
<div className="form-group">
- <label>Brand Name</label>
- <input
+ <Label>Brand Name</Label>
+ <Input
type="text"
value={whiteLabel.brandName}
onChange={(e) => setWhiteLabel({ brandName: e.target.value })}
@@ -72,17 +72,18 @@ const WhiteLabelTab = () => {
{whiteLabel.mode !== 'text_only' && (
<div className="form-group">
- <label>Logo Image</label>
+ <Label>Logo Image</Label>
<div className="whitelabel-upload" onClick={() => logoInputRef.current?.click()}>
{whiteLabel.logoData ? (
<div className="whitelabel-logo-preview">
<img src={whiteLabel.logoData} alt="Logo preview" />
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={(e) => { e.stopPropagation(); setWhiteLabel({ logoData: '' }); }}
>
<X size={12} /> Remove
- </button>
+ </Button>
</div>
) : (
<div className="whitelabel-upload__placeholder">
diff --git a/frontend/src/components/workflow/ConfigPanel.jsx b/frontend/src/components/workflow/ConfigPanel.jsx
index be050b36..6229dd7f 100644
--- a/frontend/src/components/workflow/ConfigPanel.jsx
+++ b/frontend/src/components/workflow/ConfigPanel.jsx
@@ -1,5 +1,6 @@
import React, { useEffect, useCallback } from 'react';
import { X } from 'lucide-react';
+import { Button } from '@/components/ui/button';
const ConfigPanel = ({
isOpen,
@@ -38,9 +39,9 @@ const ConfigPanel = ({
)}
<h3>{title}</h3>
</div>
- <button className="config-panel-close" onClick={onClose}>
+ <Button variant="ghost" size="icon" className="config-panel-close" onClick={onClose}>
<X size={18} />
- </button>
+ </Button>
</div>
<div className="config-panel-body">
diff --git a/frontend/src/components/workflow/WorkflowListModal.jsx b/frontend/src/components/workflow/WorkflowListModal.jsx
index 4f4d4d87..4228ddf0 100644
--- a/frontend/src/components/workflow/WorkflowListModal.jsx
+++ b/frontend/src/components/workflow/WorkflowListModal.jsx
@@ -1,7 +1,8 @@
import React, { useState, useEffect } from 'react';
-import { X, Trash2, Clock, Layers, GitBranch, Loader } from 'lucide-react';
+import { Trash2, Clock, Layers, GitBranch, Loader } from 'lucide-react';
import api from '../../services/api';
import Modal from '../Modal';
+import { Button } from '@/components/ui/button';
const WorkflowListModal = ({ onLoad, onClose }) => {
const [workflows, setWorkflows] = useState([]);
@@ -76,7 +77,7 @@ const WorkflowListModal = ({ onLoad, onClose }) => {
) : error ? (
<div className="workflow-list-error">
<span>{error}</span>
- <button onClick={loadWorkflows}>Retry</button>
+ <Button variant="outline" size="sm" onClick={loadWorkflows}>Retry</Button>
</div>
) : workflows.length === 0 ? (
<div className="workflow-list-empty">
@@ -114,7 +115,9 @@ const WorkflowListModal = ({ onLoad, onClose }) => {
{formatDate(workflow.updated_at)}
</div>
</div>
- <button
+ <Button
+ variant="ghost"
+ size="icon"
className="workflow-item-delete"
onClick={(e) => handleDelete(e, workflow)}
disabled={deletingId === workflow.id}
@@ -125,7 +128,7 @@ const WorkflowListModal = ({ onLoad, onClose }) => {
) : (
<Trash2 size={16} />
)}
- </button>
+ </Button>
</div>
))}
</div>
diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsx
index 09042a85..50a10832 100644
--- a/frontend/src/pages/AgentFleet.jsx
+++ b/frontend/src/pages/AgentFleet.jsx
@@ -27,6 +27,9 @@ import {
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
const AgentFleet = () => {
const [activeTab, setActiveTab] = useState('dashboard');
@@ -179,15 +182,15 @@ const AgentFleet = () => {
}
};
- const rolloutStatusBadge = (status) => {
+ const rolloutStatusVariant = (status) => {
const map = {
- running: 'badge-info',
- completed: 'badge-success',
- failed: 'badge-error',
- cancelled: 'badge-warning',
- pending: 'badge-default'
+ running: 'info',
+ completed: 'success',
+ failed: 'destructive',
+ cancelled: 'warning',
+ pending: 'secondary'
};
- return map[status] || 'badge-default';
+ return map[status] || 'secondary';
};
return (
@@ -198,14 +201,10 @@ const AgentFleet = () => {
<p>Monitor health, manage versions, and control updates across your infrastructure.</p>
</div>
<div className="header-actions">
- <button
- className="btn btn-primary"
- onClick={fetchData}
- disabled={loading}
- >
+ <Button onClick={fetchData} disabled={loading}>
<RefreshCw size={18} className={loading ? 'animate-spin' : ''} />
Refresh
- </button>
+ </Button>
</div>
</div>
@@ -227,10 +226,10 @@ const AgentFleet = () => {
<tab.icon size={18} />
{tab.label}
{tab.key === 'approvals' && pendingServers.length > 0 && (
- <span className="badge badge-error ml-2">{pendingServers.length}</span>
+ <Badge variant="destructive" className="ml-2">{pendingServers.length}</Badge>
)}
{tab.key === 'queue' && queuedCommands.length > 0 && (
- <span className="badge badge-warning ml-2">{queuedCommands.length}</span>
+ <Badge variant="warning" className="ml-2">{queuedCommands.length}</Badge>
)}
</button>
))}
@@ -356,9 +355,9 @@ const AgentFleet = () => {
<div className="card">
<div className="card-header flex justify-between items-center">
<h2>Agent Versions</h2>
- <button className="btn btn-sm btn-primary">
+ <Button size="sm">
<Plus size={16} /> Add Version
- </button>
+ </Button>
</div>
<div className="overflow-x-auto">
<table className="table">
@@ -377,9 +376,9 @@ const AgentFleet = () => {
<tr key={v.id}>
<td className="font-semibold">v{v.version}</td>
<td>
- <span className={`badge ${v.channel === 'stable' ? 'badge-success' : 'badge-warning'}`}>
+ <Badge variant={v.channel === 'stable' ? 'success' : 'warning'}>
{v.channel}
- </span>
+ </Badge>
</td>
<td>{new Date(v.published_at).toLocaleDateString()}</td>
<td>{v.min_panel_version || 'Any'} - {v.max_panel_version || 'Latest'}</td>
@@ -390,8 +389,8 @@ const AgentFleet = () => {
</span>
</td>
<td className="actions">
- <button className="btn btn-ghost btn-sm" title="Edit"><RefreshCw size={14} /></button>
- <button className="btn btn-ghost btn-sm text-red-600" title="Delete"><Trash2 size={14} /></button>
+ <Button variant="ghost" size="sm" title="Edit"><RefreshCw size={14} /></Button>
+ <Button variant="ghost" size="sm" className="text-red-600" title="Delete"><Trash2 size={14} /></Button>
</td>
</tr>
))}
@@ -455,9 +454,8 @@ const AgentFleet = () => {
<>
<div className="form-group">
<label>Batch Size</label>
- <input
+ <Input
type="number"
- className="form-input w-full"
value={rolloutBatchSize}
onChange={e => setRolloutBatchSize(parseInt(e.target.value) || 5)}
min={1}
@@ -465,9 +463,8 @@ const AgentFleet = () => {
</div>
<div className="form-group">
<label>Delay (minutes)</label>
- <input
+ <Input
type="number"
- className="form-input w-full"
value={rolloutDelay}
onChange={e => setRolloutDelay(parseInt(e.target.value) || 10)}
min={1}
@@ -477,13 +474,9 @@ const AgentFleet = () => {
)}
</div>
<div className="mt-6 flex justify-end">
- <button
- className="btn btn-primary"
- onClick={triggerUpgrade}
- disabled={!selectedVersion}
- >
+ <Button onClick={triggerUpgrade} disabled={!selectedVersion}>
<Play size={18} /> Start Rollout
- </button>
+ </Button>
</div>
</div>
</div>
@@ -527,20 +520,22 @@ const AgentFleet = () => {
</div>
</td>
<td>
- <span className={`badge ${rolloutStatusBadge(r.status)}`}>
+ <Badge variant={rolloutStatusVariant(r.status)}>
{r.status}
- </span>
+ </Badge>
</td>
<td className="text-sm">{r.started_at ? new Date(r.started_at).toLocaleString() : '-'}</td>
<td className="actions">
{r.status === 'running' && (
- <button
- className="btn btn-sm btn-ghost text-red-600"
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-red-600"
onClick={() => cancelRollout(r.id)}
title="Cancel Rollout"
>
<XCircle size={14} /> Cancel
- </button>
+ </Button>
)}
{r.error && (
<span className="text-xs text-red-500" title={r.error}>
@@ -594,13 +589,14 @@ const AgentFleet = () => {
</td>
<td className="text-sm">{new Date(cmd.created_at).toLocaleString()}</td>
<td className="actions">
- <button
- className="btn btn-sm btn-ghost"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => retryCommand(cmd.id)}
title="Retry now"
>
<RotateCcw size={14} /> Retry
- </button>
+ </Button>
</td>
</tr>
))}
@@ -621,14 +617,10 @@ const AgentFleet = () => {
<div className="space-y-6">
<div className="flex justify-between items-center">
<h2>Network Discovery</h2>
- <button
- className="btn btn-primary"
- onClick={startDiscovery}
- disabled={isScanning}
- >
+ <Button onClick={startDiscovery} disabled={isScanning}>
{isScanning ? <RefreshCw size={18} className="animate-spin" /> : <Search size={18} />}
{isScanning ? 'Scanning...' : 'Start Scan'}
- </button>
+ </Button>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
@@ -640,9 +632,9 @@ const AgentFleet = () => {
<Server size={20} />
</div>
{agent.is_registered ? (
- <span className="badge badge-success">Registered</span>
+ <Badge variant="success">Registered</Badge>
) : (
- <span className="badge badge-warning">New</span>
+ <Badge variant="warning">New</Badge>
)}
</div>
<h3 className="font-bold">{agent.hostname}</h3>
@@ -660,17 +652,19 @@ const AgentFleet = () => {
</div>
<div className="mt-4 pt-4 border-t">
{agent.is_registered ? (
- <button
- className="btn btn-sm btn-ghost w-full"
+ <Button
+ variant="ghost"
+ size="sm"
+ className="w-full"
onClick={() => {
setActiveTab('dashboard');
loadDiagnostics(agent.server_id);
}}
>
View Details
- </button>
+ </Button>
) : (
- <button className="btn btn-sm btn-primary w-full">Add to Fleet</button>
+ <Button size="sm" className="w-full">Add to Fleet</Button>
)}
</div>
</div>
@@ -710,18 +704,21 @@ const AgentFleet = () => {
<td>{new Date(server.created_at).toLocaleString()}</td>
<td>v{server.agent_version || 'Unknown'}</td>
<td className="actions">
- <button
- className="btn btn-sm btn-success flex items-center gap-1"
+ <Button
+ size="sm"
+ className="flex items-center gap-1"
onClick={() => approveAgent(server.id)}
>
<CheckCircle size={14} /> Approve
- </button>
- <button
- className="btn btn-sm btn-ghost text-red-600"
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
+ className="text-red-600"
onClick={() => rejectAgent(server.id)}
>
<XCircle size={14} /> Reject
- </button>
+ </Button>
</td>
</tr>
))}
@@ -746,9 +743,9 @@ const AgentFleet = () => {
<h2 className="text-lg font-semibold">
Agent Diagnostics - {diagnostics.server_name}
</h2>
- <button className="btn btn-ghost btn-sm" onClick={() => setDiagnostics(null)}>
+ <Button variant="ghost" size="sm" onClick={() => setDiagnostics(null)}>
<XCircle size={18} />
- </button>
+ </Button>
</div>
<div className="p-6 space-y-6">
<div className="grid grid-cols-2 gap-4">
diff --git a/frontend/src/pages/AgentPlugins.jsx b/frontend/src/pages/AgentPlugins.jsx
index e4268f28..add23394 100644
--- a/frontend/src/pages/AgentPlugins.jsx
+++ b/frontend/src/pages/AgentPlugins.jsx
@@ -5,6 +5,11 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
const AgentPlugins = () => {
const navigate = useNavigate();
@@ -128,9 +133,9 @@ const AgentPlugins = () => {
<option value="deprecated">Deprecated</option>
</select>
{user?.is_admin && (
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
Register Plugin
- </button>
+ </Button>
)}
</div>
</div>
@@ -143,9 +148,9 @@ const AgentPlugins = () => {
<h3>{plugin.display_name}</h3>
<span className="plugin-card__version">v{plugin.version}</span>
</div>
- <span className={`badge badge--${plugin.status === 'available' ? 'success' : 'warning'}`}>
+ <Badge variant={plugin.status === 'available' ? 'success' : 'warning'}>
{plugin.status}
- </span>
+ </Badge>
</div>
{plugin.description && (
<p className="plugin-card__desc">{plugin.description}</p>
@@ -156,22 +161,22 @@ const AgentPlugins = () => {
</div>
<div className="plugin-card__capabilities">
{(plugin.capabilities || []).map(cap => (
- <span key={cap} className="badge badge--outline">{capabilityLabels[cap] || cap}</span>
+ <Badge key={cap} variant="outline">{capabilityLabels[cap] || cap}</Badge>
))}
</div>
<div className="plugin-card__permissions">
{(plugin.permissions || []).map(perm => (
- <span key={perm} className="badge badge--subtle">{permissionLabels[perm] || perm}</span>
+ <Badge key={perm} variant="secondary">{permissionLabels[perm] || perm}</Badge>
))}
</div>
<div className="plugin-card__actions">
- <button className="btn btn-sm btn-primary" onClick={() => { setSelectedPlugin(plugin); setShowInstallModal(true); }}>
+ <Button size="sm" onClick={() => { setSelectedPlugin(plugin); setShowInstallModal(true); }}>
Install
- </button>
+ </Button>
{user?.is_admin && (
- <button className="btn btn-sm btn-danger" onClick={() => setDeleteConfirm(plugin)}>
+ <Button size="sm" variant="destructive" onClick={() => setDeleteConfirm(plugin)}>
Delete
- </button>
+ </Button>
)}
</div>
</div>
@@ -193,27 +198,27 @@ const AgentPlugins = () => {
</div>
<div className="modal-body">
<div className="form-group">
- <label>Plugin Name (identifier)</label>
- <input className="form-input" value={newPlugin.name} onChange={e => setNewPlugin({...newPlugin, name: e.target.value})} placeholder="my-plugin" />
+ <Label>Plugin Name (identifier)</Label>
+ <Input value={newPlugin.name} onChange={e => setNewPlugin({...newPlugin, name: e.target.value})} placeholder="my-plugin" />
</div>
<div className="form-group">
- <label>Display Name</label>
- <input className="form-input" value={newPlugin.display_name} onChange={e => setNewPlugin({...newPlugin, display_name: e.target.value})} placeholder="My Plugin" />
+ <Label>Display Name</Label>
+ <Input value={newPlugin.display_name} onChange={e => setNewPlugin({...newPlugin, display_name: e.target.value})} placeholder="My Plugin" />
</div>
<div className="form-group">
- <label>Version</label>
- <input className="form-input" value={newPlugin.version} onChange={e => setNewPlugin({...newPlugin, version: e.target.value})} />
+ <Label>Version</Label>
+ <Input value={newPlugin.version} onChange={e => setNewPlugin({...newPlugin, version: e.target.value})} />
</div>
<div className="form-group">
- <label>Description</label>
- <textarea className="form-input" value={newPlugin.description} onChange={e => setNewPlugin({...newPlugin, description: e.target.value})} rows={3} />
+ <Label>Description</Label>
+ <Textarea value={newPlugin.description} onChange={e => setNewPlugin({...newPlugin, description: e.target.value})} rows={3} />
</div>
<div className="form-group">
- <label>Author</label>
- <input className="form-input" value={newPlugin.author} onChange={e => setNewPlugin({...newPlugin, author: e.target.value})} />
+ <Label>Author</Label>
+ <Input value={newPlugin.author} onChange={e => setNewPlugin({...newPlugin, author: e.target.value})} />
</div>
<div className="form-group">
- <label>Capabilities</label>
+ <Label>Capabilities</Label>
<div className="checkbox-group">
{Object.entries(capabilityLabels).map(([key, label]) => (
<label key={key} className="checkbox-label">
@@ -224,7 +229,7 @@ const AgentPlugins = () => {
</div>
</div>
<div className="form-group">
- <label>Permissions</label>
+ <Label>Permissions</Label>
<div className="checkbox-group">
{Object.entries(permissionLabels).map(([key, label]) => (
<label key={key} className="checkbox-label">
@@ -236,18 +241,18 @@ const AgentPlugins = () => {
</div>
<div className="form-row">
<div className="form-group">
- <label>Max Memory (MB)</label>
- <input className="form-input" type="number" value={newPlugin.max_memory_mb} onChange={e => setNewPlugin({...newPlugin, max_memory_mb: parseInt(e.target.value) || 128})} />
+ <Label>Max Memory (MB)</Label>
+ <Input type="number" value={newPlugin.max_memory_mb} onChange={e => setNewPlugin({...newPlugin, max_memory_mb: parseInt(e.target.value) || 128})} />
</div>
<div className="form-group">
- <label>Max CPU (%)</label>
- <input className="form-input" type="number" value={newPlugin.max_cpu_percent} onChange={e => setNewPlugin({...newPlugin, max_cpu_percent: parseInt(e.target.value) || 10})} />
+ <Label>Max CPU (%)</Label>
+ <Input type="number" value={newPlugin.max_cpu_percent} onChange={e => setNewPlugin({...newPlugin, max_cpu_percent: parseInt(e.target.value) || 10})} />
</div>
</div>
</div>
<div className="modal-footer">
- <button className="btn" onClick={() => setShowCreateModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleCreate} disabled={!newPlugin.name || !newPlugin.display_name}>Register</button>
+ <Button variant="outline" onClick={() => setShowCreateModal(false)}>Cancel</Button>
+ <Button onClick={handleCreate} disabled={!newPlugin.name || !newPlugin.display_name}>Register</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/ApplicationDetail.jsx b/frontend/src/pages/ApplicationDetail.jsx
index 67474597..d625f8ef 100644
--- a/frontend/src/pages/ApplicationDetail.jsx
+++ b/frontend/src/pages/ApplicationDetail.jsx
@@ -10,6 +10,11 @@ import EnvironmentVariables from '../components/EnvironmentVariables';
import PrivateURLSection from '../components/PrivateURLSection';
import LinkedAppsSection from '../components/LinkedAppsSection';
import LinkAppModal from '../components/LinkAppModal';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['overview', 'environment', 'packages', 'gunicorn', 'commands', 'build', 'deploy', 'logs', 'settings'];
@@ -97,9 +102,9 @@ const ApplicationDetail = () => {
return (
<div className="empty-state">
<h3>Application not found</h3>
- <button className="btn btn-primary" onClick={() => navigate('/apps')}>
+ <Button onClick={() => navigate('/apps')}>
Back to Applications
- </button>
+ </Button>
</div>
);
}
@@ -119,45 +124,46 @@ const ApplicationDetail = () => {
</div>
<div className="app-detail-actions">
{app.port && (
- <a
- href={`http://localhost:${app.port}`}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-ghost"
- >
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
- <polyline points="15 3 21 3 21 9"/>
- <line x1="10" y1="14" x2="21" y2="3"/>
- </svg>
- Open App
- </a>
+ <Button variant="ghost" asChild>
+ <a
+ href={`http://localhost:${app.port}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/>
+ <polyline points="15 3 21 3 21 9"/>
+ <line x1="10" y1="14" x2="21" y2="3"/>
+ </svg>
+ Open App
+ </a>
+ </Button>
)}
{isRunning && (
<>
- <button className="btn btn-ghost" onClick={() => handleAction('restart')}>
+ <Button variant="ghost" onClick={() => handleAction('restart')}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<polyline points="23 4 23 10 17 10"/>
<polyline points="1 20 1 14 7 14"/>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
</svg>
Restart
- </button>
- <button className="btn btn-danger-outline" onClick={() => handleAction('stop')}>
+ </Button>
+ <Button variant="outline" onClick={() => handleAction('stop')}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<rect x="6" y="6" width="12" height="12"/>
</svg>
Stop
- </button>
+ </Button>
</>
)}
{!isRunning && (
- <button className="btn btn-primary" onClick={() => handleAction('start')}>
+ <Button onClick={() => handleAction('start')}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
<polygon points="5 3 19 12 5 21 5 3"/>
</svg>
Start
- </button>
+ </Button>
)}
</div>
</div>
@@ -192,79 +198,58 @@ const ApplicationDetail = () => {
</div>
{/* Tabs */}
- <div className="app-detail-tabs">
- <div
- className={`app-detail-tab ${activeTab === 'overview' ? 'active' : ''}`}
- onClick={() => setActiveTab('overview')}
- >
- Overview
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'environment' ? 'active' : ''}`}
- onClick={() => setActiveTab('environment')}
- >
- Environment
- </div>
- {isPythonApp && (
- <>
- <div
- className={`app-detail-tab ${activeTab === 'packages' ? 'active' : ''}`}
- onClick={() => setActiveTab('packages')}
- >
- Packages
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'gunicorn' ? 'active' : ''}`}
- onClick={() => setActiveTab('gunicorn')}
- >
- Gunicorn
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'commands' ? 'active' : ''}`}
- onClick={() => setActiveTab('commands')}
- >
- Commands
- </div>
- </>
- )}
- <div
- className={`app-detail-tab ${activeTab === 'build' ? 'active' : ''}`}
- onClick={() => setActiveTab('build')}
- >
- Build
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'deploy' ? 'active' : ''}`}
- onClick={() => setActiveTab('deploy')}
- >
- Deploy
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'logs' ? 'active' : ''}`}
- onClick={() => setActiveTab('logs')}
- >
- Logs
- </div>
- <div
- className={`app-detail-tab ${activeTab === 'settings' ? 'active' : ''}`}
- onClick={() => setActiveTab('settings')}
- >
- Settings
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList className="app-detail-tabs">
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="environment">Environment</TabsTrigger>
+ {isPythonApp && (
+ <>
+ <TabsTrigger value="packages">Packages</TabsTrigger>
+ <TabsTrigger value="gunicorn">Gunicorn</TabsTrigger>
+ <TabsTrigger value="commands">Commands</TabsTrigger>
+ </>
+ )}
+ <TabsTrigger value="build">Build</TabsTrigger>
+ <TabsTrigger value="deploy">Deploy</TabsTrigger>
+ <TabsTrigger value="logs">Logs</TabsTrigger>
+ <TabsTrigger value="settings">Settings</TabsTrigger>
+ </TabsList>
+
+ {/* Tab Content */}
+ <div className="app-detail-content">
+ <TabsContent value="overview">
+ <OverviewTab app={app} onUpdate={loadApp} />
+ </TabsContent>
+ <TabsContent value="environment">
+ <EnvironmentVariables appId={app.id} />
+ </TabsContent>
+ {isPythonApp && (
+ <>
+ <TabsContent value="packages">
+ <PackagesTab appId={app.id} />
+ </TabsContent>
+ <TabsContent value="gunicorn">
+ <GunicornTab appId={app.id} />
+ </TabsContent>
+ <TabsContent value="commands">
+ <CommandsTab appId={app.id} appType={app.app_type} />
+ </TabsContent>
+ </>
+ )}
+ <TabsContent value="build">
+ <BuildTab appId={app.id} appPath={app.path} />
+ </TabsContent>
+ <TabsContent value="deploy">
+ <DeployTab appId={app.id} appPath={app.path} />
+ </TabsContent>
+ <TabsContent value="logs">
+ <LogsTab app={app} />
+ </TabsContent>
+ <TabsContent value="settings">
+ <SettingsTab app={app} onUpdate={loadApp} />
+ </TabsContent>
</div>
- </div>
-
- {/* Tab Content */}
- <div className="app-detail-content">
- {activeTab === 'overview' && <OverviewTab app={app} onUpdate={loadApp} />}
- {activeTab === 'environment' && <EnvironmentVariables appId={app.id} />}
- {activeTab === 'packages' && isPythonApp && <PackagesTab appId={app.id} />}
- {activeTab === 'gunicorn' && isPythonApp && <GunicornTab appId={app.id} />}
- {activeTab === 'commands' && isPythonApp && <CommandsTab appId={app.id} appType={app.app_type} />}
- {activeTab === 'build' && <BuildTab appId={app.id} appPath={app.path} />}
- {activeTab === 'deploy' && <DeployTab appId={app.id} appPath={app.path} />}
- {activeTab === 'logs' && <LogsTab app={app} />}
- {activeTab === 'settings' && <SettingsTab app={app} onUpdate={loadApp} />}
- </div>
+ </Tabs>
</div>
);
};
@@ -581,13 +566,14 @@ const RoutingDiagnosticsPanel = ({ appId }) => {
<div className="app-panel">
<div className="app-panel-header">
<span>Routing Diagnostics</span>
- <button
- className="btn btn-ghost btn-sm"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={runDiagnostics}
disabled={loading}
>
{loading ? 'Checking...' : 'Run Diagnostics'}
- </button>
+ </Button>
</div>
<div className="app-panel-body">
{diagnostics ? (
@@ -691,21 +677,21 @@ const PackagesTab = ({ appId }) => {
<div>
<div className="section-header">
<h3>Installed Packages</h3>
- <button className="btn btn-secondary btn-sm" onClick={handleFreeze}>
+ <Button variant="outline" size="sm" onClick={handleFreeze}>
Freeze to requirements.txt
- </button>
+ </Button>
</div>
<form className="install-form" onSubmit={handleInstall}>
- <input
+ <Input
type="text"
value={newPackage}
onChange={(e) => setNewPackage(e.target.value)}
placeholder="Package name (e.g., requests, flask==2.0.0)"
/>
- <button type="submit" className="btn btn-primary" disabled={installing}>
+ <Button type="submit" disabled={installing}>
{installing ? 'Installing...' : 'Install'}
- </button>
+ </Button>
</form>
<div className="packages-list">
@@ -762,9 +748,9 @@ const GunicornTab = ({ appId }) => {
<div>
<div className="section-header">
<h3>Gunicorn Configuration</h3>
- <button className="btn btn-primary" onClick={handleSave} disabled={saving}>
+ <Button onClick={handleSave} disabled={saving}>
{saving ? 'Saving...' : 'Save'}
- </button>
+ </Button>
</div>
<textarea
className="code-editor"
@@ -818,32 +804,32 @@ const CommandsTab = ({ appId, appType }) => {
<div className="quick-commands">
{quickCommands.map(({ label, cmd }) => (
- <button
+ <Button
key={cmd}
- className="btn btn-secondary btn-sm"
+ variant="outline"
+ size="sm"
onClick={() => handleRun(cmd)}
disabled={running}
>
{label}
- </button>
+ </Button>
))}
</div>
<div className="command-input">
- <input
+ <Input
type="text"
value={command}
onChange={(e) => setCommand(e.target.value)}
placeholder="Enter command..."
onKeyDown={(e) => e.key === 'Enter' && handleRun()}
/>
- <button
- className="btn btn-primary"
+ <Button
onClick={() => handleRun()}
disabled={running}
>
{running ? 'Running...' : 'Run'}
- </button>
+ </Button>
</div>
{output && (
@@ -1003,15 +989,15 @@ const BuildTab = ({ appId, appPath }) => {
}
}
- function getStatusBadgeClass(status) {
+ function getStatusBadgeVariant(status) {
switch (status) {
- case 'live': return 'badge-success';
+ case 'live': return 'success';
case 'building':
case 'deploying':
- case 'pending': return 'badge-warning';
- case 'failed': return 'badge-danger';
- case 'rolled_back': return 'badge-secondary';
- default: return 'badge-default';
+ case 'pending': return 'warning';
+ case 'failed': return 'destructive';
+ case 'rolled_back': return 'secondary';
+ default: return 'default';
}
}
@@ -1061,9 +1047,9 @@ const BuildTab = ({ appId, appPath }) => {
<div className="card">
<div className="card-header-row">
<h3>Build Configuration</h3>
- <button className="btn btn-secondary btn-sm" onClick={() => setShowConfigModal(true)}>
+ <Button variant="outline" size="sm" onClick={() => setShowConfigModal(true)}>
Configure
- </button>
+ </Button>
</div>
{buildConfig ? (
<div className="info-list">
@@ -1080,20 +1066,19 @@ const BuildTab = ({ appId, appPath }) => {
<p className="hint">No build configuration. Click Configure to set up.</p>
)}
<div className="card-actions">
- <button
- className="btn btn-primary"
+ <Button
onClick={() => handleDeploy(false)}
disabled={deploying || building}
>
{deploying ? 'Deploying...' : 'Build & Deploy'}
- </button>
- <button
- className="btn btn-secondary"
+ </Button>
+ <Button
+ variant="outline"
onClick={() => handleBuild(false)}
disabled={building || deploying}
>
{building ? 'Building...' : 'Build Only'}
- </button>
+ </Button>
</div>
</div>
@@ -1105,20 +1090,21 @@ const BuildTab = ({ appId, appPath }) => {
<div key={dep.version} className={`deployment-item ${dep.status === 'live' ? 'current' : ''}`}>
<div className="deployment-info">
<span className="deployment-version">v{dep.version}</span>
- <span className={`badge ${getStatusBadgeClass(dep.status)}`}>{dep.status}</span>
+ <Badge variant={getStatusBadgeVariant(dep.status)}>{dep.status}</Badge>
</div>
<div className="deployment-meta">
<span>{new Date(dep.created_at).toLocaleString()}</span>
<span>{formatDuration(dep.build_duration)}</span>
</div>
{dep.status !== 'live' && (
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleRollback(dep.version)}
disabled={deploying}
>
Rollback
- </button>
+ </Button>
)}
</div>
))}
@@ -1149,7 +1135,7 @@ const BuildTab = ({ appId, appPath }) => {
{configForm.buildMethod === 'dockerfile' && (
<div className="form-group">
<label>Dockerfile Path</label>
- <input
+ <Input
type="text"
value={configForm.dockerfilePath}
onChange={e => setConfigForm({...configForm, dockerfilePath: e.target.value})}
@@ -1160,7 +1146,7 @@ const BuildTab = ({ appId, appPath }) => {
<>
<div className="form-group">
<label>Build Command</label>
- <input
+ <Input
type="text"
value={configForm.customBuildCmd}
onChange={e => setConfigForm({...configForm, customBuildCmd: e.target.value})}
@@ -1169,7 +1155,7 @@ const BuildTab = ({ appId, appPath }) => {
</div>
<div className="form-group">
<label>Start Command</label>
- <input
+ <Input
type="text"
value={configForm.customStartCmd}
onChange={e => setConfigForm({...configForm, customStartCmd: e.target.value})}
@@ -1180,19 +1166,19 @@ const BuildTab = ({ appId, appPath }) => {
)}
<div className="form-group">
<label>Timeout (seconds)</label>
- <input
+ <Input
type="number"
value={configForm.timeout}
onChange={e => setConfigForm({...configForm, timeout: parseInt(e.target.value)})}
/>
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={() => setShowConfigModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowConfigModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary">
+ </Button>
+ <Button type="submit">
Save Configuration
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1268,9 +1254,9 @@ const LogsTab = ({ app }) => {
/>
Auto-refresh
</label>
- <button className="btn btn-secondary btn-sm" onClick={loadLogs}>
+ <Button variant="outline" size="sm" onClick={loadLogs}>
Refresh
- </button>
+ </Button>
</div>
</div>
<pre className="log-viewer">{loading ? 'Loading...' : logs}</pre>
@@ -1386,13 +1372,13 @@ const SettingsTab = ({ app, onUpdate }) => {
</span>
</div>
<div className="settings-control">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleUnlink}
disabled={unlinking}
>
{unlinking ? 'Unlinking...' : 'Unlink Application'}
- </button>
+ </Button>
</div>
</div>
)}
@@ -1401,13 +1387,13 @@ const SettingsTab = ({ app, onUpdate }) => {
<div className="card danger-zone">
<h4>Danger Zone</h4>
<p>Once you delete an application, there is no going back.</p>
- <button
- className="btn btn-danger"
+ <Button
+ variant="destructive"
onClick={handleDelete}
disabled={deleting}
>
{deleting ? 'Deleting...' : 'Delete Application'}
- </button>
+ </Button>
</div>
<ConfirmDialog
isOpen={confirmAppSettingsState.isOpen}
@@ -1548,12 +1534,12 @@ const DeployTab = ({ appId, appPath }) => {
}
}
- function getStatusBadgeClass(status) {
+ function getStatusBadgeVariant(status) {
switch (status) {
- case 'success': return 'badge-success';
- case 'failed': return 'badge-danger';
- case 'in_progress': return 'badge-warning';
- default: return 'badge-secondary';
+ case 'success': return 'success';
+ case 'failed': return 'destructive';
+ case 'in_progress': return 'warning';
+ default: return 'secondary';
}
}
@@ -1580,9 +1566,9 @@ const DeployTab = ({ appId, appPath }) => {
</svg>
<h3>Git Deployment Not Configured</h3>
<p>Connect a Git repository to enable automatic deployments via webhooks or manual triggers.</p>
- <button className="btn btn-primary" onClick={() => setShowConfigModal(true)}>
+ <Button onClick={() => setShowConfigModal(true)}>
Configure Deployment
- </button>
+ </Button>
</div>
</div>
) : (
@@ -1599,20 +1585,20 @@ const DeployTab = ({ appId, appPath }) => {
</div>
</div>
<div className="deploy-actions">
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={handlePull}
disabled={deploying}
>
Pull Only
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={() => handleDeploy(false)}
disabled={deploying}
>
{deploying ? 'Deploying...' : 'Deploy Now'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1635,12 +1621,12 @@ const DeployTab = ({ appId, appPath }) => {
</div>
</div>
<div className="card-actions">
- <button className="btn btn-secondary btn-sm" onClick={() => setShowConfigModal(true)}>
+ <Button variant="outline" size="sm" onClick={() => setShowConfigModal(true)}>
Edit
- </button>
- <button className="btn btn-danger btn-sm" onClick={handleRemoveDeployment}>
+ </Button>
+ <Button variant="destructive" size="sm" onClick={handleRemoveDeployment}>
Remove
- </button>
+ </Button>
</div>
</div>
@@ -1650,7 +1636,7 @@ const DeployTab = ({ appId, appPath }) => {
<div className="deployments-list">
{history.slice(0, 5).map((dep, idx) => (
<div key={idx} className="deployment-item">
- <span className={`badge ${getStatusBadgeClass(dep.status)}`}>{dep.status}</span>
+ <Badge variant={getStatusBadgeVariant(dep.status)}>{dep.status}</Badge>
<span className="deployment-date">{new Date(dep.timestamp).toLocaleString()}</span>
</div>
))}
@@ -1671,7 +1657,7 @@ const DeployTab = ({ appId, appPath }) => {
<form onSubmit={handleConfigureDeployment}>
<div className="form-group">
<label>Repository URL</label>
- <input
+ <Input
type="text"
value={configForm.repoUrl}
onChange={e => setConfigForm({...configForm, repoUrl: e.target.value})}
@@ -1681,7 +1667,7 @@ const DeployTab = ({ appId, appPath }) => {
</div>
<div className="form-group">
<label>Branch</label>
- <input
+ <Input
type="text"
value={configForm.branch}
onChange={e => setConfigForm({...configForm, branch: e.target.value})}
@@ -1700,7 +1686,7 @@ const DeployTab = ({ appId, appPath }) => {
</div>
<div className="form-group">
<label>Pre-deploy Script</label>
- <textarea
+ <Textarea
value={configForm.preDeployScript}
onChange={e => setConfigForm({...configForm, preDeployScript: e.target.value})}
placeholder="npm install"
@@ -1709,7 +1695,7 @@ const DeployTab = ({ appId, appPath }) => {
</div>
<div className="form-group">
<label>Post-deploy Script</label>
- <textarea
+ <Textarea
value={configForm.postDeployScript}
onChange={e => setConfigForm({...configForm, postDeployScript: e.target.value})}
placeholder="npm run build"
@@ -1717,12 +1703,12 @@ const DeployTab = ({ appId, appPath }) => {
/>
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={() => setShowConfigModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowConfigModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary">
+ </Button>
+ <Button type="submit">
Save Configuration
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/Applications.jsx b/frontend/src/pages/Applications.jsx
index 155562b5..de559f4b 100644
--- a/frontend/src/pages/Applications.jsx
+++ b/frontend/src/pages/Applications.jsx
@@ -5,6 +5,9 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
const Applications = () => {
const navigate = useNavigate();
@@ -145,9 +148,9 @@ const Applications = () => {
<div className="docker-page-subtitle">Manage your web applications and services</div>
</div>
<div className="docker-page-actions">
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
<Plus size={16} /> New Application
- </button>
+ </Button>
</div>
</div>
@@ -183,9 +186,9 @@ const Applications = () => {
<div className="docker-panel-tab active">All Applications</div>
</div>
<div className="docker-panel-actions">
- <button className="btn btn-secondary btn-sm" onClick={loadApps}>
+ <Button variant="outline" size="sm" onClick={loadApps}>
<RefreshCw size={14} /> Refresh
- </button>
+ </Button>
</div>
</div>
@@ -199,7 +202,7 @@ const Applications = () => {
/>
Show stopped
</label>
- <input
+ <Input
type="text"
className="docker-search"
placeholder="Search apps..."
@@ -468,8 +471,8 @@ const AppLogsModal = ({ app, onClose }) => {
<pre className="log-viewer">{loading ? 'Loading...' : logs}</pre>
</div>
<div className="modal-actions">
- <button className="btn btn-secondary" onClick={loadLogs}>Refresh</button>
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button variant="outline" onClick={loadLogs}>Refresh</Button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -531,9 +534,9 @@ const CreateAppModal = ({ onClose }) => {
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={goToAllTemplates}>
+ <Button variant="outline" onClick={goToAllTemplates}>
Browse All Templates
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsx
index b93b03f1..4f32e5de 100644
--- a/frontend/src/pages/Backups.jsx
+++ b/frontend/src/pages/Backups.jsx
@@ -1,10 +1,15 @@
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import useTabParam from '../hooks/useTabParam';
-import { Upload, Download, Check, AlertTriangle, Clock, Database, Package, FolderArchive, HardDrive, Cloud, CloudOff, RefreshCw, Trash2, Plus, Settings, CheckCircle, XCircle, Server, FileArchive } from 'lucide-react';
+import { Upload, Download, Check, AlertTriangle, Clock, Database, Package, FolderArchive, HardDrive, Cloud, CloudOff, RefreshCw, Trash2, Plus, CheckCircle, XCircle, FileArchive } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['backups', 'schedules', 'storage', 'settings'];
@@ -342,11 +347,11 @@ const Backups = () => {
const getRemoteStatusBadge = (status) => {
switch (status) {
case 'synced':
- return <span className="badge badge-success"><Cloud size={12} /> Synced</span>;
+ return <Badge variant="success"><Cloud size={12} /> Synced</Badge>;
case 'remote-only':
- return <span className="badge badge-info"><Cloud size={12} /> Remote</span>;
+ return <Badge variant="info"><Cloud size={12} /> Remote</Badge>;
default:
- return <span className="badge badge-secondary"><HardDrive size={12} /> Local</span>;
+ return <Badge variant="secondary"><HardDrive size={12} /> Local</Badge>;
}
};
@@ -366,14 +371,14 @@ const Backups = () => {
<p className="page-subtitle">Manage application, database, and file backups with local and remote storage</p>
</div>
<div className="page-actions">
- <button className="btn btn-secondary" onClick={() => setShowScheduleModal(true)}>
+ <Button variant="outline" onClick={() => setShowScheduleModal(true)}>
<Clock size={16} />
Add Schedule
- </button>
- <button className="btn btn-primary" onClick={() => setShowBackupModal(true)}>
+ </Button>
+ <Button onClick={() => setShowBackupModal(true)}>
<Plus size={16} />
Create Backup
- </button>
+ </Button>
</div>
</div>
@@ -439,458 +444,457 @@ const Backups = () => {
)}
</div>
- <div className="tabs">
- <button className={`tab ${activeTab === 'backups' ? 'active' : ''}`} onClick={() => setActiveTab('backups')}>
- Backups
- </button>
- <button className={`tab ${activeTab === 'schedules' ? 'active' : ''}`} onClick={() => setActiveTab('schedules')}>
- Schedules
- </button>
- <button className={`tab ${activeTab === 'storage' ? 'active' : ''}`} onClick={() => setActiveTab('storage')}>
- Storage
- </button>
- <button className={`tab ${activeTab === 'settings' ? 'active' : ''}`} onClick={() => setActiveTab('settings')}>
- Settings
- </button>
- </div>
-
- {/* Backups Tab */}
- {activeTab === 'backups' && (
- <div className="card">
- <div className="card-header">
- <h3>Backup List</h3>
- <div className="card-actions">
- <select
- value={filterType}
- onChange={(e) => setFilterType(e.target.value)}
- className="filter-select"
- >
- <option value="all">All Types</option>
- <option value="application">Applications</option>
- <option value="database">Databases</option>
- <option value="files">Files</option>
- </select>
- <button className="btn btn-secondary btn-sm" onClick={loadData}>
- <RefreshCw size={14} />
- Refresh
- </button>
- </div>
- </div>
- <div className="card-body">
- {filteredBackups.length === 0 ? (
- <div className="empty-state">
- <Download size={48} />
- <h3>No Backups</h3>
- <p>No backups found. Create your first backup to get started.</p>
- <button className="btn btn-primary" onClick={() => setShowBackupModal(true)}>
- Create Backup
- </button>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ <TabsTrigger value="backups">Backups</TabsTrigger>
+ <TabsTrigger value="schedules">Schedules</TabsTrigger>
+ <TabsTrigger value="storage">Storage</TabsTrigger>
+ <TabsTrigger value="settings">Settings</TabsTrigger>
+ </TabsList>
+
+ {/* Backups Tab */}
+ <TabsContent value="backups">
+ <div className="card">
+ <div className="card-header">
+ <h3>Backup List</h3>
+ <div className="card-actions">
+ <select
+ value={filterType}
+ onChange={(e) => setFilterType(e.target.value)}
+ className="filter-select"
+ >
+ <option value="all">All Types</option>
+ <option value="application">Applications</option>
+ <option value="database">Databases</option>
+ <option value="files">Files</option>
+ </select>
+ <Button size="sm" variant="outline" onClick={loadData}>
+ <RefreshCw size={14} />
+ Refresh
+ </Button>
</div>
- ) : (
- <table className="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Size</th>
- <th>Storage</th>
- <th>Created</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {filteredBackups.map((backup, index) => (
- <tr key={index}>
- <td>
- <div className="backup-name">
- {getBackupIcon(backup.type)}
- <span>{backup.name || backup.app_name}</span>
- </div>
- </td>
- <td>
- <span className={`badge badge-${backup.type === 'application' ? 'primary' : backup.type === 'database' ? 'info' : 'warning'}`}>
- {backup.type}
- </span>
- </td>
- <td>{formatSize(backup.size)}</td>
- <td>{getRemoteStatusBadge(backup.remote_status)}</td>
- <td>{formatTimestamp(backup.timestamp)}</td>
- <td>
- <div className="action-buttons">
- {backup.type !== 'files' && (
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => {
- setSelectedBackup(backup);
- setShowRestoreModal(true);
- }}
- title="Restore"
- >
- <RefreshCw size={14} />
- </button>
- )}
- {storageConfig?.provider !== 'local' && backup.remote_status !== 'synced' && (
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => handleUploadToRemote(backup)}
- disabled={uploadingBackup === backup.path}
- title="Upload to Remote"
- >
- {uploadingBackup === backup.path ? (
- <RefreshCw size={14} className="spinning" />
- ) : (
- <Upload size={14} />
- )}
- </button>
- )}
- <button
- className="btn btn-sm btn-danger"
- onClick={() => handleDeleteBackup(backup.path)}
- title="Delete"
- >
- <Trash2 size={14} />
- </button>
- </div>
- </td>
+ </div>
+ <div className="card-body">
+ {filteredBackups.length === 0 ? (
+ <div className="empty-state">
+ <Download size={48} />
+ <h3>No Backups</h3>
+ <p>No backups found. Create your first backup to get started.</p>
+ <Button onClick={() => setShowBackupModal(true)}>
+ Create Backup
+ </Button>
+ </div>
+ ) : (
+ <table className="table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Size</th>
+ <th>Storage</th>
+ <th>Created</th>
+ <th>Actions</th>
</tr>
- ))}
- </tbody>
- </table>
- )}
- </div>
- </div>
- )}
-
- {/* Schedules Tab */}
- {activeTab === 'schedules' && (
- <div className="card">
- <div className="card-header">
- <h3>Backup Schedules</h3>
- <button className="btn btn-primary btn-sm" onClick={() => setShowScheduleModal(true)}>
- <Plus size={14} />
- Add Schedule
- </button>
+ </thead>
+ <tbody>
+ {filteredBackups.map((backup, index) => (
+ <tr key={index}>
+ <td>
+ <div className="backup-name">
+ {getBackupIcon(backup.type)}
+ <span>{backup.name || backup.app_name}</span>
+ </div>
+ </td>
+ <td>
+ <Badge variant={backup.type === 'application' ? 'default' : backup.type === 'database' ? 'info' : 'warning'}>
+ {backup.type}
+ </Badge>
+ </td>
+ <td>{formatSize(backup.size)}</td>
+ <td>{getRemoteStatusBadge(backup.remote_status)}</td>
+ <td>{formatTimestamp(backup.timestamp)}</td>
+ <td>
+ <div className="action-buttons">
+ {backup.type !== 'files' && (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => {
+ setSelectedBackup(backup);
+ setShowRestoreModal(true);
+ }}
+ title="Restore"
+ >
+ <RefreshCw size={14} />
+ </Button>
+ )}
+ {storageConfig?.provider !== 'local' && backup.remote_status !== 'synced' && (
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => handleUploadToRemote(backup)}
+ disabled={uploadingBackup === backup.path}
+ title="Upload to Remote"
+ >
+ {uploadingBackup === backup.path ? (
+ <RefreshCw size={14} className="spinning" />
+ ) : (
+ <Upload size={14} />
+ )}
+ </Button>
+ )}
+ <Button
+ size="sm"
+ variant="destructive"
+ onClick={() => handleDeleteBackup(backup.path)}
+ title="Delete"
+ >
+ <Trash2 size={14} />
+ </Button>
+ </div>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ )}
+ </div>
</div>
- <div className="card-body">
- {schedules.length === 0 ? (
- <div className="empty-state">
- <Clock size={48} />
- <h3>No Schedules</h3>
- <p>No backup schedules configured. Add a schedule for automated backups.</p>
- <button className="btn btn-primary" onClick={() => setShowScheduleModal(true)}>
- Add Schedule
- </button>
- </div>
- ) : (
- <table className="table">
- <thead>
- <tr>
- <th>Name</th>
- <th>Type</th>
- <th>Target</th>
- <th>Time</th>
- <th>Days</th>
- <th>Remote</th>
- <th>Last Run</th>
- <th>Status</th>
- <th>Actions</th>
- </tr>
- </thead>
- <tbody>
- {schedules.map((schedule) => (
- <tr key={schedule.id}>
- <td>{schedule.name}</td>
- <td>
- <span className={`badge badge-${schedule.backup_type === 'application' ? 'primary' : schedule.backup_type === 'database' ? 'info' : 'warning'}`}>
- {schedule.backup_type}
- </span>
- </td>
- <td>{schedule.target}</td>
- <td>{schedule.schedule_time}</td>
- <td>{schedule.days?.join(', ') || 'daily'}</td>
- <td>
- {schedule.upload_remote ? (
- <Cloud size={16} className="text-success" />
- ) : (
- <CloudOff size={16} className="text-muted" />
- )}
- </td>
- <td>{schedule.last_run ? formatTimestamp(schedule.last_run) : 'Never'}</td>
- <td>
- {schedule.last_status === 'success' && (
- <span className="badge badge-success"><CheckCircle size={12} /> Success</span>
- )}
- {schedule.last_status === 'failed' && (
- <span className="badge badge-danger"><XCircle size={12} /> Failed</span>
- )}
- {!schedule.last_status && (
- <span className={`badge badge-${schedule.enabled ? 'success' : 'secondary'}`}>
- {schedule.enabled ? 'Active' : 'Disabled'}
- </span>
- )}
- </td>
- <td>
- <div className="action-buttons">
- <button
- className={`btn btn-sm ${schedule.enabled ? 'btn-secondary' : 'btn-success'}`}
- onClick={() => handleToggleSchedule(schedule)}
- title={schedule.enabled ? 'Disable' : 'Enable'}
- >
- {schedule.enabled ? <XCircle size={14} /> : <CheckCircle size={14} />}
- </button>
- <button
- className="btn btn-sm btn-danger"
- onClick={() => handleRemoveSchedule(schedule.id)}
- title="Remove"
- >
- <Trash2 size={14} />
- </button>
- </div>
- </td>
+ </TabsContent>
+
+ {/* Schedules Tab */}
+ <TabsContent value="schedules">
+ <div className="card">
+ <div className="card-header">
+ <h3>Backup Schedules</h3>
+ <Button size="sm" onClick={() => setShowScheduleModal(true)}>
+ <Plus size={14} />
+ Add Schedule
+ </Button>
+ </div>
+ <div className="card-body">
+ {schedules.length === 0 ? (
+ <div className="empty-state">
+ <Clock size={48} />
+ <h3>No Schedules</h3>
+ <p>No backup schedules configured. Add a schedule for automated backups.</p>
+ <Button onClick={() => setShowScheduleModal(true)}>
+ Add Schedule
+ </Button>
+ </div>
+ ) : (
+ <table className="table">
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Target</th>
+ <th>Time</th>
+ <th>Days</th>
+ <th>Remote</th>
+ <th>Last Run</th>
+ <th>Status</th>
+ <th>Actions</th>
</tr>
- ))}
- </tbody>
- </table>
- )}
+ </thead>
+ <tbody>
+ {schedules.map((schedule) => (
+ <tr key={schedule.id}>
+ <td>{schedule.name}</td>
+ <td>
+ <Badge variant={schedule.backup_type === 'application' ? 'default' : schedule.backup_type === 'database' ? 'info' : 'warning'}>
+ {schedule.backup_type}
+ </Badge>
+ </td>
+ <td>{schedule.target}</td>
+ <td>{schedule.schedule_time}</td>
+ <td>{schedule.days?.join(', ') || 'daily'}</td>
+ <td>
+ {schedule.upload_remote ? (
+ <Cloud size={16} className="text-success" />
+ ) : (
+ <CloudOff size={16} className="text-muted" />
+ )}
+ </td>
+ <td>{schedule.last_run ? formatTimestamp(schedule.last_run) : 'Never'}</td>
+ <td>
+ {schedule.last_status === 'success' && (
+ <Badge variant="success"><CheckCircle size={12} /> Success</Badge>
+ )}
+ {schedule.last_status === 'failed' && (
+ <Badge variant="destructive"><XCircle size={12} /> Failed</Badge>
+ )}
+ {!schedule.last_status && (
+ <Badge variant={schedule.enabled ? 'success' : 'secondary'}>
+ {schedule.enabled ? 'Active' : 'Disabled'}
+ </Badge>
+ )}
+ </td>
+ <td>
+ <div className="action-buttons">
+ <Button
+ size="sm"
+ variant={schedule.enabled ? 'outline' : 'default'}
+ onClick={() => handleToggleSchedule(schedule)}
+ title={schedule.enabled ? 'Disable' : 'Enable'}
+ >
+ {schedule.enabled ? <XCircle size={14} /> : <CheckCircle size={14} />}
+ </Button>
+ <Button
+ size="sm"
+ variant="destructive"
+ onClick={() => handleRemoveSchedule(schedule.id)}
+ title="Remove"
+ >
+ <Trash2 size={14} />
+ </Button>
+ </div>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ )}
+ </div>
</div>
- </div>
- )}
+ </TabsContent>
- {/* Storage Tab */}
- {activeTab === 'storage' && (
- <div className="card">
- <div className="card-header">
- <h3>Remote Storage Configuration</h3>
- </div>
- <div className="card-body">
- <form onSubmit={handleSaveStorageConfig}>
- <div className="form-group">
- <label>Storage Provider</label>
- <select
- value={storageForm.provider}
- onChange={(e) => setStorageForm({...storageForm, provider: e.target.value})}
- >
- <option value="local">Local Only</option>
- <option value="s3">S3-Compatible (AWS S3, MinIO, Wasabi)</option>
- <option value="b2">Backblaze B2</option>
- </select>
- </div>
+ {/* Storage Tab */}
+ <TabsContent value="storage">
+ <div className="card">
+ <div className="card-header">
+ <h3>Remote Storage Configuration</h3>
+ </div>
+ <div className="card-body">
+ <form onSubmit={handleSaveStorageConfig}>
+ <div className="form-group">
+ <label>Storage Provider</label>
+ <select
+ value={storageForm.provider}
+ onChange={(e) => setStorageForm({...storageForm, provider: e.target.value})}
+ >
+ <option value="local">Local Only</option>
+ <option value="s3">S3-Compatible (AWS S3, MinIO, Wasabi)</option>
+ <option value="b2">Backblaze B2</option>
+ </select>
+ </div>
- {storageForm.provider === 's3' && (
- <div className="storage-provider-config">
- <h4>S3-Compatible Storage</h4>
- <div className="form-row">
- <div className="form-group">
- <label>Bucket Name</label>
- <input
- type="text"
- value={storageForm.s3.bucket}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, bucket: e.target.value}})}
- placeholder="my-backup-bucket"
- required
- />
- </div>
- <div className="form-group">
- <label>Region</label>
- <input
- type="text"
- value={storageForm.s3.region}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, region: e.target.value}})}
- placeholder="us-east-1"
- />
+ {storageForm.provider === 's3' && (
+ <div className="storage-provider-config">
+ <h4>S3-Compatible Storage</h4>
+ <div className="form-row">
+ <div className="form-group">
+ <label>Bucket Name</label>
+ <Input
+ type="text"
+ value={storageForm.s3.bucket}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, bucket: e.target.value}})}
+ placeholder="my-backup-bucket"
+ required
+ />
+ </div>
+ <div className="form-group">
+ <label>Region</label>
+ <Input
+ type="text"
+ value={storageForm.s3.region}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, region: e.target.value}})}
+ placeholder="us-east-1"
+ />
+ </div>
</div>
- </div>
- <div className="form-row">
- <div className="form-group">
- <label>Access Key</label>
- <input
- type="text"
- value={storageForm.s3.access_key}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, access_key: e.target.value}})}
- placeholder="AKIA..."
- required
- />
+ <div className="form-row">
+ <div className="form-group">
+ <label>Access Key</label>
+ <Input
+ type="text"
+ value={storageForm.s3.access_key}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, access_key: e.target.value}})}
+ placeholder="AKIA..."
+ required
+ />
+ </div>
+ <div className="form-group">
+ <label>Secret Key</label>
+ <Input
+ type="password"
+ value={storageForm.s3.secret_key}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, secret_key: e.target.value}})}
+ required
+ />
+ </div>
</div>
- <div className="form-group">
- <label>Secret Key</label>
- <input
- type="password"
- value={storageForm.s3.secret_key}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, secret_key: e.target.value}})}
- required
- />
+ <div className="form-row">
+ <div className="form-group">
+ <label>Custom Endpoint URL <span className="form-help-inline">(optional, for MinIO/Wasabi)</span></label>
+ <Input
+ type="text"
+ value={storageForm.s3.endpoint_url}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, endpoint_url: e.target.value}})}
+ placeholder="https://s3.example.com"
+ />
+ </div>
+ <div className="form-group">
+ <label>Path Prefix</label>
+ <Input
+ type="text"
+ value={storageForm.s3.path_prefix}
+ onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, path_prefix: e.target.value}})}
+ placeholder="serverkit-backups"
+ />
+ </div>
</div>
</div>
- <div className="form-row">
- <div className="form-group">
- <label>Custom Endpoint URL <span className="form-help-inline">(optional, for MinIO/Wasabi)</span></label>
- <input
- type="text"
- value={storageForm.s3.endpoint_url}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, endpoint_url: e.target.value}})}
- placeholder="https://s3.example.com"
- />
+ )}
+
+ {storageForm.provider === 'b2' && (
+ <div className="storage-provider-config">
+ <h4>Backblaze B2</h4>
+ <div className="form-row">
+ <div className="form-group">
+ <label>Bucket Name</label>
+ <Input
+ type="text"
+ value={storageForm.b2.bucket}
+ onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, bucket: e.target.value}})}
+ placeholder="my-backup-bucket"
+ required
+ />
+ </div>
+ <div className="form-group">
+ <label>S3-Compatible Endpoint URL</label>
+ <Input
+ type="text"
+ value={storageForm.b2.endpoint_url}
+ onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, endpoint_url: e.target.value}})}
+ placeholder="https://s3.us-west-004.backblazeb2.com"
+ required
+ />
+ </div>
+ </div>
+ <div className="form-row">
+ <div className="form-group">
+ <label>Application Key ID</label>
+ <Input
+ type="text"
+ value={storageForm.b2.key_id}
+ onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, key_id: e.target.value}})}
+ required
+ />
+ </div>
+ <div className="form-group">
+ <label>Application Key</label>
+ <Input
+ type="password"
+ value={storageForm.b2.application_key}
+ onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, application_key: e.target.value}})}
+ required
+ />
+ </div>
</div>
<div className="form-group">
<label>Path Prefix</label>
- <input
+ <Input
type="text"
- value={storageForm.s3.path_prefix}
- onChange={(e) => setStorageForm({...storageForm, s3: {...storageForm.s3, path_prefix: e.target.value}})}
+ value={storageForm.b2.path_prefix}
+ onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, path_prefix: e.target.value}})}
placeholder="serverkit-backups"
/>
</div>
</div>
- </div>
- )}
+ )}
- {storageForm.provider === 'b2' && (
- <div className="storage-provider-config">
- <h4>Backblaze B2</h4>
- <div className="form-row">
- <div className="form-group">
- <label>Bucket Name</label>
- <input
- type="text"
- value={storageForm.b2.bucket}
- onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, bucket: e.target.value}})}
- placeholder="my-backup-bucket"
- required
- />
- </div>
- <div className="form-group">
- <label>S3-Compatible Endpoint URL</label>
- <input
- type="text"
- value={storageForm.b2.endpoint_url}
- onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, endpoint_url: e.target.value}})}
- placeholder="https://s3.us-west-004.backblazeb2.com"
- required
- />
- </div>
- </div>
- <div className="form-row">
+ {storageForm.provider !== 'local' && (
+ <>
<div className="form-group">
- <label>Application Key ID</label>
- <input
- type="text"
- value={storageForm.b2.key_id}
- onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, key_id: e.target.value}})}
- required
- />
+ <label className="checkbox-label">
+ <input
+ type="checkbox"
+ checked={storageForm.auto_upload}
+ onChange={(e) => setStorageForm({...storageForm, auto_upload: e.target.checked})}
+ />
+ <span>Auto-upload new backups to remote storage</span>
+ </label>
</div>
+
<div className="form-group">
- <label>Application Key</label>
- <input
- type="password"
- value={storageForm.b2.application_key}
- onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, application_key: e.target.value}})}
- required
- />
+ <label className="checkbox-label">
+ <input
+ type="checkbox"
+ checked={storageForm.keep_local_copy}
+ onChange={(e) => setStorageForm({...storageForm, keep_local_copy: e.target.checked})}
+ />
+ <span>Keep local copy after uploading</span>
+ </label>
</div>
- </div>
- <div className="form-group">
- <label>Path Prefix</label>
+ </>
+ )}
+
+ <div className="form-actions">
+ <Button type="submit">Save Storage Config</Button>
+ {storageForm.provider !== 'local' && (
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleTestConnection}
+ disabled={testingConnection}
+ >
+ {testingConnection ? (
+ <><RefreshCw size={16} className="spinning" /> Testing...</>
+ ) : (
+ <><Check size={16} /> Test Connection</>
+ )}
+ </Button>
+ )}
+ </div>
+ </form>
+ </div>
+ </div>
+ </TabsContent>
+
+ {/* Settings Tab */}
+ <TabsContent value="settings">
+ <div className="card">
+ <div className="card-header">
+ <h3>Backup Settings</h3>
+ </div>
+ <div className="card-body">
+ <form onSubmit={handleSaveConfig}>
+ <div className="form-group">
+ <label className="checkbox-label">
<input
- type="text"
- value={storageForm.b2.path_prefix}
- onChange={(e) => setStorageForm({...storageForm, b2: {...storageForm.b2, path_prefix: e.target.value}})}
- placeholder="serverkit-backups"
+ type="checkbox"
+ checked={configForm.enabled}
+ onChange={(e) => setConfigForm({...configForm, enabled: e.target.checked})}
/>
- </div>
+ <span>Enable Scheduled Backups</span>
+ </label>
</div>
- )}
-
- {storageForm.provider !== 'local' && (
- <>
- <div className="form-group">
- <label className="checkbox-label">
- <input
- type="checkbox"
- checked={storageForm.auto_upload}
- onChange={(e) => setStorageForm({...storageForm, auto_upload: e.target.checked})}
- />
- <span>Auto-upload new backups to remote storage</span>
- </label>
- </div>
-
- <div className="form-group">
- <label className="checkbox-label">
- <input
- type="checkbox"
- checked={storageForm.keep_local_copy}
- onChange={(e) => setStorageForm({...storageForm, keep_local_copy: e.target.checked})}
- />
- <span>Keep local copy after uploading</span>
- </label>
- </div>
- </>
- )}
- <div className="form-actions">
- <button type="submit" className="btn btn-primary">Save Storage Config</button>
- {storageForm.provider !== 'local' && (
- <button
- type="button"
- className="btn btn-secondary"
- onClick={handleTestConnection}
- disabled={testingConnection}
- >
- {testingConnection ? (
- <><RefreshCw size={16} className="spinning" /> Testing...</>
- ) : (
- <><Check size={16} /> Test Connection</>
- )}
- </button>
- )}
- </div>
- </form>
- </div>
- </div>
- )}
-
- {/* Settings Tab */}
- {activeTab === 'settings' && (
- <div className="card">
- <div className="card-header">
- <h3>Backup Settings</h3>
- </div>
- <div className="card-body">
- <form onSubmit={handleSaveConfig}>
- <div className="form-group">
- <label className="checkbox-label">
- <input
- type="checkbox"
- checked={configForm.enabled}
- onChange={(e) => setConfigForm({...configForm, enabled: e.target.checked})}
+ <div className="form-group">
+ <label>Retention Period (days)</label>
+ <Input
+ type="number"
+ value={configForm.retention_days}
+ onChange={(e) => setConfigForm({...configForm, retention_days: parseInt(e.target.value)})}
+ min="1"
+ max="365"
/>
- <span>Enable Scheduled Backups</span>
- </label>
- </div>
-
- <div className="form-group">
- <label>Retention Period (days)</label>
- <input
- type="number"
- value={configForm.retention_days}
- onChange={(e) => setConfigForm({...configForm, retention_days: parseInt(e.target.value)})}
- min="1"
- max="365"
- />
- <span className="form-help">Backups older than this will be deleted during cleanup</span>
- </div>
+ <span className="form-help">Backups older than this will be deleted during cleanup</span>
+ </div>
- <div className="form-actions">
- <button type="submit" className="btn btn-primary">Save Settings</button>
- <button type="button" className="btn btn-secondary" onClick={handleCleanup}>
- <Trash2 size={16} />
- Run Cleanup Now
- </button>
- </div>
- </form>
+ <div className="form-actions">
+ <Button type="submit">Save Settings</Button>
+ <Button type="button" variant="outline" onClick={handleCleanup}>
+ <Trash2 size={16} />
+ Run Cleanup Now
+ </Button>
+ </div>
+ </form>
+ </div>
</div>
- </div>
- )}
+ </TabsContent>
+ </Tabs>
{/* Create Backup Modal */}
{showBackupModal && (
@@ -947,7 +951,7 @@ const Backups = () => {
<>
<div className="form-group">
<label>Backup Name (optional)</label>
- <input
+ <Input
type="text"
value={backupForm.fileName}
onChange={(e) => setBackupForm({...backupForm, fileName: e.target.value})}
@@ -956,7 +960,7 @@ const Backups = () => {
</div>
<div className="form-group">
<label>File/Directory Paths (one per line)</label>
- <textarea
+ <Textarea
value={backupForm.filePaths}
onChange={(e) => setBackupForm({...backupForm, filePaths: e.target.value})}
placeholder={"/etc/nginx/nginx.conf\n/var/www/mysite/config\n/home/user/.env"}
@@ -983,7 +987,7 @@ const Backups = () => {
<div className="form-group">
<label>Database Name</label>
- <input
+ <Input
type="text"
value={backupForm.dbName}
onChange={(e) => setBackupForm({...backupForm, dbName: e.target.value})}
@@ -994,7 +998,7 @@ const Backups = () => {
<div className="form-row">
<div className="form-group">
<label>Username</label>
- <input
+ <Input
type="text"
value={backupForm.dbUser}
onChange={(e) => setBackupForm({...backupForm, dbUser: e.target.value})}
@@ -1003,7 +1007,7 @@ const Backups = () => {
<div className="form-group">
<label>Password</label>
- <input
+ <Input
type="password"
value={backupForm.dbPassword}
onChange={(e) => setBackupForm({...backupForm, dbPassword: e.target.value})}
@@ -1013,7 +1017,7 @@ const Backups = () => {
<div className="form-group">
<label>Host</label>
- <input
+ <Input
type="text"
value={backupForm.dbHost}
onChange={(e) => setBackupForm({...backupForm, dbHost: e.target.value})}
@@ -1023,10 +1027,10 @@ const Backups = () => {
)}
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={() => setShowBackupModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowBackupModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary">Create Backup</button>
+ </Button>
+ <Button type="submit">Create Backup</Button>
</div>
</form>
</div>
@@ -1045,7 +1049,7 @@ const Backups = () => {
<div className="modal-body">
<div className="form-group">
<label>Schedule Name</label>
- <input
+ <Input
type="text"
value={scheduleForm.name}
onChange={(e) => setScheduleForm({...scheduleForm, name: e.target.value})}
@@ -1075,7 +1079,7 @@ const Backups = () => {
: 'Application Name'
}
</label>
- <input
+ <Input
type="text"
value={scheduleForm.target}
onChange={(e) => setScheduleForm({...scheduleForm, target: e.target.value})}
@@ -1092,7 +1096,7 @@ const Backups = () => {
<div className="form-group">
<label>Time</label>
- <input
+ <Input
type="time"
value={scheduleForm.scheduleTime}
onChange={(e) => setScheduleForm({...scheduleForm, scheduleTime: e.target.value})}
@@ -1114,10 +1118,10 @@ const Backups = () => {
)}
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={() => setShowScheduleModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowScheduleModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary">Add Schedule</button>
+ </Button>
+ <Button type="submit">Add Schedule</Button>
</div>
</form>
</div>
@@ -1158,12 +1162,12 @@ const Backups = () => {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowRestoreModal(false)}>
+ <Button variant="outline" onClick={() => setShowRestoreModal(false)}>
Cancel
- </button>
- <button className="btn btn-danger" onClick={handleRestore}>
+ </Button>
+ <Button variant="destructive" onClick={handleRestore}>
Restore Backup
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/CloudProvision.jsx b/frontend/src/pages/CloudProvision.jsx
index 8ceb31cb..ef917702 100644
--- a/frontend/src/pages/CloudProvision.jsx
+++ b/frontend/src/pages/CloudProvision.jsx
@@ -4,6 +4,10 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const CloudProvision = () => {
const toast = useToast();
@@ -16,7 +20,6 @@ const CloudProvision = () => {
const [showCreateServer, setShowCreateServer] = useState(false);
const [providerOptions, setProviderOptions] = useState(null);
const [deleteConfirm, setDeleteConfirm] = useState(null);
- const [tab, setTab] = useState('servers');
const [providerForm, setProviderForm] = useState({ name: '', provider_type: 'digitalocean', api_key: '' });
const [serverForm, setServerForm] = useState({ name: '', provider_id: '', region: '', size: '', image: '', install_agent: true });
@@ -78,6 +81,12 @@ const CloudProvision = () => {
digitalocean: 'DigitalOcean', hetzner: 'Hetzner Cloud', vultr: 'Vultr', linode: 'Linode'
};
+ const serverStatusVariant = (status) => {
+ if (status === 'active') return 'success';
+ if (status === 'error') return 'destructive';
+ return 'warning';
+ };
+
if (loading) return <Spinner />;
return (
@@ -87,82 +96,86 @@ const CloudProvision = () => {
<h1>Cloud Provisioning</h1>
<p className="page-description">
{servers.length} server{servers.length !== 1 ? 's' : ''}
- {costs && ` \u2022 $${costs.total_monthly}/mo`}
+ {costs && ` • $${costs.total_monthly}/mo`}
</p>
</div>
<div className="page-header-actions">
{user?.is_admin && (
<>
- <button className="btn" onClick={() => setShowCreateProvider(true)}>Add Provider</button>
- <button className="btn btn-primary" onClick={() => setShowCreateServer(true)}>New Server</button>
+ <Button variant="outline" onClick={() => setShowCreateProvider(true)}>Add Provider</Button>
+ <Button onClick={() => setShowCreateServer(true)}>New Server</Button>
</>
)}
</div>
</div>
- <div className="tabs">
- <button className={`tab ${tab === 'servers' ? 'active' : ''}`} onClick={() => setTab('servers')}>Servers</button>
- <button className={`tab ${tab === 'providers' ? 'active' : ''}`} onClick={() => setTab('providers')}>Providers</button>
- <button className={`tab ${tab === 'costs' ? 'active' : ''}`} onClick={() => setTab('costs')}>Costs</button>
- </div>
-
- {tab === 'servers' && (
- <div className="cloud-servers-grid">
- {servers.map(srv => (
- <div key={srv.id} className="cloud-server-card card">
- <div className="cloud-server-card__header">
- <h3>{srv.name}</h3>
- <span className={`badge badge--${srv.status === 'active' ? 'success' : srv.status === 'error' ? 'danger' : 'warning'}`}>{srv.status}</span>
- </div>
- <div className="cloud-server-card__meta">
- <span>{srv.provider_name}</span>
- <span>{srv.region}</span>
- <span>{srv.size}</span>
- </div>
- {srv.ip_address && <div className="text-mono">{srv.ip_address}</div>}
- <div className="cloud-server-card__cost">
- ${srv.monthly_cost}/mo
+ <Tabs defaultValue="servers">
+ <TabsList>
+ <TabsTrigger value="servers">Servers</TabsTrigger>
+ <TabsTrigger value="providers">Providers</TabsTrigger>
+ <TabsTrigger value="costs">Costs</TabsTrigger>
+ </TabsList>
+
+ <TabsContent value="servers">
+ <div className="cloud-servers-grid">
+ {servers.map(srv => (
+ <div key={srv.id} className="cloud-server-card card">
+ <div className="cloud-server-card__header">
+ <h3>{srv.name}</h3>
+ <Badge variant={serverStatusVariant(srv.status)}>{srv.status}</Badge>
+ </div>
+ <div className="cloud-server-card__meta">
+ <span>{srv.provider_name}</span>
+ <span>{srv.region}</span>
+ <span>{srv.size}</span>
+ </div>
+ {srv.ip_address && <div className="text-mono">{srv.ip_address}</div>}
+ <div className="cloud-server-card__cost">
+ ${srv.monthly_cost}/mo
+ </div>
+ <div className="cloud-server-card__actions">
+ {srv.agent_installed && <Badge variant="success">Agent Installed</Badge>}
+ {user?.is_admin && srv.status === 'active' && (
+ <Button size="sm" variant="destructive" onClick={() => setDeleteConfirm(srv)}>Destroy</Button>
+ )}
+ </div>
</div>
- <div className="cloud-server-card__actions">
- {srv.agent_installed && <span className="badge badge--success">Agent Installed</span>}
- {user?.is_admin && srv.status === 'active' && (
- <button className="btn btn-sm btn-danger" onClick={() => setDeleteConfirm(srv)}>Destroy</button>
- )}
- </div>
- </div>
- ))}
- {servers.length === 0 && <div className="empty-state"><p>No cloud servers provisioned yet.</p></div>}
- </div>
- )}
-
- {tab === 'providers' && (
- <div className="providers-list">
- {providers.map(p => (
- <div key={p.id} className="provider-row card">
- <strong>{p.name}</strong>
- <span className="badge badge--outline">{providerTypes[p.provider_type] || p.provider_type}</span>
- <span>{p.server_count} servers</span>
- </div>
- ))}
- {providers.length === 0 && <div className="empty-state"><p>No providers configured.</p></div>}
- </div>
- )}
-
- {tab === 'costs' && costs && (
- <div className="costs-panel card">
- <h3>Monthly Cost Summary</h3>
- <div className="cost-total">${costs.total_monthly}/mo across {costs.server_count} servers</div>
- <div className="cost-breakdown">
- {Object.entries(costs.by_provider || {}).map(([name, data]) => (
- <div key={name} className="cost-row">
- <span>{name}</span>
- <span>{data.count} servers</span>
- <span>${data.cost.toFixed(2)}/mo</span>
+ ))}
+ {servers.length === 0 && <div className="empty-state"><p>No cloud servers provisioned yet.</p></div>}
+ </div>
+ </TabsContent>
+
+ <TabsContent value="providers">
+ <div className="providers-list">
+ {providers.map(p => (
+ <div key={p.id} className="provider-row card">
+ <strong>{p.name}</strong>
+ <Badge variant="outline">{providerTypes[p.provider_type] || p.provider_type}</Badge>
+ <span>{p.server_count} servers</span>
</div>
))}
+ {providers.length === 0 && <div className="empty-state"><p>No providers configured.</p></div>}
</div>
- </div>
- )}
+ </TabsContent>
+
+ <TabsContent value="costs">
+ {costs && (
+ <div className="costs-panel card">
+ <h3>Monthly Cost Summary</h3>
+ <div className="cost-total">${costs.total_monthly}/mo across {costs.server_count} servers</div>
+ <div className="cost-breakdown">
+ {Object.entries(costs.by_provider || {}).map(([name, data]) => (
+ <div key={name} className="cost-row">
+ <span>{name}</span>
+ <span>{data.count} servers</span>
+ <span>${data.cost.toFixed(2)}/mo</span>
+ </div>
+ ))}
+ </div>
+ </div>
+ )}
+ </TabsContent>
+ </Tabs>
{showCreateProvider && (
<div className="modal-overlay" onClick={() => setShowCreateProvider(false)}>
@@ -170,10 +183,13 @@ const CloudProvision = () => {
<div className="modal-header"><h2>Add Cloud Provider</h2><button className="modal-close" onClick={() => setShowCreateProvider(false)}>&times;</button></div>
<div className="modal-body">
<div className="form-group"><label>Provider</label><select className="form-select" value={providerForm.provider_type} onChange={e => setProviderForm({...providerForm, provider_type: e.target.value})}>{Object.entries(providerTypes).map(([k,v]) => <option key={k} value={k}>{v}</option>)}</select></div>
- <div className="form-group"><label>Name</label><input className="form-input" value={providerForm.name} onChange={e => setProviderForm({...providerForm, name: e.target.value})} /></div>
- <div className="form-group"><label>API Key</label><input className="form-input" type="password" value={providerForm.api_key} onChange={e => setProviderForm({...providerForm, api_key: e.target.value})} /></div>
+ <div className="form-group"><label>Name</label><Input value={providerForm.name} onChange={e => setProviderForm({...providerForm, name: e.target.value})} /></div>
+ <div className="form-group"><label>API Key</label><Input type="password" value={providerForm.api_key} onChange={e => setProviderForm({...providerForm, api_key: e.target.value})} /></div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowCreateProvider(false)}>Cancel</Button>
+ <Button onClick={handleCreateProvider}>Add</Button>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowCreateProvider(false)}>Cancel</button><button className="btn btn-primary" onClick={handleCreateProvider}>Add</button></div>
</div>
</div>
)}
@@ -184,7 +200,7 @@ const CloudProvision = () => {
<div className="modal-header"><h2>New Cloud Server</h2><button className="modal-close" onClick={() => setShowCreateServer(false)}>&times;</button></div>
<div className="modal-body">
<div className="form-group"><label>Provider</label><select className="form-select" value={serverForm.provider_id} onChange={e => { setServerForm({...serverForm, provider_id: parseInt(e.target.value)}); const p = providers.find(x => x.id === parseInt(e.target.value)); if (p) loadProviderOptions(p.provider_type); }}><option value="">Select provider</option>{providers.map(p => <option key={p.id} value={p.id}>{p.name}</option>)}</select></div>
- <div className="form-group"><label>Server Name</label><input className="form-input" value={serverForm.name} onChange={e => setServerForm({...serverForm, name: e.target.value})} /></div>
+ <div className="form-group"><label>Server Name</label><Input value={serverForm.name} onChange={e => setServerForm({...serverForm, name: e.target.value})} /></div>
{providerOptions && (
<>
<div className="form-group"><label>Region</label><select className="form-select" value={serverForm.region} onChange={e => setServerForm({...serverForm, region: e.target.value})}><option value="">Select region</option>{(providerOptions.regions || []).map(r => <option key={r} value={r}>{r}</option>)}</select></div>
@@ -194,7 +210,10 @@ const CloudProvision = () => {
)}
<div className="form-group"><label className="checkbox-label"><input type="checkbox" checked={serverForm.install_agent} onChange={e => setServerForm({...serverForm, install_agent: e.target.checked})} /> Auto-install ServerKit agent</label></div>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowCreateServer(false)}>Cancel</button><button className="btn btn-primary" onClick={handleCreateServer} disabled={!serverForm.name || !serverForm.provider_id}>Create</button></div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowCreateServer(false)}>Cancel</Button>
+ <Button onClick={handleCreateServer} disabled={!serverForm.name || !serverForm.provider_id}>Create</Button>
+ </div>
</div>
</div>
)}
diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsx
index 9cf2f375..0da80cf7 100644
--- a/frontend/src/pages/CronJobs.jsx
+++ b/frontend/src/pages/CronJobs.jsx
@@ -3,6 +3,12 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Checkbox } from '@/components/ui/checkbox';
const CronJobs = () => {
const toast = useToast();
@@ -191,21 +197,21 @@ const CronJobs = () => {
<p className="page-subtitle">Manage scheduled tasks and automated jobs</p>
</div>
<div className="page-header-actions">
- <button className="btn btn-secondary" onClick={loadData}>
+ <Button variant="outline" onClick={loadData}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<polyline points="23 4 23 10 17 10"/>
<polyline points="1 20 1 14 7 14"/>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
</svg>
Refresh
- </button>
- <button className="btn btn-primary" onClick={openCreateModal}>
+ </Button>
+ <Button onClick={openCreateModal}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<line x1="12" y1="5" x2="12" y2="19"/>
<line x1="5" y1="12" x2="19" y2="12"/>
</svg>
Create Job
- </button>
+ </Button>
</div>
</div>
@@ -289,9 +295,9 @@ const CronJobs = () => {
</svg>
<h3>No Cron Jobs</h3>
<p>No scheduled jobs found. Create your first cron job to automate tasks.</p>
- <button className="btn btn-primary" onClick={openCreateModal}>
+ <Button onClick={openCreateModal}>
Create Job
- </button>
+ </Button>
</div>
) : (
<div className="cron-list">
@@ -325,14 +331,15 @@ const CronJobs = () => {
</div>
<div className="cron-item-status">
- <span className={`badge badge-${job.enabled ? 'success' : 'secondary'}`}>
+ <Badge variant={job.enabled ? 'success' : 'secondary'}>
{job.enabled ? 'Active' : 'Disabled'}
- </span>
+ </Badge>
</div>
<div className="cron-item-actions" onClick={e => e.stopPropagation()}>
- <button
- className="btn btn-sm btn-secondary"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleRunJob(job.id)}
disabled={runningJobId === job.id}
title="Run now"
@@ -344,9 +351,10 @@ const CronJobs = () => {
<polygon points="5 3 19 12 5 21 5 3"/>
</svg>
)}
- </button>
- <button
- className="btn btn-sm btn-secondary"
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => openEditModal(job)}
title="Edit"
>
@@ -354,9 +362,10 @@ const CronJobs = () => {
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/>
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/>
</svg>
- </button>
- <button
- className={`btn btn-sm ${job.enabled ? 'btn-warning' : 'btn-success'}`}
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleToggleJob(job.id, job.enabled)}
title={job.enabled ? 'Disable' : 'Enable'}
>
@@ -370,9 +379,10 @@ const CronJobs = () => {
<polygon points="5 3 19 12 5 21 5 3"/>
</svg>
)}
- </button>
- <button
- className="btn btn-sm btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleDeleteJob(job.id)}
title="Delete"
>
@@ -380,7 +390,7 @@ const CronJobs = () => {
<polyline points="3 6 5 6 21 6"/>
<path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>
</svg>
- </button>
+ </Button>
</div>
</div>
))}
@@ -400,8 +410,9 @@ const CronJobs = () => {
<form onSubmit={handleSubmitJob}>
<div className="modal-body">
<div className="form-group">
- <label>Job Name</label>
- <input
+ <Label htmlFor="job-name">Job Name</Label>
+ <Input
+ id="job-name"
type="text"
value={jobForm.name}
onChange={(e) => setJobForm({...jobForm, name: e.target.value})}
@@ -411,8 +422,9 @@ const CronJobs = () => {
</div>
<div className="form-group">
- <label>Command</label>
- <input
+ <Label htmlFor="job-command">Command</Label>
+ <Input
+ id="job-command"
type="text"
value={jobForm.command}
onChange={(e) => setJobForm({...jobForm, command: e.target.value})}
@@ -424,10 +436,9 @@ const CronJobs = () => {
<div className="form-group">
<label className="checkbox-label">
- <input
- type="checkbox"
+ <Checkbox
checked={jobForm.usePreset}
- onChange={(e) => setJobForm({...jobForm, usePreset: e.target.checked})}
+ onCheckedChange={(checked) => setJobForm({...jobForm, usePreset: !!checked})}
/>
<span>Use preset schedule</span>
</label>
@@ -435,8 +446,9 @@ const CronJobs = () => {
{jobForm.usePreset ? (
<div className="form-group">
- <label>Schedule Preset</label>
+ <Label htmlFor="job-preset">Schedule Preset</Label>
<select
+ id="job-preset"
value={jobForm.preset}
onChange={(e) => setJobForm({...jobForm, preset: e.target.value})}
>
@@ -449,8 +461,9 @@ const CronJobs = () => {
</div>
) : (
<div className="form-group">
- <label>Cron Schedule</label>
- <input
+ <Label htmlFor="job-schedule">Cron Schedule</Label>
+ <Input
+ id="job-schedule"
type="text"
value={jobForm.schedule}
onChange={(e) => setJobForm({...jobForm, schedule: e.target.value})}
@@ -458,28 +471,29 @@ const CronJobs = () => {
required={!jobForm.usePreset}
/>
<span className="form-help">
- Format: minute hour day month weekday (e.g., "0 0 * * *" for daily at midnight)
+ Format: minute hour day month weekday (e.g., &quot;0 0 * * *&quot; for daily at midnight)
</span>
</div>
)}
<div className="form-group">
- <label>Description (optional)</label>
- <textarea
+ <Label htmlFor="job-description">Description (optional)</Label>
+ <Textarea
+ id="job-description"
value={jobForm.description}
onChange={(e) => setJobForm({...jobForm, description: e.target.value})}
placeholder="What does this job do?"
- rows="2"
+ rows={2}
/>
</div>
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={closeJobModal}>
+ <Button type="button" variant="outline" onClick={closeJobModal}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary">
+ </Button>
+ <Button type="submit">
{editingJob ? 'Save Changes' : 'Create Job'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -498,9 +512,9 @@ const CronJobs = () => {
<div className="run-output">
<div className="run-output-exit">
<span className="run-output-label">Exit Code</span>
- <span className={`badge badge-${runOutput.exitCode === 0 ? 'success' : 'danger'}`}>
+ <Badge variant={runOutput.exitCode === 0 ? 'success' : 'destructive'}>
{runOutput.exitCode}
- </span>
+ </Badge>
</div>
{runOutput.stdout && (
<div className="run-output-section">
@@ -520,7 +534,7 @@ const CronJobs = () => {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setRunOutput(null)}>Close</button>
+ <Button variant="outline" onClick={() => setRunOutput(null)}>Close</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/DNSZones.jsx b/frontend/src/pages/DNSZones.jsx
index c0bad40b..2343899e 100644
--- a/frontend/src/pages/DNSZones.jsx
+++ b/frontend/src/pages/DNSZones.jsx
@@ -4,6 +4,17 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import {
+ Select,
+ SelectTrigger,
+ SelectContent,
+ SelectItem,
+ SelectValue,
+} from '@/components/ui/select';
const DNSZones = () => {
const toast = useToast();
@@ -170,7 +181,7 @@ const DNSZones = () => {
</div>
<div className="page-header-actions">
{user?.is_admin && (
- <button className="btn btn-primary" onClick={() => setShowCreateZone(true)}>Add Zone</button>
+ <Button onClick={() => setShowCreateZone(true)}>Add Zone</Button>
)}
</div>
</div>
@@ -183,12 +194,12 @@ const DNSZones = () => {
onClick={() => loadRecords(zone.id)}>
<div className="dns-zone-item__info">
<strong>{zone.domain}</strong>
- <span className="text-muted">{zone.provider} \u2022 {zone.record_count} records</span>
+ <span className="text-muted">{zone.provider} &bull; {zone.record_count} records</span>
</div>
<div className="dns-zone-item__actions" onClick={e => e.stopPropagation()}>
- <button className="btn btn-sm" onClick={() => handleCheckPropagation(zone.domain)}>Check</button>
+ <Button variant="outline" size="sm" onClick={() => handleCheckPropagation(zone.domain)}>Check</Button>
{user?.is_admin && (
- <button className="btn btn-sm btn-danger" onClick={() => setDeleteConfirm(zone)}>Delete</button>
+ <Button variant="destructive" size="sm" onClick={() => setDeleteConfirm(zone)}>Delete</Button>
)}
</div>
</div>
@@ -201,9 +212,9 @@ const DNSZones = () => {
<div className="dns-records-panel__header">
<h2>{selectedZone.domain}</h2>
<div className="dns-records-panel__actions">
- <button className="btn btn-sm" onClick={() => handleExport(selectedZone.id)}>Export</button>
+ <Button variant="outline" size="sm" onClick={() => handleExport(selectedZone.id)}>Export</Button>
{user?.is_admin && (
- <button className="btn btn-sm btn-primary" onClick={() => setShowCreateRecord(true)}>Add Record</button>
+ <Button size="sm" onClick={() => setShowCreateRecord(true)}>Add Record</Button>
)}
</div>
</div>
@@ -221,14 +232,14 @@ const DNSZones = () => {
<tbody>
{records.map(rec => (
<tr key={rec.id}>
- <td><span className="badge badge--outline">{rec.record_type}</span></td>
+ <td><Badge variant="outline">{rec.record_type}</Badge></td>
<td>{rec.name}</td>
<td className="text-mono">{rec.content}</td>
<td>{rec.ttl}</td>
<td>{rec.priority || '-'}</td>
<td>
{user?.is_admin && (
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteRecord(rec.id)}>Delete</button>
+ <Button variant="destructive" size="sm" onClick={() => handleDeleteRecord(rec.id)}>Delete</Button>
)}
</td>
</tr>
@@ -251,17 +262,22 @@ const DNSZones = () => {
</div>
<div className="modal-body">
<div className="form-group">
- <label>Domain</label>
- <input className="form-input" value={zoneForm.domain} onChange={e => setZoneForm({...zoneForm, domain: e.target.value})} placeholder="example.com" />
+ <Label>Domain</Label>
+ <Input value={zoneForm.domain} onChange={e => setZoneForm({...zoneForm, domain: e.target.value})} placeholder="example.com" />
</div>
<div className="form-group">
- <label>Provider</label>
- <select className="form-select" value={zoneForm.provider} onChange={e => setZoneForm({...zoneForm, provider: e.target.value})}>
- <option value="manual">Manual</option>
- <option value="cloudflare">Cloudflare</option>
- <option value="route53">Route 53 (AWS)</option>
- <option value="digitalocean">DigitalOcean</option>
- </select>
+ <Label>Provider</Label>
+ <Select value={zoneForm.provider} onValueChange={v => setZoneForm({...zoneForm, provider: v})}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="manual">Manual</SelectItem>
+ <SelectItem value="cloudflare">Cloudflare</SelectItem>
+ <SelectItem value="route53">Route 53 (AWS)</SelectItem>
+ <SelectItem value="digitalocean">DigitalOcean</SelectItem>
+ </SelectContent>
+ </Select>
</div>
{zoneForm.provider !== 'manual' && (() => {
const cfg = PROVIDER_CONFIG[zoneForm.provider];
@@ -271,17 +287,17 @@ const DNSZones = () => {
<p className="text-muted text-sm">{cfg.helpText}</p>
)}
<div className="form-group">
- <label>{cfg.zoneLabel}</label>
- <input className="form-input" value={zoneForm.provider_zone_id} onChange={e => setZoneForm({...zoneForm, provider_zone_id: e.target.value})} placeholder={cfg.zonePlaceholder} />
+ <Label>{cfg.zoneLabel}</Label>
+ <Input value={zoneForm.provider_zone_id} onChange={e => setZoneForm({...zoneForm, provider_zone_id: e.target.value})} placeholder={cfg.zonePlaceholder} />
</div>
<div className="form-group">
- <label>{cfg.tokenLabel}</label>
- <input className="form-input" type="password" value={zoneForm.api_token} onChange={e => setZoneForm({...zoneForm, api_token: e.target.value})} placeholder={cfg.tokenPlaceholder} />
+ <Label>{cfg.tokenLabel}</Label>
+ <Input type="password" value={zoneForm.api_token} onChange={e => setZoneForm({...zoneForm, api_token: e.target.value})} placeholder={cfg.tokenPlaceholder} />
</div>
{cfg.extraFields?.map(field => (
<div className="form-group" key={field.key}>
- <label>{field.label}</label>
- <input className="form-input" type={field.type} value={zoneForm[field.key] || ''} onChange={e => setZoneForm({...zoneForm, [field.key]: e.target.value})} placeholder={field.placeholder} />
+ <Label>{field.label}</Label>
+ <Input type={field.type} value={zoneForm[field.key] || ''} onChange={e => setZoneForm({...zoneForm, [field.key]: e.target.value})} placeholder={field.placeholder} />
</div>
))}
</>
@@ -289,8 +305,8 @@ const DNSZones = () => {
})()}
</div>
<div className="modal-footer">
- <button className="btn" onClick={() => setShowCreateZone(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleCreateZone} disabled={!zoneForm.domain}>Create</button>
+ <Button variant="outline" onClick={() => setShowCreateZone(false)}>Cancel</Button>
+ <Button onClick={handleCreateZone} disabled={!zoneForm.domain}>Create</Button>
</div>
</div>
</div>
@@ -305,35 +321,40 @@ const DNSZones = () => {
</div>
<div className="modal-body">
<div className="form-group">
- <label>Type</label>
- <select className="form-select" value={recordForm.record_type} onChange={e => setRecordForm({...recordForm, record_type: e.target.value})}>
- {RECORD_TYPES.map(t => <option key={t} value={t}>{t}</option>)}
- </select>
+ <Label>Type</Label>
+ <Select value={recordForm.record_type} onValueChange={v => setRecordForm({...recordForm, record_type: v})}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ {RECORD_TYPES.map(t => <SelectItem key={t} value={t}>{t}</SelectItem>)}
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
- <label>Name</label>
- <input className="form-input" value={recordForm.name} onChange={e => setRecordForm({...recordForm, name: e.target.value})} placeholder="@ or subdomain" />
+ <Label>Name</Label>
+ <Input value={recordForm.name} onChange={e => setRecordForm({...recordForm, name: e.target.value})} placeholder="@ or subdomain" />
</div>
<div className="form-group">
- <label>Content</label>
- <input className="form-input" value={recordForm.content} onChange={e => setRecordForm({...recordForm, content: e.target.value})} placeholder="IP address or hostname" />
+ <Label>Content</Label>
+ <Input value={recordForm.content} onChange={e => setRecordForm({...recordForm, content: e.target.value})} placeholder="IP address or hostname" />
</div>
<div className="form-row">
<div className="form-group">
- <label>TTL</label>
- <input className="form-input" type="number" value={recordForm.ttl} onChange={e => setRecordForm({...recordForm, ttl: parseInt(e.target.value) || 3600})} />
+ <Label>TTL</Label>
+ <Input type="number" value={recordForm.ttl} onChange={e => setRecordForm({...recordForm, ttl: parseInt(e.target.value) || 3600})} />
</div>
{(recordForm.record_type === 'MX' || recordForm.record_type === 'SRV') && (
<div className="form-group">
- <label>Priority</label>
- <input className="form-input" type="number" value={recordForm.priority || ''} onChange={e => setRecordForm({...recordForm, priority: parseInt(e.target.value) || null})} />
+ <Label>Priority</Label>
+ <Input type="number" value={recordForm.priority || ''} onChange={e => setRecordForm({...recordForm, priority: parseInt(e.target.value) || null})} />
</div>
)}
</div>
</div>
<div className="modal-footer">
- <button className="btn" onClick={() => setShowCreateRecord(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleCreateRecord} disabled={!recordForm.content}>Create</button>
+ <Button variant="outline" onClick={() => setShowCreateRecord(false)}>Cancel</Button>
+ <Button onClick={handleCreateRecord} disabled={!recordForm.content}>Create</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsx
index 60ac7f5b..46d59db2 100644
--- a/frontend/src/pages/Dashboard.jsx
+++ b/frontend/src/pages/Dashboard.jsx
@@ -9,6 +9,8 @@ import api from '../services/api';
import { useMetrics } from '../hooks/useMetrics';
import MetricsGraph from '../components/MetricsGraph';
import useDashboardLayout from '../hooks/useDashboardLayout';
+import { Button } from '@/components/ui/button';
+import { Badge } from '@/components/ui/badge';
// Refresh interval options in seconds
const REFRESH_OPTIONS = [
@@ -386,9 +388,9 @@ const Dashboard = () => {
<div key="processes" className="table-panel">
<div className="table-header">
<span>Applications</span>
- <button className="btn btn-sm btn-secondary" onClick={loadData}>
+ <Button variant="outline" size="sm" onClick={loadData}>
<RefreshCw size={14} />
- </button>
+ </Button>
</div>
<table className="data-table">
<thead>
@@ -419,9 +421,9 @@ const Dashboard = () => {
</td>
<td>{app.app_type}</td>
<td>
- <span className={`badge badge-${app.status === 'running' ? 'running' : 'warning'}`}>
+ <Badge variant={app.status === 'running' ? 'success' : 'warning'}>
{app.status?.toUpperCase()}
- </span>
+ </Badge>
</td>
<td>{app.domains?.[0]?.name || '-'}</td>
</tr>
diff --git a/frontend/src/pages/DatabaseMigration.jsx b/frontend/src/pages/DatabaseMigration.jsx
index 2712e353..148d21b8 100644
--- a/frontend/src/pages/DatabaseMigration.jsx
+++ b/frontend/src/pages/DatabaseMigration.jsx
@@ -7,6 +7,8 @@ import {
Loader, CheckCircle, XCircle, RotateCcw, Shield
} from 'lucide-react';
import ServerKitLogo from '../components/ServerKitLogo';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
const TOTAL_STEPS = 4;
const STEP_TITLES = ['Overview', 'Backup', 'Apply', 'Done'];
@@ -182,23 +184,23 @@ const DatabaseMigration = () => {
{loginError && (
<div className="migration-error-inline">{loginError}</div>
)}
- <input
+ <Input
type="text"
placeholder="Email or username"
value={loginEmail}
onChange={e => setLoginEmail(e.target.value)}
required
/>
- <input
+ <Input
type="password"
placeholder="Password"
value={loginPassword}
onChange={e => setLoginPassword(e.target.value)}
required
/>
- <button type="submit" className="btn-wizard-next" disabled={loginLoading}>
+ <Button type="submit" className="btn-wizard-next" disabled={loginLoading}>
{loginLoading ? <Loader size={16} className="spin" /> : 'Sign In'}
- </button>
+ </Button>
</form>
</div>
)}
@@ -212,13 +214,13 @@ const DatabaseMigration = () => {
<div className="wizard-nav">
<div />
- <button
+ <Button
className="btn-wizard-next"
onClick={() => setCurrentStep(2)}
disabled={!isAuthenticated || !isAdmin}
>
Continue <ArrowRight size={16} />
- </button>
+ </Button>
</div>
</div>
)}
@@ -241,7 +243,7 @@ const DatabaseMigration = () => {
{!backupResult && (
<div className="migration-backup-actions">
- <button
+ <Button
className="btn-wizard-next"
onClick={handleBackup}
disabled={backupLoading}
@@ -251,7 +253,7 @@ const DatabaseMigration = () => {
) : (
<><Download size={16} /> Create Backup</>
)}
- </button>
+ </Button>
</div>
)}
@@ -276,25 +278,25 @@ const DatabaseMigration = () => {
)}
<div className="wizard-nav">
- <button className="btn-wizard-prev" onClick={() => setCurrentStep(1)}>
+ <Button variant="ghost" className="btn-wizard-prev" onClick={() => setCurrentStep(1)}>
Back
- </button>
+ </Button>
<div className="migration-nav-right">
{!backupResult?.success && (
- <button
- className="btn-text-link"
+ <Button
+ variant="link"
onClick={() => setCurrentStep(3)}
>
Skip backup
- </button>
+ </Button>
)}
- <button
+ <Button
className="btn-wizard-next"
onClick={() => setCurrentStep(3)}
disabled={!backupResult?.success}
>
Continue <ArrowRight size={16} />
- </button>
+ </Button>
</div>
</div>
</div>
@@ -313,9 +315,9 @@ const DatabaseMigration = () => {
{!applyLoading && !applyError && (
<div className="migration-apply-actions">
- <button className="btn-wizard-next" onClick={handleApply}>
+ <Button className="btn-wizard-next" onClick={handleApply}>
<Database size={16} /> Apply Updates
- </button>
+ </Button>
</div>
)}
@@ -333,17 +335,17 @@ const DatabaseMigration = () => {
<strong>Update failed</strong>
<span>{applyError}</span>
</div>
- <button className="btn-wizard-prev" onClick={handleApply}>
+ <Button variant="ghost" className="btn-wizard-prev" onClick={handleApply}>
<RotateCcw size={14} /> Retry
- </button>
+ </Button>
</div>
)}
{!applyLoading && (
<div className="wizard-nav">
- <button className="btn-wizard-prev" onClick={() => setCurrentStep(2)}>
+ <Button variant="ghost" className="btn-wizard-prev" onClick={() => setCurrentStep(2)}>
Back
- </button>
+ </Button>
<div />
</div>
)}
@@ -366,9 +368,9 @@ const DatabaseMigration = () => {
<div className="wizard-nav">
<div />
- <button className="btn-wizard-next" onClick={handleFinish}>
+ <Button className="btn-wizard-next" onClick={handleFinish}>
Continue to ServerKit <ArrowRight size={16} />
- </button>
+ </Button>
</div>
</div>
)}
diff --git a/frontend/src/pages/Databases.jsx b/frontend/src/pages/Databases.jsx
index b8d2ac69..27659dbe 100644
--- a/frontend/src/pages/Databases.jsx
+++ b/frontend/src/pages/Databases.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { useParams } from 'react-router-dom';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
@@ -6,6 +6,9 @@ import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
import QueryRunner from '../components/QueryRunner';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['mysql', 'postgresql', 'docker', 'backups', 'sqlite'];
@@ -60,46 +63,33 @@ const Databases = () => {
</div>
</header>
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'mysql' ? 'active' : ''}`}
- onClick={() => setActiveTab('mysql')}
- >
- MySQL / MariaDB
- </button>
- <button
- className={`tab ${activeTab === 'postgresql' ? 'active' : ''}`}
- onClick={() => setActiveTab('postgresql')}
- >
- PostgreSQL
- </button>
- <button
- className={`tab ${activeTab === 'docker' ? 'active' : ''}`}
- onClick={() => setActiveTab('docker')}
- >
- Docker Apps
- </button>
- <button
- className={`tab ${activeTab === 'backups' ? 'active' : ''}`}
- onClick={() => setActiveTab('backups')}
- >
- Backups
- </button>
- <button
- className={`tab ${activeTab === 'sqlite' ? 'active' : ''}`}
- onClick={() => setActiveTab('sqlite')}
- >
- SQLite
- </button>
- </div>
-
- <div className="tab-content">
- {activeTab === 'mysql' && <MySQLTab status={status?.mysql} />}
- {activeTab === 'postgresql' && <PostgreSQLTab status={status?.postgresql} />}
- {activeTab === 'docker' && <DockerDatabasesTab />}
- {activeTab === 'backups' && <BackupsTab />}
- {activeTab === 'sqlite' && <SQLiteTab />}
- </div>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ <TabsTrigger value="mysql">MySQL / MariaDB</TabsTrigger>
+ <TabsTrigger value="postgresql">PostgreSQL</TabsTrigger>
+ <TabsTrigger value="docker">Docker Apps</TabsTrigger>
+ <TabsTrigger value="backups">Backups</TabsTrigger>
+ <TabsTrigger value="sqlite">SQLite</TabsTrigger>
+ </TabsList>
+
+ <div className="tab-content">
+ <TabsContent value="mysql">
+ <MySQLTab status={status?.mysql} />
+ </TabsContent>
+ <TabsContent value="postgresql">
+ <PostgreSQLTab status={status?.postgresql} />
+ </TabsContent>
+ <TabsContent value="docker">
+ <DockerDatabasesTab />
+ </TabsContent>
+ <TabsContent value="backups">
+ <BackupsTab />
+ </TabsContent>
+ <TabsContent value="sqlite">
+ <SQLiteTab />
+ </TabsContent>
+ </div>
+ </Tabs>
</div>
);
};
@@ -206,27 +196,29 @@ const MySQLTab = ({ status }) => {
<div>
<div className="section-header">
<div className="view-toggle">
- <button
- className={`btn btn-sm ${view === 'databases' ? 'btn-primary' : 'btn-secondary'}`}
+ <Button
+ size="sm"
+ variant={view === 'databases' ? 'default' : 'outline'}
onClick={() => setView('databases')}
>
Databases ({databases.length})
- </button>
- <button
- className={`btn btn-sm ${view === 'users' ? 'btn-primary' : 'btn-secondary'}`}
+ </Button>
+ <Button
+ size="sm"
+ variant={view === 'users' ? 'default' : 'outline'}
onClick={() => setView('users')}
>
Users ({users.length})
- </button>
+ </Button>
</div>
{view === 'databases' ? (
- <button className="btn btn-primary" onClick={() => setShowCreateDbModal(true)}>
+ <Button onClick={() => setShowCreateDbModal(true)}>
Create Database
- </button>
+ </Button>
) : (
- <button className="btn btn-primary" onClick={() => setShowCreateUserModal(true)}>
+ <Button onClick={() => setShowCreateUserModal(true)}>
Create User
- </button>
+ </Button>
)}
</div>
@@ -257,30 +249,18 @@ const MySQLTab = ({ status }) => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-primary btn-sm"
- onClick={() => setQueryDb(db)}
- >
+ <Button size="sm" onClick={() => setQueryDb(db)}>
Query
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => setSelectedDb(db)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => setSelectedDb(db)}>
Tables
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleBackupDatabase(db.name)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => handleBackupDatabase(db.name)}>
Backup
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleDropDatabase(db.name)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => handleDropDatabase(db.name)}>
Drop
- </button>
+ </Button>
</div>
</div>
))}
@@ -311,12 +291,9 @@ const MySQLTab = ({ status }) => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleDropUser(user.user, user.host)}
- >
+ <Button size="sm" variant="outline" onClick={() => handleDropUser(user.user, user.host)}>
Drop
- </button>
+ </Button>
</div>
</div>
))}
@@ -470,27 +447,29 @@ const PostgreSQLTab = ({ status }) => {
<div>
<div className="section-header">
<div className="view-toggle">
- <button
- className={`btn btn-sm ${view === 'databases' ? 'btn-primary' : 'btn-secondary'}`}
+ <Button
+ size="sm"
+ variant={view === 'databases' ? 'default' : 'outline'}
onClick={() => setView('databases')}
>
Databases ({databases.length})
- </button>
- <button
- className={`btn btn-sm ${view === 'users' ? 'btn-primary' : 'btn-secondary'}`}
+ </Button>
+ <Button
+ size="sm"
+ variant={view === 'users' ? 'default' : 'outline'}
onClick={() => setView('users')}
>
Users ({users.length})
- </button>
+ </Button>
</div>
{view === 'databases' ? (
- <button className="btn btn-primary" onClick={() => setShowCreateDbModal(true)}>
+ <Button onClick={() => setShowCreateDbModal(true)}>
Create Database
- </button>
+ </Button>
) : (
- <button className="btn btn-primary" onClick={() => setShowCreateUserModal(true)}>
+ <Button onClick={() => setShowCreateUserModal(true)}>
Create User
- </button>
+ </Button>
)}
</div>
@@ -521,30 +500,18 @@ const PostgreSQLTab = ({ status }) => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-primary btn-sm"
- onClick={() => setQueryDb(db)}
- >
+ <Button size="sm" onClick={() => setQueryDb(db)}>
Query
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => setSelectedDb(db)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => setSelectedDb(db)}>
Tables
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleBackupDatabase(db.name)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => handleBackupDatabase(db.name)}>
Backup
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleDropDatabase(db.name)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => handleDropDatabase(db.name)}>
Drop
- </button>
+ </Button>
</div>
</div>
))}
@@ -575,12 +542,9 @@ const PostgreSQLTab = ({ status }) => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleDropUser(user.user)}
- >
+ <Button size="sm" variant="outline" onClick={() => handleDropUser(user.user)}>
Drop
- </button>
+ </Button>
</div>
</div>
))}
@@ -675,24 +639,15 @@ const BackupsTab = () => {
<div>
<div className="section-header">
<div className="view-toggle">
- <button
- className={`btn btn-sm ${filter === 'all' ? 'btn-primary' : 'btn-secondary'}`}
- onClick={() => setFilter('all')}
- >
+ <Button size="sm" variant={filter === 'all' ? 'default' : 'outline'} onClick={() => setFilter('all')}>
All
- </button>
- <button
- className={`btn btn-sm ${filter === 'mysql' ? 'btn-primary' : 'btn-secondary'}`}
- onClick={() => setFilter('mysql')}
- >
+ </Button>
+ <Button size="sm" variant={filter === 'mysql' ? 'default' : 'outline'} onClick={() => setFilter('mysql')}>
MySQL
- </button>
- <button
- className={`btn btn-sm ${filter === 'postgresql' ? 'btn-primary' : 'btn-secondary'}`}
- onClick={() => setFilter('postgresql')}
- >
+ </Button>
+ <Button size="sm" variant={filter === 'postgresql' ? 'default' : 'outline'} onClick={() => setFilter('postgresql')}>
PostgreSQL
- </button>
+ </Button>
</div>
</div>
@@ -726,12 +681,9 @@ const BackupsTab = () => {
<span className={`db-type-badge ${backup.type}`}>
{backup.type === 'mysql' ? 'MySQL' : 'PostgreSQL'}
</span>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => handleDelete(backup.filename)}
- >
+ <Button size="sm" variant="outline" onClick={() => handleDelete(backup.filename)}>
Delete
- </button>
+ </Button>
</div>
</div>
))}
@@ -799,7 +751,7 @@ const CreateMySQLDatabaseModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-body">
<div className="credentials-box">
- <p>Save these credentials - the password won't be shown again!</p>
+ <p>Save these credentials - the password won&apos;t be shown again!</p>
<div className="credential-item">
<label>Database:</label>
<code>{createdInfo.database}</code>
@@ -815,9 +767,9 @@ const CreateMySQLDatabaseModal = ({ onClose, onCreated }) => {
</div>
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={() => { onCreated(); onClose(); }}>
+ <Button onClick={() => { onCreated(); onClose(); }}>
Done
- </button>
+ </Button>
</div>
</div>
</div>
@@ -837,7 +789,7 @@ const CreateMySQLDatabaseModal = ({ onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Database Name *</label>
- <input
+ <Input
type="text"
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
@@ -884,12 +836,12 @@ const CreateMySQLDatabaseModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Database'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -965,9 +917,9 @@ const CreateMySQLUserModal = ({ databases, onClose, onCreated }) => {
</div>
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={() => { onCreated(); onClose(); }}>
+ <Button onClick={() => { onCreated(); onClose(); }}>
Done
- </button>
+ </Button>
</div>
</div>
</div>
@@ -987,7 +939,7 @@ const CreateMySQLUserModal = ({ databases, onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Username *</label>
- <input
+ <Input
type="text"
value={formData.username}
onChange={(e) => setFormData({ ...formData, username: e.target.value })}
@@ -999,15 +951,15 @@ const CreateMySQLUserModal = ({ databases, onClose, onCreated }) => {
<div className="form-group">
<label>Password</label>
<div className="input-with-button">
- <input
+ <Input
type="text"
value={formData.password}
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
placeholder="Leave empty to auto-generate"
/>
- <button type="button" className="btn btn-secondary btn-sm" onClick={generatePassword}>
+ <Button type="button" variant="outline" size="sm" onClick={generatePassword}>
Generate
- </button>
+ </Button>
</div>
</div>
@@ -1037,12 +989,12 @@ const CreateMySQLUserModal = ({ databases, onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create User'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1112,9 +1064,9 @@ const CreatePostgreSQLDatabaseModal = ({ onClose, onCreated }) => {
</div>
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={() => { onCreated(); onClose(); }}>
+ <Button onClick={() => { onCreated(); onClose(); }}>
Done
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1134,7 +1086,7 @@ const CreatePostgreSQLDatabaseModal = ({ onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Database Name *</label>
- <input
+ <Input
type="text"
value={formData.name}
onChange={(e) => setFormData({ ...formData, name: e.target.value })}
@@ -1167,12 +1119,12 @@ const CreatePostgreSQLDatabaseModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Database'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1241,9 +1193,9 @@ const CreatePostgreSQLUserModal = ({ databases, onClose, onCreated }) => {
</div>
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={() => { onCreated(); onClose(); }}>
+ <Button onClick={() => { onCreated(); onClose(); }}>
Done
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1263,7 +1215,7 @@ const CreatePostgreSQLUserModal = ({ databases, onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Username *</label>
- <input
+ <Input
type="text"
value={formData.username}
onChange={(e) => setFormData({ ...formData, username: e.target.value })}
@@ -1275,15 +1227,15 @@ const CreatePostgreSQLUserModal = ({ databases, onClose, onCreated }) => {
<div className="form-group">
<label>Password</label>
<div className="input-with-button">
- <input
+ <Input
type="text"
value={formData.password}
onChange={(e) => setFormData({ ...formData, password: e.target.value })}
placeholder="Leave empty to auto-generate"
/>
- <button type="button" className="btn btn-secondary btn-sm" onClick={generatePassword}>
+ <Button type="button" variant="outline" size="sm" onClick={generatePassword}>
Generate
- </button>
+ </Button>
</div>
</div>
@@ -1301,12 +1253,12 @@ const CreatePostgreSQLUserModal = ({ databases, onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create User'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1362,7 +1314,7 @@ const TablesModal = ({ database, dbType, onClose }) => {
)}
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -1401,9 +1353,9 @@ const SQLiteTab = () => {
<div className="hint">
Showing .db, .sqlite, and .sqlite3 files found in /var/www, /home, and /opt
</div>
- <button className="btn btn-secondary" onClick={loadDatabases}>
+ <Button variant="outline" onClick={loadDatabases}>
Refresh
- </button>
+ </Button>
</div>
{databases.length === 0 ? (
@@ -1432,18 +1384,12 @@ const SQLiteTab = () => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-primary btn-sm"
- onClick={() => setQueryDb(db)}
- >
+ <Button size="sm" onClick={() => setQueryDb(db)}>
Query
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => setSelectedDb(db)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => setSelectedDb(db)}>
Tables
- </button>
+ </Button>
</div>
</div>
))}
@@ -1511,7 +1457,7 @@ const SQLiteTablesModal = ({ database, onClose }) => {
)}
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -1570,9 +1516,9 @@ const DockerDatabasesTab = () => {
<div className="hint">
Databases running inside Docker containers from your deployed apps
</div>
- <button className="btn btn-secondary" onClick={loadData}>
+ <Button variant="outline" onClick={loadData}>
Refresh
- </button>
+ </Button>
</div>
{apps.length === 0 ? (
@@ -1603,12 +1549,9 @@ const DockerDatabasesTab = () => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-primary btn-sm"
- onClick={() => loadAppDbInfo(app)}
- >
+ <Button size="sm" onClick={() => loadAppDbInfo(app)}>
View Databases
- </button>
+ </Button>
</div>
</div>
))}
@@ -1662,7 +1605,7 @@ const DockerAppDbModal = ({ app, databases, onClose, onQuery }) => {
</div>
<div className="modal-body">
{databases.length === 0 ? (
- <p className="hint">No databases found in this app's containers.</p>
+ <p className="hint">No databases found in this app&apos;s containers.</p>
) : (
<div className="db-list">
{databases.map((db, idx) => (
@@ -1685,8 +1628,8 @@ const DockerAppDbModal = ({ app, databases, onClose, onQuery }) => {
</div>
</div>
<div className="db-item-actions">
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ size="sm"
onClick={() => onQuery({
name: db.database,
container: db.container,
@@ -1695,13 +1638,10 @@ const DockerAppDbModal = ({ app, databases, onClose, onQuery }) => {
})}
>
Query
- </button>
- <button
- className="btn btn-secondary btn-sm"
- onClick={() => loadTables(db)}
- >
+ </Button>
+ <Button size="sm" variant="outline" onClick={() => loadTables(db)}>
Tables
- </button>
+ </Button>
</div>
{tables[db.container + db.database] && (
<div className="tables-inline">
@@ -1754,7 +1694,7 @@ const DockerAppDbModal = ({ app, databases, onClose, onQuery }) => {
</div>
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Deployments.jsx b/frontend/src/pages/Deployments.jsx
index 17f506a5..1c7c333c 100644
--- a/frontend/src/pages/Deployments.jsx
+++ b/frontend/src/pages/Deployments.jsx
@@ -12,6 +12,7 @@ import {
} from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
const STATUS_COLORS = {
pending: { bg: 'rgba(148,163,184,0.15)', fg: '#94a3b8', icon: Clock },
@@ -158,17 +159,17 @@ const Deployments = () => {
</p>
</div>
<div style={{ display: 'flex', gap: 8 }}>
- <button
- className={`btn ${autoRefresh ? 'btn-primary' : 'btn-secondary'}`}
+ <Button
+ variant={autoRefresh ? 'default' : 'outline'}
onClick={() => setAutoRefresh((v) => !v)}
title="Auto-refresh every 3s"
>
<RefreshCw size={16} className={autoRefresh ? 'spin' : ''} />
{autoRefresh ? 'Live' : 'Paused'}
- </button>
- <button className="btn btn-secondary" onClick={loadJobs}>
+ </Button>
+ <Button variant="outline" onClick={loadJobs}>
<RefreshCw size={16} /> Refresh
- </button>
+ </Button>
</div>
</div>
diff --git a/frontend/src/pages/Docker.jsx b/frontend/src/pages/Docker.jsx
index 7c49217b..3db66891 100644
--- a/frontend/src/pages/Docker.jsx
+++ b/frontend/src/pages/Docker.jsx
@@ -4,6 +4,9 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
// Server context for Docker operations
const ServerContext = createContext({ serverId: 'local', serverName: 'Local' });
@@ -196,13 +199,13 @@ const Docker = () => {
<li>Verify the user has permissions to access Docker</li>
</ul>
</div>
- <button className="btn btn-primary" onClick={checkDockerStatus}>
+ <Button onClick={checkDockerStatus}>
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<path d="M23 4v6h-6M1 20v-6h6"/>
<path d="M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15"/>
</svg>
Retry Connection
- </button>
+ </Button>
</div>
</div>
);
@@ -326,9 +329,9 @@ const RunContainerButton = () => {
const [showModal, setShowModal] = useState(false);
return (
<>
- <button className="btn btn-primary" onClick={() => setShowModal(true)}>
+ <Button onClick={() => setShowModal(true)}>
<span>+</span> Run Container
- </button>
+ </Button>
{showModal && <RunContainerModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
</>
);
@@ -338,9 +341,9 @@ const PullImageButton = () => {
const [showModal, setShowModal] = useState(false);
return (
<>
- <button className="btn btn-primary" onClick={() => setShowModal(true)}>
+ <Button onClick={() => setShowModal(true)}>
<span>+</span> Pull Image
- </button>
+ </Button>
{showModal && <PullImageModal onClose={() => setShowModal(false)} onPulled={() => window.location.reload()} />}
</>
);
@@ -350,9 +353,9 @@ const CreateNetworkButton = () => {
const [showModal, setShowModal] = useState(false);
return (
<>
- <button className="btn btn-primary" onClick={() => setShowModal(true)}>
+ <Button onClick={() => setShowModal(true)}>
<span>+</span> Create Network
- </button>
+ </Button>
{showModal && <CreateNetworkModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
</>
);
@@ -362,9 +365,9 @@ const CreateVolumeButton = () => {
const [showModal, setShowModal] = useState(false);
return (
<>
- <button className="btn btn-primary" onClick={() => setShowModal(true)}>
+ <Button onClick={() => setShowModal(true)}>
<span>+</span> Create Volume
- </button>
+ </Button>
{showModal && <CreateVolumeModal onClose={() => setShowModal(false)} onCreated={() => window.location.reload()} />}
</>
);
@@ -393,9 +396,9 @@ const PruneButton = ({ onPruned }) => {
return (
<>
- <button className="btn btn-secondary btn-sm" onClick={handlePrune} disabled={loading}>
+ <Button variant="outline" size="sm" onClick={handlePrune} disabled={loading}>
{loading ? 'Cleaning...' : 'Prune Unused'}
- </button>
+ </Button>
<ConfirmDialog
isOpen={confirmState.isOpen}
title={confirmState.title}
@@ -629,7 +632,7 @@ const ContainersTab = ({ onStatsChange }) => {
/>
Show stopped
</label>
- <input
+ <Input
type="text"
className="docker-search"
placeholder="Search ID or Name..."
@@ -826,7 +829,7 @@ const ImagesTab = ({ onStatsChange }) => {
<div>
<div className="docker-table-header">
<div />
- <input
+ <Input
type="text"
className="docker-search"
placeholder="Search images..."
@@ -1217,9 +1220,9 @@ const ComposeTab = ({ onStatsChange }) => {
<div className="docker-table-info">
{projects.length} project{projects.length !== 1 ? 's' : ''} found
</div>
- <button className="btn btn-secondary btn-sm" onClick={loadProjects}>
+ <Button variant="outline" size="sm" onClick={loadProjects}>
Refresh
- </button>
+ </Button>
</div>
{projects.length === 0 ? (
@@ -1437,10 +1440,10 @@ const ComposeLogsModal = ({ project, onClose }) => {
<pre className="log-viewer">{loading ? 'Loading...' : logs}</pre>
</div>
<div className="modal-actions">
- <button className="btn btn-secondary" onClick={loadLogs} disabled={loading}>
+ <Button variant="outline" onClick={loadLogs} disabled={loading}>
{loading ? 'Loading...' : 'Refresh'}
- </button>
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ </Button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -1505,7 +1508,7 @@ const RunContainerModal = ({ onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Image *</label>
- <input
+ <Input
type="text"
name="image"
value={formData.image}
@@ -1517,7 +1520,7 @@ const RunContainerModal = ({ onClose, onCreated }) => {
<div className="form-group">
<label>Container Name</label>
- <input
+ <Input
type="text"
name="name"
value={formData.name}
@@ -1528,7 +1531,7 @@ const RunContainerModal = ({ onClose, onCreated }) => {
<div className="form-group">
<label>Ports (comma-separated)</label>
- <input
+ <Input
type="text"
name="ports"
value={formData.ports}
@@ -1539,7 +1542,7 @@ const RunContainerModal = ({ onClose, onCreated }) => {
<div className="form-group">
<label>Volumes (comma-separated)</label>
- <input
+ <Input
type="text"
name="volumes"
value={formData.volumes}
@@ -1550,7 +1553,7 @@ const RunContainerModal = ({ onClose, onCreated }) => {
<div className="form-group">
<label>Environment Variables (one per line, KEY=value)</label>
- <textarea
+ <Textarea
name="env"
value={formData.env}
onChange={handleChange}
@@ -1560,12 +1563,12 @@ const RunContainerModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Running...' : 'Run Container'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1622,10 +1625,10 @@ const ContainerLogsModal = ({ container, onClose }) => {
<pre className="log-viewer">{loading ? 'Loading...' : logs}</pre>
</div>
<div className="modal-actions">
- <button className="btn btn-secondary" onClick={loadLogs} disabled={loading}>
+ <Button variant="outline" onClick={loadLogs} disabled={loading}>
{loading ? 'Loading...' : 'Refresh'}
- </button>
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ </Button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -1751,14 +1754,14 @@ const ContainerExecModal = ({ container, onClose }) => {
autoComplete="off"
spellCheck="false"
/>
- <button type="submit" className="btn btn-primary btn-sm" disabled={loading || !command.trim()}>
+ <Button type="submit" size="sm" disabled={loading || !command.trim()}>
Run
- </button>
+ </Button>
</form>
</div>
<div className="modal-actions">
- <button className="btn btn-secondary" onClick={clearOutput}>Clear</button>
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button variant="outline" onClick={clearOutput}>Clear</Button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
@@ -1800,7 +1803,7 @@ const PullImageModal = ({ onClose, onPulled }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Image Name *</label>
- <input
+ <Input
type="text"
value={image}
onChange={(e) => setImage(e.target.value)}
@@ -1811,7 +1814,7 @@ const PullImageModal = ({ onClose, onPulled }) => {
<div className="form-group">
<label>Tag</label>
- <input
+ <Input
type="text"
value={tag}
onChange={(e) => setTag(e.target.value)}
@@ -1820,12 +1823,12 @@ const PullImageModal = ({ onClose, onPulled }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Pulling...' : 'Pull Image'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1868,7 +1871,7 @@ const CreateNetworkModal = ({ onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Network Name *</label>
- <input
+ <Input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
@@ -1887,12 +1890,12 @@ const CreateNetworkModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Network'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1934,7 +1937,7 @@ const CreateVolumeModal = ({ onClose, onCreated }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
<label>Volume Name *</label>
- <input
+ <Input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
@@ -1944,12 +1947,12 @@ const CreateVolumeModal = ({ onClose, onCreated }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Volume'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index b671ec12..b8b57d17 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -6,6 +6,18 @@ import {
} from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Checkbox } from '@/components/ui/checkbox';
+import {
+ Select,
+ SelectTrigger,
+ SelectContent,
+ SelectItem,
+ SelectValue,
+} from '@/components/ui/select';
const Domains = () => {
const toast = useToast();
@@ -155,14 +167,14 @@ const Domains = () => {
<p className="subtitle">Manage your domains and SSL certificates</p>
</div>
<div className="top-bar-actions">
- <button className="btn btn-secondary" onClick={loadData}>
+ <Button variant="outline" onClick={loadData}>
<RefreshCw size={16} />
Refresh
- </button>
- <button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
+ </Button>
+ <Button onClick={() => setShowAddModal(true)}>
<Plus size={16} />
Add Domain
- </button>
+ </Button>
</div>
</header>
@@ -209,10 +221,10 @@ const Domains = () => {
<Globe size={48} />
<h3>No domains configured</h3>
<p>Add a domain to your application to get started.</p>
- <button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
+ <Button onClick={() => setShowAddModal(true)}>
<Plus size={16} />
Add Domain
- </button>
+ </Button>
</div>
) : (
<div className="domain-list">
@@ -242,42 +254,46 @@ const Domains = () => {
</div>
</div>
<div className="domain-item-actions">
- <a
- href={`${domain.ssl_enabled ? 'https' : 'http'}://${domain.name}`}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-secondary btn-sm"
- >
- <ExternalLink size={14} />
- Visit
- </a>
- <button
- className="btn btn-secondary btn-sm"
+ <Button variant="outline" size="sm" asChild>
+ <a
+ href={`${domain.ssl_enabled ? 'https' : 'http'}://${domain.name}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <ExternalLink size={14} />
+ Visit
+ </a>
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleVerifyDomain(domain)}
>
<Search size={14} />
Verify DNS
- </button>
+ </Button>
{domain.ssl_enabled ? (
<>
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleRenewSsl(domain)}
disabled={actionLoading}
>
<RefreshCw size={14} />
Renew SSL
- </button>
- <button
- className="btn btn-secondary btn-sm"
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleDisableSsl(domain)}
>
<Unlock size={14} />
- </button>
+ </Button>
</>
) : (
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ size="sm"
onClick={() => {
setSelectedDomain(domain);
setShowSslModal(true);
@@ -285,14 +301,15 @@ const Domains = () => {
>
<Lock size={14} />
Enable SSL
- </button>
+ </Button>
)}
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleDeleteDomain(domain)}
>
<Trash2 size={14} />
- </button>
+ </Button>
</div>
</div>
))}
@@ -328,15 +345,15 @@ const Domains = () => {
</div>
<div className="cert-status">
{cert.expiry_valid ? (
- <span className="status-badge status-active">
+ <Badge variant="success">
<CheckCircle size={14} />
Valid
- </span>
+ </Badge>
) : (
- <span className="status-badge status-warning">
+ <Badge variant="warning">
<AlertTriangle size={14} />
Expiring Soon
- </span>
+ </Badge>
)}
</div>
</div>
@@ -355,8 +372,8 @@ const Domains = () => {
</div>
<form onSubmit={handleAddDomain}>
<div className="form-group">
- <label>Domain Name</label>
- <input
+ <Label>Domain Name</Label>
+ <Input
type="text"
placeholder="example.com"
value={domainName}
@@ -365,35 +382,34 @@ const Domains = () => {
/>
</div>
<div className="form-group">
- <label>Application</label>
- <select
- value={selectedAppId}
- onChange={e => setSelectedAppId(e.target.value)}
- required
- >
- <option value="">Select an application</option>
- {apps.map(app => (
- <option key={app.id} value={app.id}>{app.name}</option>
- ))}
- </select>
+ <Label>Application</Label>
+ <Select value={selectedAppId} onValueChange={setSelectedAppId} required>
+ <SelectTrigger>
+ <SelectValue placeholder="Select an application" />
+ </SelectTrigger>
+ <SelectContent>
+ {apps.map(app => (
+ <SelectItem key={app.id} value={String(app.id)}>{app.name}</SelectItem>
+ ))}
+ </SelectContent>
+ </Select>
</div>
<div className="form-group">
<label className="checkbox-label">
- <input
- type="checkbox"
+ <Checkbox
checked={isPrimary}
- onChange={e => setIsPrimary(e.target.checked)}
+ onCheckedChange={setIsPrimary}
/>
Set as primary domain
</label>
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={() => setShowAddModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowAddModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={actionLoading}>
+ </Button>
+ <Button type="submit" disabled={actionLoading}>
{actionLoading ? 'Adding...' : 'Add Domain'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -417,8 +433,8 @@ const Domains = () => {
</div>
</div>
<div className="form-group">
- <label>Email Address</label>
- <input
+ <Label>Email Address</Label>
+ <Input
type="email"
placeholder="[email protected]"
value={sslEmail}
@@ -428,12 +444,12 @@ const Domains = () => {
<p className="hint">Required for certificate expiration notifications</p>
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={() => setShowSslModal(false)}>
+ <Button type="button" variant="outline" onClick={() => setShowSslModal(false)}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={actionLoading}>
+ </Button>
+ <Button type="submit" disabled={actionLoading}>
{actionLoading ? 'Obtaining Certificate...' : 'Enable SSL'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/Downloads.jsx b/frontend/src/pages/Downloads.jsx
index a056fe28..36614241 100644
--- a/frontend/src/pages/Downloads.jsx
+++ b/frontend/src/pages/Downloads.jsx
@@ -1,5 +1,6 @@
import React, { useState, useEffect } from 'react';
import api from '../services/api';
+import { Button } from '@/components/ui/button';
// Platform icons as SVG components
const LinuxIcon = () => (
@@ -159,10 +160,10 @@ function Downloads() {
Download and install the ServerKit Agent on your servers to enable remote management.
</p>
</div>
- <button className="btn btn-secondary" onClick={fetchVersionInfo}>
+ <Button variant="outline" onClick={fetchVersionInfo}>
<RefreshIcon />
Refresh
- </button>
+ </Button>
</div>
{error && (
@@ -225,14 +226,14 @@ function Downloads() {
<h3>{platform.name}</h3>
<span className="platform-arch">{platform.arch}</span>
</div>
- <button
- className="btn btn-primary download-btn"
+ <Button
+ className="download-btn"
onClick={() => handleDownload(platform.os, platform.archKey)}
disabled={!isAvailable}
>
<DownloadIcon />
{isAvailable ? 'Download' : 'Not Available'}
- </button>
+ </Button>
</div>
);
})}
@@ -335,15 +336,16 @@ function Downloads() {
Verify your download using the SHA256 checksums:
</p>
{versionInfo.checksums_url && (
- <a
- href={versionInfo.checksums_url}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-secondary"
- >
- <DownloadIcon />
- Download Checksums
- </a>
+ <Button variant="outline" asChild>
+ <a
+ href={versionInfo.checksums_url}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <DownloadIcon />
+ Download Checksums
+ </a>
+ </Button>
)}
<div className="verification-command">
<pre><code>sha256sum -c checksums.txt</code></pre>
diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsx
index 3759db82..d862c2a9 100644
--- a/frontend/src/pages/Email.jsx
+++ b/frontend/src/pages/Email.jsx
@@ -4,6 +4,10 @@ import { api } from '../services/api';
import { useToast } from '../contexts/ToastContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['status', 'domains', 'accounts', 'aliases', 'forwarding', 'dns-providers', 'spam', 'webmail', 'queue'];
@@ -460,16 +464,16 @@ function Email() {
<h3>{name}</h3>
{data?.version && <span className="version">v{data.version}</span>}
</div>
- <span className={`status-badge ${data?.running ? 'online' : 'offline'}`}>
+ <Badge variant={data?.running ? 'success' : 'secondary'}>
{data?.running ? 'Running' : data?.installed ? 'Stopped' : 'Not Installed'}
- </span>
+ </Badge>
</div>
{data?.installed && (
<div className="email-service-actions">
- <button className="btn btn-sm" onClick={() => handleServiceControl(component, 'restart')} disabled={actionLoading}>Restart</button>
+ <Button size="sm" variant="outline" onClick={() => handleServiceControl(component, 'restart')} disabled={actionLoading}>Restart</Button>
{data?.running
- ? <button className="btn btn-sm" onClick={() => handleServiceControl(component, 'stop')} disabled={actionLoading}>Stop</button>
- : <button className="btn btn-sm btn-primary" onClick={() => handleServiceControl(component, 'start')} disabled={actionLoading}>Start</button>
+ ? <Button size="sm" variant="outline" onClick={() => handleServiceControl(component, 'stop')} disabled={actionLoading}>Stop</Button>
+ : <Button size="sm" onClick={() => handleServiceControl(component, 'start')} disabled={actionLoading}>Start</Button>
}
</div>
)}
@@ -484,7 +488,7 @@ function Email() {
<p className="page-description">Manage Postfix, Dovecot, DKIM, SpamAssassin, and Roundcube</p>
</div>
<div className="page-header-actions">
- <button className="btn btn-sm" onClick={loadStatus}>Refresh</button>
+ <Button size="sm" variant="outline" onClick={loadStatus}>Refresh</Button>
</div>
</div>
@@ -496,451 +500,459 @@ function Email() {
<div className="install-form">
<div className="form-group w-full">
<label>Hostname (e.g. mail.example.com)</label>
- <input type="text" value={installHostname} onChange={e => setInstallHostname(e.target.value)} placeholder="mail.example.com" />
+ <Input type="text" value={installHostname} onChange={e => setInstallHostname(e.target.value)} placeholder="mail.example.com" />
</div>
- <button className="btn btn-primary" onClick={handleInstall} disabled={actionLoading}>
+ <Button onClick={handleInstall} disabled={actionLoading}>
{actionLoading ? 'Installing...' : 'Install Email Server'}
- </button>
+ </Button>
</div>
</div>
) : (
<>
- <div className="tab-navigation">
- {VALID_TABS.map(tab => (
- <button key={tab} className={`tab-button ${activeTab === tab ? 'active' : ''}`} onClick={() => setActiveTab(tab)}>
- {tab === 'dns-providers' ? 'DNS Providers' : tab.charAt(0).toUpperCase() + tab.slice(1)}
- </button>
- ))}
- </div>
-
- {/* Status Tab */}
- {activeTab === 'status' && (
- <div className="email-status">
- <div className="status-grid">
- <ServiceCard name="Postfix (SMTP)" data={status?.postfix} component="postfix" />
- <ServiceCard name="Dovecot (IMAP)" data={status?.dovecot} component="dovecot" />
- <ServiceCard name="OpenDKIM" data={status?.dkim} component="opendkim" />
- <ServiceCard name="SpamAssassin" data={status?.spamassassin} component="spamassassin" />
- <ServiceCard name="Roundcube" data={status?.roundcube} component="roundcube" />
- </div>
- </div>
- )}
-
- {/* Domains Tab */}
- {activeTab === 'domains' && (
- <div className="email-domains">
- <div className="section-header">
- <h2>Email Domains</h2>
- <button className="btn btn-primary btn-sm" onClick={() => setShowDomainForm(!showDomainForm)}>
- {showDomainForm ? 'Cancel' : 'Add Domain'}
- </button>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ {VALID_TABS.map(tab => (
+ <TabsTrigger key={tab} value={tab}>
+ {tab === 'dns-providers' ? 'DNS Providers' : tab.charAt(0).toUpperCase() + tab.slice(1)}
+ </TabsTrigger>
+ ))}
+ </TabsList>
+
+ {/* Status Tab */}
+ <TabsContent value="status">
+ <div className="email-status">
+ <div className="status-grid">
+ <ServiceCard name="Postfix (SMTP)" data={status?.postfix} component="postfix" />
+ <ServiceCard name="Dovecot (IMAP)" data={status?.dovecot} component="dovecot" />
+ <ServiceCard name="OpenDKIM" data={status?.dkim} component="opendkim" />
+ <ServiceCard name="SpamAssassin" data={status?.spamassassin} component="spamassassin" />
+ <ServiceCard name="Roundcube" data={status?.roundcube} component="roundcube" />
+ </div>
</div>
- {showDomainForm && (
- <form className="email-form" onSubmit={handleAddDomain}>
- <div className="form-grid">
- <div className="form-group">
- <label>Domain Name</label>
- <input type="text" value={newDomain.name} onChange={e => setNewDomain({ ...newDomain, name: e.target.value })} placeholder="example.com" required />
- </div>
- </div>
- <div className="form-actions">
- <button type="submit" className="btn btn-primary btn-sm" disabled={actionLoading}>Add Domain</button>
- </div>
- </form>
- )}
- <div className="domain-list">
- {domains.length === 0 ? (
- <div className="empty-state"><p>No domains configured</p></div>
- ) : domains.map(d => (
- <div key={d.id} className="domain-card">
- <div className="domain-header">
- <h3>{d.name}</h3>
- <span className={`status-badge ${d.is_active ? 'online' : 'offline'}`}>{d.is_active ? 'Active' : 'Inactive'}</span>
- </div>
- <div className="domain-stats">
- <span>{d.accounts_count} accounts</span>
- <span>{d.aliases_count} aliases</span>
+ </TabsContent>
+
+ {/* Domains Tab */}
+ <TabsContent value="domains">
+ <div className="email-domains">
+ <div className="section-header">
+ <h2>Email Domains</h2>
+ <Button size="sm" variant={showDomainForm ? 'outline' : 'default'} onClick={() => setShowDomainForm(!showDomainForm)}>
+ {showDomainForm ? 'Cancel' : 'Add Domain'}
+ </Button>
+ </div>
+ {showDomainForm && (
+ <form className="email-form" onSubmit={handleAddDomain}>
+ <div className="form-grid">
+ <div className="form-group">
+ <label>Domain Name</label>
+ <Input type="text" value={newDomain.name} onChange={e => setNewDomain({ ...newDomain, name: e.target.value })} placeholder="example.com" required />
+ </div>
</div>
- <div className="domain-dns">
- <span className={`dns-badge ${d.dkim_public_key ? 'verified' : 'missing'}`}>DKIM</span>
- <span className={`dns-badge ${d.spf_record ? 'verified' : 'missing'}`}>SPF</span>
- <span className={`dns-badge ${d.dmarc_record ? 'verified' : 'missing'}`}>DMARC</span>
+ <div className="form-actions">
+ <Button type="submit" size="sm" disabled={actionLoading}>Add Domain</Button>
</div>
- <div className="domain-actions">
- <button className="btn btn-sm" onClick={() => handleVerifyDNS(d.id)} disabled={actionLoading}>Verify DNS</button>
- {d.dns_provider_id && <button className="btn btn-sm btn-primary" onClick={() => handleDeployDNS(d.id)} disabled={actionLoading}>Deploy DNS</button>}
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteDomain(d.id, d.name)}>Delete</button>
+ </form>
+ )}
+ <div className="domain-list">
+ {domains.length === 0 ? (
+ <div className="empty-state"><p>No domains configured</p></div>
+ ) : domains.map(d => (
+ <div key={d.id} className="domain-card">
+ <div className="domain-header">
+ <h3>{d.name}</h3>
+ <Badge variant={d.is_active ? 'success' : 'secondary'}>
+ {d.is_active ? 'Active' : 'Inactive'}
+ </Badge>
+ </div>
+ <div className="domain-stats">
+ <span>{d.accounts_count} accounts</span>
+ <span>{d.aliases_count} aliases</span>
+ </div>
+ <div className="domain-dns">
+ <span className={`dns-badge ${d.dkim_public_key ? 'verified' : 'missing'}`}>DKIM</span>
+ <span className={`dns-badge ${d.spf_record ? 'verified' : 'missing'}`}>SPF</span>
+ <span className={`dns-badge ${d.dmarc_record ? 'verified' : 'missing'}`}>DMARC</span>
+ </div>
+ <div className="domain-actions">
+ <Button size="sm" variant="outline" onClick={() => handleVerifyDNS(d.id)} disabled={actionLoading}>Verify DNS</Button>
+ {d.dns_provider_id && <Button size="sm" onClick={() => handleDeployDNS(d.id)} disabled={actionLoading}>Deploy DNS</Button>}
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteDomain(d.id, d.name)}>Delete</Button>
+ </div>
</div>
- </div>
- ))}
- </div>
- </div>
- )}
-
- {/* Accounts Tab */}
- {activeTab === 'accounts' && (
- <div className="email-accounts">
- <div className="domain-selector">
- <div className="form-group">
- <label>Select Domain</label>
- <select value={selectedDomainId} onChange={e => setSelectedDomainId(e.target.value)}>
- <option value="">-- Select --</option>
- {domains.map(d => <option key={d.id} value={d.id}>{d.name}</option>)}
- </select>
+ ))}
</div>
</div>
- {selectedDomainId && (
- <>
- <div className="section-header">
- <h2>Accounts</h2>
- <button className="btn btn-primary btn-sm" onClick={() => setShowAccountForm(!showAccountForm)}>
- {showAccountForm ? 'Cancel' : 'Create Account'}
- </button>
+ </TabsContent>
+
+ {/* Accounts Tab */}
+ <TabsContent value="accounts">
+ <div className="email-accounts">
+ <div className="domain-selector">
+ <div className="form-group">
+ <label>Select Domain</label>
+ <select value={selectedDomainId} onChange={e => setSelectedDomainId(e.target.value)}>
+ <option value="">-- Select --</option>
+ {domains.map(d => <option key={d.id} value={d.id}>{d.name}</option>)}
+ </select>
</div>
- {showAccountForm && (
- <form className="email-form" onSubmit={handleCreateAccount}>
- <div className="form-grid">
- <div className="form-group">
- <label>Username</label>
- <input type="text" value={newAccount.username} onChange={e => setNewAccount({ ...newAccount, username: e.target.value })} placeholder="user" required />
+ </div>
+ {selectedDomainId && (
+ <>
+ <div className="section-header">
+ <h2>Accounts</h2>
+ <Button size="sm" variant={showAccountForm ? 'outline' : 'default'} onClick={() => setShowAccountForm(!showAccountForm)}>
+ {showAccountForm ? 'Cancel' : 'Create Account'}
+ </Button>
+ </div>
+ {showAccountForm && (
+ <form className="email-form" onSubmit={handleCreateAccount}>
+ <div className="form-grid">
+ <div className="form-group">
+ <label>Username</label>
+ <Input type="text" value={newAccount.username} onChange={e => setNewAccount({ ...newAccount, username: e.target.value })} placeholder="user" required />
+ </div>
+ <div className="form-group">
+ <label>Password</label>
+ <Input type="password" value={newAccount.password} onChange={e => setNewAccount({ ...newAccount, password: e.target.value })} required />
+ </div>
+ <div className="form-group">
+ <label>Quota (MB)</label>
+ <Input type="number" value={newAccount.quota_mb} onChange={e => setNewAccount({ ...newAccount, quota_mb: parseInt(e.target.value) || 1024 })} />
+ </div>
</div>
- <div className="form-group">
- <label>Password</label>
- <input type="password" value={newAccount.password} onChange={e => setNewAccount({ ...newAccount, password: e.target.value })} required />
+ <div className="form-actions">
+ <Button type="submit" size="sm" disabled={actionLoading}>Create</Button>
</div>
- <div className="form-group">
- <label>Quota (MB)</label>
- <input type="number" value={newAccount.quota_mb} onChange={e => setNewAccount({ ...newAccount, quota_mb: parseInt(e.target.value) || 1024 })} />
+ </form>
+ )}
+ <div className="accounts-list">
+ {accounts.length === 0 ? (
+ <div className="empty-state"><p>No accounts for this domain</p></div>
+ ) : accounts.map(a => (
+ <div key={a.id} className="account-card">
+ <div className="account-info">
+ <div className="account-email">{a.email}</div>
+ <div className="account-meta">
+ <span>Quota: {a.quota_mb}MB</span>
+ <Badge variant={a.is_active ? 'success' : 'secondary'}>
+ {a.is_active ? 'Active' : 'Disabled'}
+ </Badge>
+ </div>
+ </div>
+ <div className="account-actions">
+ <Button size="sm" variant="outline" onClick={() => { setShowPasswordModal(a.id); setNewPassword(''); }}>Password</Button>
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteAccount(a.id, a.email)}>Delete</Button>
+ </div>
</div>
+ ))}
+ </div>
+ </>
+ )}
+ {showPasswordModal && (
+ <div className="modal-overlay" onClick={() => setShowPasswordModal(null)}>
+ <div className="modal-content" onClick={e => e.stopPropagation()}>
+ <h3>Change Password</h3>
+ <div className="form-group">
+ <label>New Password</label>
+ <Input type="password" value={newPassword} onChange={e => setNewPassword(e.target.value)} />
</div>
<div className="form-actions">
- <button type="submit" className="btn btn-primary btn-sm" disabled={actionLoading}>Create</button>
+ <Button size="sm" variant="outline" onClick={() => setShowPasswordModal(null)}>Cancel</Button>
+ <Button size="sm" onClick={handleChangePassword} disabled={actionLoading || !newPassword}>Change</Button>
</div>
- </form>
- )}
- <div className="accounts-list">
- {accounts.length === 0 ? (
- <div className="empty-state"><p>No accounts for this domain</p></div>
- ) : accounts.map(a => (
- <div key={a.id} className="account-card">
- <div className="account-info">
- <div className="account-email">{a.email}</div>
- <div className="account-meta">
- <span>Quota: {a.quota_mb}MB</span>
- <span className={`status-badge ${a.is_active ? 'online' : 'offline'}`}>{a.is_active ? 'Active' : 'Disabled'}</span>
+ </div>
+ </div>
+ )}
+ </div>
+ </TabsContent>
+
+ {/* Aliases Tab */}
+ <TabsContent value="aliases">
+ <div className="email-aliases">
+ <div className="domain-selector">
+ <div className="form-group">
+ <label>Select Domain</label>
+ <select value={aliasDomainId} onChange={e => setAliasDomainId(e.target.value)}>
+ <option value="">-- Select --</option>
+ {domains.map(d => <option key={d.id} value={d.id}>{d.name}</option>)}
+ </select>
+ </div>
+ </div>
+ {aliasDomainId && (
+ <>
+ <div className="section-header">
+ <h2>Aliases</h2>
+ <Button size="sm" variant={showAliasForm ? 'outline' : 'default'} onClick={() => setShowAliasForm(!showAliasForm)}>
+ {showAliasForm ? 'Cancel' : 'Create Alias'}
+ </Button>
+ </div>
+ {showAliasForm && (
+ <form className="email-form" onSubmit={handleCreateAlias}>
+ <div className="form-grid">
+ <div className="form-group">
+ <label>Source</label>
+ <Input type="text" value={newAlias.source} onChange={e => setNewAlias({ ...newAlias, source: e.target.value })} placeholder="[email protected]" required />
+ </div>
+ <div className="form-group">
+ <label>Destination</label>
+ <Input type="text" value={newAlias.destination} onChange={e => setNewAlias({ ...newAlias, destination: e.target.value })} placeholder="[email protected]" required />
</div>
</div>
- <div className="account-actions">
- <button className="btn btn-sm" onClick={() => { setShowPasswordModal(a.id); setNewPassword(''); }}>Password</button>
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteAccount(a.id, a.email)}>Delete</button>
+ <div className="form-actions">
+ <Button type="submit" size="sm" disabled={actionLoading}>Create</Button>
</div>
- </div>
- ))}
- </div>
- </>
- )}
- {showPasswordModal && (
- <div className="modal-overlay" onClick={() => setShowPasswordModal(null)}>
- <div className="modal-content" onClick={e => e.stopPropagation()}>
- <h3>Change Password</h3>
- <div className="form-group">
- <label>New Password</label>
- <input type="password" value={newPassword} onChange={e => setNewPassword(e.target.value)} />
- </div>
- <div className="form-actions">
- <button className="btn btn-sm" onClick={() => setShowPasswordModal(null)}>Cancel</button>
- <button className="btn btn-primary btn-sm" onClick={handleChangePassword} disabled={actionLoading || !newPassword}>Change</button>
+ </form>
+ )}
+ <div className="items-list">
+ {aliases.length === 0 ? (
+ <div className="empty-state"><p>No aliases for this domain</p></div>
+ ) : aliases.map(a => (
+ <div key={a.id} className="alias-card">
+ <div className="item-info">
+ <div className="item-mapping">{a.source} <span className="arrow">&rarr;</span> {a.destination}</div>
+ </div>
+ <div className="item-actions">
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteAlias(a.id)}>Delete</Button>
+ </div>
+ </div>
+ ))}
</div>
- </div>
- </div>
- )}
- </div>
- )}
-
- {/* Aliases Tab */}
- {activeTab === 'aliases' && (
- <div className="email-aliases">
- <div className="domain-selector">
- <div className="form-group">
- <label>Select Domain</label>
- <select value={aliasDomainId} onChange={e => setAliasDomainId(e.target.value)}>
- <option value="">-- Select --</option>
- {domains.map(d => <option key={d.id} value={d.id}>{d.name}</option>)}
- </select>
- </div>
+ </>
+ )}
</div>
- {aliasDomainId && (
- <>
- <div className="section-header">
- <h2>Aliases</h2>
- <button className="btn btn-primary btn-sm" onClick={() => setShowAliasForm(!showAliasForm)}>
- {showAliasForm ? 'Cancel' : 'Create Alias'}
- </button>
+ </TabsContent>
+
+ {/* Forwarding Tab */}
+ <TabsContent value="forwarding">
+ <div className="email-forwarding">
+ <div className="domain-selector">
+ <div className="form-group">
+ <label>Select Account</label>
+ <select value={selectedAccountId} onChange={e => setSelectedAccountId(e.target.value)}>
+ <option value="">-- Select --</option>
+ {allAccounts.map(a => <option key={a.id} value={a.id}>{a.email}</option>)}
+ </select>
</div>
- {showAliasForm && (
- <form className="email-form" onSubmit={handleCreateAlias}>
- <div className="form-grid">
- <div className="form-group">
- <label>Source</label>
- <input type="text" value={newAlias.source} onChange={e => setNewAlias({ ...newAlias, source: e.target.value })} placeholder="[email protected]" required />
+ </div>
+ {selectedAccountId && (
+ <>
+ <div className="section-header">
+ <h2>Forwarding Rules</h2>
+ <Button size="sm" variant={showForwardForm ? 'outline' : 'default'} onClick={() => setShowForwardForm(!showForwardForm)}>
+ {showForwardForm ? 'Cancel' : 'Add Rule'}
+ </Button>
+ </div>
+ {showForwardForm && (
+ <form className="email-form" onSubmit={handleCreateForwarding}>
+ <div className="form-grid">
+ <div className="form-group">
+ <label>Forward To</label>
+ <Input type="email" value={newForward.destination} onChange={e => setNewForward({ ...newForward, destination: e.target.value })} required />
+ </div>
+ <div className="form-group">
+ <label>
+ <input type="checkbox" checked={newForward.keep_copy} onChange={e => setNewForward({ ...newForward, keep_copy: e.target.checked })} />
+ {' '}Keep a copy in mailbox
+ </label>
+ </div>
</div>
- <div className="form-group">
- <label>Destination</label>
- <input type="text" value={newAlias.destination} onChange={e => setNewAlias({ ...newAlias, destination: e.target.value })} placeholder="[email protected]" required />
+ <div className="form-actions">
+ <Button type="submit" size="sm" disabled={actionLoading}>Add</Button>
+ </div>
+ </form>
+ )}
+ <div className="items-list">
+ {forwardingRules.length === 0 ? (
+ <div className="empty-state"><p>No forwarding rules</p></div>
+ ) : forwardingRules.map(r => (
+ <div key={r.id} className="forwarding-card">
+ <div className="item-info">
+ <div className="item-mapping">{r.account_email} <span className="arrow">&rarr;</span> {r.destination}</div>
+ <div className="item-meta">{r.keep_copy ? 'Keeps copy' : 'No copy'} &middot; {r.is_active ? 'Active' : 'Inactive'}</div>
+ </div>
+ <div className="item-actions">
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteForwarding(r.id)}>Delete</Button>
+ </div>
</div>
+ ))}
+ </div>
+ </>
+ )}
+ </div>
+ </TabsContent>
+
+ {/* DNS Providers Tab */}
+ <TabsContent value="dns-providers">
+ <div className="email-dns-providers">
+ <div className="section-header">
+ <h2>DNS Providers</h2>
+ <Button size="sm" variant={showProviderForm ? 'outline' : 'default'} onClick={() => setShowProviderForm(!showProviderForm)}>
+ {showProviderForm ? 'Cancel' : 'Add Provider'}
+ </Button>
+ </div>
+ {showProviderForm && (
+ <form className="email-form" onSubmit={handleAddProvider}>
+ <div className="form-grid">
+ <div className="form-group"><label>Name</label><Input type="text" value={newProvider.name} onChange={e => setNewProvider({ ...newProvider, name: e.target.value })} required /></div>
+ <div className="form-group">
+ <label>Provider</label>
+ <select value={newProvider.provider} onChange={e => setNewProvider({ ...newProvider, provider: e.target.value })}>
+ <option value="cloudflare">Cloudflare</option>
+ <option value="route53">Route53</option>
+ </select>
</div>
- <div className="form-actions">
- <button type="submit" className="btn btn-primary btn-sm" disabled={actionLoading}>Create</button>
+ <div className="form-group"><label>API Key</label><Input type="password" value={newProvider.api_key} onChange={e => setNewProvider({ ...newProvider, api_key: e.target.value })} required /></div>
+ <div className="form-group"><label>API Secret (Route53)</label><Input type="password" value={newProvider.api_secret} onChange={e => setNewProvider({ ...newProvider, api_secret: e.target.value })} /></div>
+ <div className="form-group"><label>API Email (Cloudflare)</label><Input type="email" value={newProvider.api_email} onChange={e => setNewProvider({ ...newProvider, api_email: e.target.value })} /></div>
+ </div>
+ <div className="form-actions"><Button type="submit" size="sm" disabled={actionLoading}>Add</Button></div>
+ </form>
+ )}
+ <div className="provider-list">
+ {providers.length === 0 ? (
+ <div className="empty-state"><p>No DNS providers configured</p></div>
+ ) : providers.map(p => (
+ <div key={p.id} className="provider-card">
+ <div className="provider-header">
+ <h3>{p.name}</h3>
+ <span className="provider-type">{p.provider}</span>
</div>
- </form>
- )}
- <div className="items-list">
- {aliases.length === 0 ? (
- <div className="empty-state"><p>No aliases for this domain</p></div>
- ) : aliases.map(a => (
- <div key={a.id} className="alias-card">
- <div className="item-info">
- <div className="item-mapping">{a.source} <span className="arrow">&rarr;</span> {a.destination}</div>
- </div>
- <div className="item-actions">
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteAlias(a.id)}>Delete</button>
- </div>
+ <div className="provider-meta">
+ <div className="meta-row"><span>API Key: {p.api_key}</span>{p.is_default && <span><strong>Default</strong></span>}</div>
</div>
- ))}
- </div>
- </>
- )}
- </div>
- )}
-
- {/* Forwarding Tab */}
- {activeTab === 'forwarding' && (
- <div className="email-forwarding">
- <div className="domain-selector">
- <div className="form-group">
- <label>Select Account</label>
- <select value={selectedAccountId} onChange={e => setSelectedAccountId(e.target.value)}>
- <option value="">-- Select --</option>
- {allAccounts.map(a => <option key={a.id} value={a.id}>{a.email}</option>)}
- </select>
+ <div className="provider-actions">
+ <Button size="sm" variant="outline" onClick={() => handleTestProvider(p.id)} disabled={actionLoading}>Test</Button>
+ <Button size="sm" variant="outline" onClick={() => handleListZones(p.id)}>Zones</Button>
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteProvider(p.id)}>Delete</Button>
+ </div>
+ {providerZones[p.id] && (
+ <div className="zones-list">
+ {providerZones[p.id].map(z => (
+ <div key={z.id} className="zone-item"><span>{z.name}</span><span>{z.id}</span></div>
+ ))}
+ </div>
+ )}
+ </div>
+ ))}
</div>
</div>
- {selectedAccountId && (
- <>
+ </TabsContent>
+
+ {/* Spam Tab */}
+ <TabsContent value="spam">
+ {spamConfig && (
+ <div className="email-spam">
<div className="section-header">
- <h2>Forwarding Rules</h2>
- <button className="btn btn-primary btn-sm" onClick={() => setShowForwardForm(!showForwardForm)}>
- {showForwardForm ? 'Cancel' : 'Add Rule'}
- </button>
+ <h2>SpamAssassin Configuration</h2>
+ <div className="section-actions">
+ <Button size="sm" variant="outline" onClick={handleUpdateSpamRules} disabled={actionLoading}>Update Rules</Button>
+ <Button size="sm" onClick={handleUpdateSpam} disabled={actionLoading}>Save</Button>
+ </div>
</div>
- {showForwardForm && (
- <form className="email-form" onSubmit={handleCreateForwarding}>
- <div className="form-grid">
- <div className="form-group">
- <label>Forward To</label>
- <input type="email" value={newForward.destination} onChange={e => setNewForward({ ...newForward, destination: e.target.value })} required />
- </div>
- <div className="form-group">
- <label>
- <input type="checkbox" checked={newForward.keep_copy} onChange={e => setNewForward({ ...newForward, keep_copy: e.target.checked })} />
- {' '}Keep a copy in mailbox
- </label>
- </div>
+ <div className="spam-config">
+ <div className="form-grid">
+ <div className="form-group">
+ <label>Required Score</label>
+ <Input type="number" step="0.1" value={spamConfig.required_score} onChange={e => setSpamConfig({ ...spamConfig, required_score: parseFloat(e.target.value) })} />
</div>
- <div className="form-actions">
- <button type="submit" className="btn btn-primary btn-sm" disabled={actionLoading}>Add</button>
+ <div className="form-group">
+ <label>Rewrite Subject</label>
+ <Input type="text" value={spamConfig.rewrite_subject} onChange={e => setSpamConfig({ ...spamConfig, rewrite_subject: e.target.value })} />
</div>
- </form>
- )}
- <div className="items-list">
- {forwardingRules.length === 0 ? (
- <div className="empty-state"><p>No forwarding rules</p></div>
- ) : forwardingRules.map(r => (
- <div key={r.id} className="forwarding-card">
- <div className="item-info">
- <div className="item-mapping">{r.account_email} <span className="arrow">&rarr;</span> {r.destination}</div>
- <div className="item-meta">{r.keep_copy ? 'Keeps copy' : 'No copy'} &middot; {r.is_active ? 'Active' : 'Inactive'}</div>
- </div>
- <div className="item-actions">
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteForwarding(r.id)}>Delete</button>
- </div>
+ <div className="form-group checkbox-field">
+ <input type="checkbox" checked={!!spamConfig.use_bayes} onChange={e => setSpamConfig({ ...spamConfig, use_bayes: e.target.checked ? 1 : 0 })} />
+ <label>Enable Bayesian Filter</label>
</div>
- ))}
- </div>
- </>
- )}
- </div>
- )}
-
- {/* DNS Providers Tab */}
- {activeTab === 'dns-providers' && (
- <div className="email-dns-providers">
- <div className="section-header">
- <h2>DNS Providers</h2>
- <button className="btn btn-primary btn-sm" onClick={() => setShowProviderForm(!showProviderForm)}>
- {showProviderForm ? 'Cancel' : 'Add Provider'}
- </button>
- </div>
- {showProviderForm && (
- <form className="email-form" onSubmit={handleAddProvider}>
- <div className="form-grid">
- <div className="form-group"><label>Name</label><input type="text" value={newProvider.name} onChange={e => setNewProvider({ ...newProvider, name: e.target.value })} required /></div>
- <div className="form-group">
- <label>Provider</label>
- <select value={newProvider.provider} onChange={e => setNewProvider({ ...newProvider, provider: e.target.value })}>
- <option value="cloudflare">Cloudflare</option>
- <option value="route53">Route53</option>
- </select>
- </div>
- <div className="form-group"><label>API Key</label><input type="password" value={newProvider.api_key} onChange={e => setNewProvider({ ...newProvider, api_key: e.target.value })} required /></div>
- <div className="form-group"><label>API Secret (Route53)</label><input type="password" value={newProvider.api_secret} onChange={e => setNewProvider({ ...newProvider, api_secret: e.target.value })} /></div>
- <div className="form-group"><label>API Email (Cloudflare)</label><input type="email" value={newProvider.api_email} onChange={e => setNewProvider({ ...newProvider, api_email: e.target.value })} /></div>
- </div>
- <div className="form-actions"><button type="submit" className="btn btn-primary btn-sm" disabled={actionLoading}>Add</button></div>
- </form>
- )}
- <div className="provider-list">
- {providers.length === 0 ? (
- <div className="empty-state"><p>No DNS providers configured</p></div>
- ) : providers.map(p => (
- <div key={p.id} className="provider-card">
- <div className="provider-header">
- <h3>{p.name}</h3>
- <span className="provider-type">{p.provider}</span>
- </div>
- <div className="provider-meta">
- <div className="meta-row"><span>API Key: {p.api_key}</span>{p.is_default && <span><strong>Default</strong></span>}</div>
- </div>
- <div className="provider-actions">
- <button className="btn btn-sm" onClick={() => handleTestProvider(p.id)} disabled={actionLoading}>Test</button>
- <button className="btn btn-sm" onClick={() => handleListZones(p.id)}>Zones</button>
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteProvider(p.id)}>Delete</button>
- </div>
- {providerZones[p.id] && (
- <div className="zones-list">
- {providerZones[p.id].map(z => (
- <div key={z.id} className="zone-item"><span>{z.name}</span><span>{z.id}</span></div>
- ))}
+ <div className="form-group checkbox-field">
+ <input type="checkbox" checked={!!spamConfig.bayes_auto_learn} onChange={e => setSpamConfig({ ...spamConfig, bayes_auto_learn: e.target.checked ? 1 : 0 })} />
+ <label>Auto-learn</label>
</div>
- )}
+ </div>
</div>
- ))}
- </div>
- </div>
- )}
-
- {/* Spam Tab */}
- {activeTab === 'spam' && spamConfig && (
- <div className="email-spam">
- <div className="section-header">
- <h2>SpamAssassin Configuration</h2>
- <div className="section-actions">
- <button className="btn btn-sm" onClick={handleUpdateSpamRules} disabled={actionLoading}>Update Rules</button>
- <button className="btn btn-primary btn-sm" onClick={handleUpdateSpam} disabled={actionLoading}>Save</button>
</div>
- </div>
- <div className="spam-config">
- <div className="form-grid">
- <div className="form-group">
- <label>Required Score</label>
- <input type="number" step="0.1" value={spamConfig.required_score} onChange={e => setSpamConfig({ ...spamConfig, required_score: parseFloat(e.target.value) })} />
- </div>
- <div className="form-group">
- <label>Rewrite Subject</label>
- <input type="text" value={spamConfig.rewrite_subject} onChange={e => setSpamConfig({ ...spamConfig, rewrite_subject: e.target.value })} />
- </div>
- <div className="form-group checkbox-field">
- <input type="checkbox" checked={!!spamConfig.use_bayes} onChange={e => setSpamConfig({ ...spamConfig, use_bayes: e.target.checked ? 1 : 0 })} />
- <label>Enable Bayesian Filter</label>
+ )}
+ </TabsContent>
+
+ {/* Webmail Tab */}
+ <TabsContent value="webmail">
+ <div className="email-webmail">
+ <div className="section-header"><h2>Roundcube Webmail</h2></div>
+ <div className="webmail-card">
+ <div className="webmail-status-row">
+ <Badge variant={webmailStatus?.running ? 'success' : 'secondary'}>
+ {webmailStatus?.running ? 'Running' : webmailStatus?.installed ? 'Stopped' : 'Not Installed'}
+ </Badge>
+ {webmailStatus?.port && <span>Port: {webmailStatus.port}</span>}
</div>
- <div className="form-group checkbox-field">
- <input type="checkbox" checked={!!spamConfig.bayes_auto_learn} onChange={e => setSpamConfig({ ...spamConfig, bayes_auto_learn: e.target.checked ? 1 : 0 })} />
- <label>Auto-learn</label>
+ <div className="webmail-actions">
+ {!webmailStatus?.installed ? (
+ <Button size="sm" onClick={handleWebmailInstall} disabled={actionLoading}>Install Roundcube</Button>
+ ) : (
+ <>
+ {webmailStatus?.running
+ ? <Button size="sm" variant="outline" onClick={() => handleWebmailControl('stop')} disabled={actionLoading}>Stop</Button>
+ : <Button size="sm" onClick={() => handleWebmailControl('start')} disabled={actionLoading}>Start</Button>
+ }
+ <Button size="sm" variant="outline" onClick={() => handleWebmailControl('restart')} disabled={actionLoading}>Restart</Button>
+ </>
+ )}
</div>
- </div>
- </div>
- </div>
- )}
-
- {/* Webmail Tab */}
- {activeTab === 'webmail' && (
- <div className="email-webmail">
- <div className="section-header"><h2>Roundcube Webmail</h2></div>
- <div className="webmail-card">
- <div className="webmail-status-row">
- <span className={`status-badge ${webmailStatus?.running ? 'online' : 'offline'}`}>
- {webmailStatus?.running ? 'Running' : webmailStatus?.installed ? 'Stopped' : 'Not Installed'}
- </span>
- {webmailStatus?.port && <span>Port: {webmailStatus.port}</span>}
- </div>
- <div className="webmail-actions">
- {!webmailStatus?.installed ? (
- <button className="btn btn-primary btn-sm" onClick={handleWebmailInstall} disabled={actionLoading}>Install Roundcube</button>
- ) : (
- <>
- {webmailStatus?.running
- ? <button className="btn btn-sm" onClick={() => handleWebmailControl('stop')} disabled={actionLoading}>Stop</button>
- : <button className="btn btn-sm btn-primary" onClick={() => handleWebmailControl('start')} disabled={actionLoading}>Start</button>
- }
- <button className="btn btn-sm" onClick={() => handleWebmailControl('restart')} disabled={actionLoading}>Restart</button>
- </>
+ {webmailStatus?.installed && (
+ <div className="proxy-form">
+ <div className="form-group">
+ <label>Proxy Domain</label>
+ <Input type="text" value={proxyDomain} onChange={e => setProxyDomain(e.target.value)} placeholder="webmail.example.com" />
+ </div>
+ <Button size="sm" onClick={handleConfigureProxy} disabled={actionLoading || !proxyDomain}>Configure Nginx Proxy</Button>
+ </div>
)}
</div>
- {webmailStatus?.installed && (
- <div className="proxy-form">
- <div className="form-group">
- <label>Proxy Domain</label>
- <input type="text" value={proxyDomain} onChange={e => setProxyDomain(e.target.value)} placeholder="webmail.example.com" />
- </div>
- <button className="btn btn-sm btn-primary" onClick={handleConfigureProxy} disabled={actionLoading || !proxyDomain}>Configure Nginx Proxy</button>
- </div>
- )}
</div>
- </div>
- )}
+ </TabsContent>
- {/* Queue & Logs Tab */}
- {activeTab === 'queue' && (
- <div>
- <div className="email-queue">
- <div className="section-header">
- <h2>Mail Queue ({queue.length})</h2>
- <button className="btn btn-sm" onClick={handleFlushQueue} disabled={actionLoading}>Flush Queue</button>
- </div>
- <div className="queue-list">
- {queue.length === 0 ? (
- <div className="empty-state"><p>Queue is empty</p></div>
- ) : queue.map(item => (
- <div key={item.queue_id} className="queue-item">
- <div className="queue-info">
- <div className="queue-id">{item.queue_id}</div>
- <div className="queue-meta">
- <span>From: {item.sender}</span>
- <span>Size: {item.size}B</span>
- <span>{item.arrival_time}</span>
+ {/* Queue & Logs Tab */}
+ <TabsContent value="queue">
+ <div>
+ <div className="email-queue">
+ <div className="section-header">
+ <h2>Mail Queue ({queue.length})</h2>
+ <Button size="sm" variant="outline" onClick={handleFlushQueue} disabled={actionLoading}>Flush Queue</Button>
+ </div>
+ <div className="queue-list">
+ {queue.length === 0 ? (
+ <div className="empty-state"><p>Queue is empty</p></div>
+ ) : queue.map(item => (
+ <div key={item.queue_id} className="queue-item">
+ <div className="queue-info">
+ <div className="queue-id">{item.queue_id}</div>
+ <div className="queue-meta">
+ <span>From: {item.sender}</span>
+ <span>Size: {item.size}B</span>
+ <span>{item.arrival_time}</span>
+ </div>
+ {item.error && <div className="queue-error">{item.error}</div>}
</div>
- {item.error && <div className="queue-error">{item.error}</div>}
+ <Button size="sm" variant="destructive" onClick={() => handleDeleteQueueItem(item.queue_id)}>Delete</Button>
</div>
- <button className="btn btn-sm btn-danger" onClick={() => handleDeleteQueueItem(item.queue_id)}>Delete</button>
- </div>
- ))}
+ ))}
+ </div>
</div>
- </div>
- <div className="email-logs mt-8">
- <div className="section-header">
- <h2>Mail Logs</h2>
- <div className="log-controls">
- <select value={logLines} onChange={e => setLogLines(parseInt(e.target.value))}>
- <option value={50}>50 lines</option>
- <option value={100}>100 lines</option>
- <option value={500}>500 lines</option>
- </select>
+ <div className="email-logs mt-8">
+ <div className="section-header">
+ <h2>Mail Logs</h2>
+ <div className="log-controls">
+ <select value={logLines} onChange={e => setLogLines(parseInt(e.target.value))}>
+ <option value={50}>50 lines</option>
+ <option value={100}>100 lines</option>
+ <option value={500}>500 lines</option>
+ </select>
+ </div>
</div>
+ <pre className="log-output">{logs.length > 0 ? logs.join('\n') : 'No logs available'}</pre>
</div>
- <pre className="log-output">{logs.length > 0 ? logs.join('\n') : 'No logs available'}</pre>
</div>
- </div>
- )}
+ </TabsContent>
+ </Tabs>
</>
)}
diff --git a/frontend/src/pages/FTPServer.jsx b/frontend/src/pages/FTPServer.jsx
index c6cb604e..e3178dcb 100644
--- a/frontend/src/pages/FTPServer.jsx
+++ b/frontend/src/pages/FTPServer.jsx
@@ -4,6 +4,11 @@ import { api } from '../services/api';
import { useToast } from '../contexts/ToastContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['overview', 'users', 'connections', 'logs'];
@@ -240,43 +245,42 @@ function FTPServer() {
</div>
<div className="page-header-actions">
{!isInstalled ? (
- <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ <Button onClick={() => setShowInstallModal(true)}>
Install FTP Server
- </button>
+ </Button>
) : (
<>
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleTestConnection}
disabled={actionLoading}
>
Test Connection
- </button>
+ </Button>
{isRunning ? (
<>
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => handleServiceAction('restart')}
disabled={actionLoading}
>
Restart
- </button>
- <button
- className="btn btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
onClick={() => handleServiceAction('stop')}
disabled={actionLoading}
>
Stop
- </button>
+ </Button>
</>
) : (
- <button
- className="btn btn-primary"
+ <Button
onClick={() => handleServiceAction('start')}
disabled={actionLoading}
>
Start
- </button>
+ </Button>
)}
</>
)}
@@ -288,9 +292,9 @@ function FTPServer() {
<span className="icon">cloud_upload</span>
<h2>No FTP Server Installed</h2>
<p>Install an FTP server to enable file transfers on your server.</p>
- <button className="btn btn-primary btn-lg" onClick={() => setShowInstallModal(true)}>
+ <Button size="lg" onClick={() => setShowInstallModal(true)}>
Install FTP Server
- </button>
+ </Button>
</div>
) : (
<>
@@ -333,35 +337,19 @@ function FTPServer() {
</div>
</div>
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'overview' ? 'active' : ''}`}
- onClick={() => setActiveTab('overview')}
- >
- Overview
- </button>
- <button
- className={`tab ${activeTab === 'users' ? 'active' : ''}`}
- onClick={() => setActiveTab('users')}
- >
- Users
- </button>
- <button
- className={`tab ${activeTab === 'connections' ? 'active' : ''}`}
- onClick={() => { setActiveTab('connections'); loadConnections(); }}
- >
- Connections
- </button>
- <button
- className={`tab ${activeTab === 'logs' ? 'active' : ''}`}
- onClick={() => { setActiveTab('logs'); loadLogs(); }}
- >
- Logs
- </button>
- </div>
-
- <div className="tab-content">
- {activeTab === 'overview' && (
+ <Tabs value={activeTab} onValueChange={(val) => {
+ setActiveTab(val);
+ if (val === 'connections') loadConnections();
+ if (val === 'logs') loadLogs();
+ }}>
+ <TabsList>
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="users">Users</TabsTrigger>
+ <TabsTrigger value="connections">Connections</TabsTrigger>
+ <TabsTrigger value="logs">Logs</TabsTrigger>
+ </TabsList>
+
+ <TabsContent value="overview">
<div className="overview-tab">
<div className="config-section">
<h3>Server Configuration</h3>
@@ -425,23 +413,23 @@ function FTPServer() {
</div>
</div>
</div>
- )}
+ </TabsContent>
- {activeTab === 'users' && (
+ <TabsContent value="users">
<div className="users-tab">
<div className="section-header">
<h3>FTP Users</h3>
- <button className="btn btn-primary" onClick={() => setShowUserModal(true)}>
+ <Button onClick={() => setShowUserModal(true)}>
Add User
- </button>
+ </Button>
</div>
{users.length === 0 ? (
<div className="empty-state">
<span className="icon">person_add</span>
<p>No FTP users configured</p>
- <button className="btn btn-primary" onClick={() => setShowUserModal(true)}>
+ <Button onClick={() => setShowUserModal(true)}>
Create First User
- </button>
+ </Button>
</div>
) : (
<div className="users-table">
@@ -461,13 +449,13 @@ function FTPServer() {
<td>
<span className="user-name">{user.username}</span>
{user.in_userlist && (
- <span className="badge badge-info">FTP</span>
+ <Badge variant="info">FTP</Badge>
)}
</td>
<td>
<code>{user.home}</code>
{!user.home_exists && (
- <span className="badge badge-warning">Missing</span>
+ <Badge variant="warning">Missing</Badge>
)}
</td>
<td>{user.home_size_human}</td>
@@ -477,27 +465,30 @@ function FTPServer() {
</span>
</td>
<td className="actions">
- <button
- className="btn btn-sm btn-secondary"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => openPasswordModal(user.username)}
title="Change Password"
>
<span className="icon">key</span>
- </button>
- <button
- className={`btn btn-sm ${user.is_active ? 'btn-warning' : 'btn-success'}`}
+ </Button>
+ <Button
+ variant={user.is_active ? 'secondary' : 'outline'}
+ size="sm"
onClick={() => handleToggleUser(user.username, user.is_active)}
title={user.is_active ? 'Disable' : 'Enable'}
>
<span className="icon">{user.is_active ? 'block' : 'check'}</span>
- </button>
- <button
- className="btn btn-sm btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleDeleteUser(user.username)}
title="Delete"
>
<span className="icon">delete</span>
- </button>
+ </Button>
</td>
</tr>
))}
@@ -506,16 +497,16 @@ function FTPServer() {
</div>
)}
</div>
- )}
+ </TabsContent>
- {activeTab === 'connections' && (
+ <TabsContent value="connections">
<div className="connections-tab">
<div className="section-header">
<h3>Active Connections</h3>
- <button className="btn btn-secondary" onClick={loadConnections}>
+ <Button variant="outline" onClick={loadConnections}>
<span className="icon">refresh</span>
Refresh
- </button>
+ </Button>
</div>
{connections.length === 0 ? (
<div className="empty-state">
@@ -542,13 +533,14 @@ function FTPServer() {
<span className="status-badge active">{conn.state}</span>
</td>
<td>
- <button
- className="btn btn-sm btn-danger"
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleDisconnect(conn.pid)}
title="Disconnect"
>
<span className="icon">close</span>
- </button>
+ </Button>
</td>
</tr>
))}
@@ -557,23 +549,23 @@ function FTPServer() {
</div>
)}
</div>
- )}
+ </TabsContent>
- {activeTab === 'logs' && (
+ <TabsContent value="logs">
<div className="logs-tab">
<div className="section-header">
<h3>Server Logs</h3>
- <button className="btn btn-secondary" onClick={loadLogs}>
+ <Button variant="outline" onClick={loadLogs}>
<span className="icon">refresh</span>
Refresh
- </button>
+ </Button>
</div>
<div className="log-viewer">
<pre>{logs}</pre>
</div>
</div>
- )}
- </div>
+ </TabsContent>
+ </Tabs>
</>
)}
@@ -589,7 +581,7 @@ function FTPServer() {
</div>
<div className="modal-body">
<div className="form-group">
- <label>Select FTP Server</label>
+ <Label>Select FTP Server</Label>
<select
value={selectedService}
onChange={(e) => setSelectedService(e.target.value)}
@@ -613,16 +605,15 @@ function FTPServer() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowInstallModal(false)}>
+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleInstall}
disabled={actionLoading}
>
{actionLoading ? 'Installing...' : 'Install'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -640,8 +631,8 @@ function FTPServer() {
</div>
<div className="modal-body">
<div className="form-group">
- <label>Username *</label>
- <input
+ <Label>Username *</Label>
+ <Input
type="text"
value={newUser.username}
onChange={(e) => setNewUser({ ...newUser, username: e.target.value })}
@@ -649,8 +640,8 @@ function FTPServer() {
/>
</div>
<div className="form-group">
- <label>Password (leave empty to auto-generate)</label>
- <input
+ <Label>Password (leave empty to auto-generate)</Label>
+ <Input
type="password"
value={newUser.password}
onChange={(e) => setNewUser({ ...newUser, password: e.target.value })}
@@ -658,8 +649,8 @@ function FTPServer() {
/>
</div>
<div className="form-group">
- <label>Home Directory (optional)</label>
- <input
+ <Label>Home Directory (optional)</Label>
+ <Input
type="text"
value={newUser.homeDir}
onChange={(e) => setNewUser({ ...newUser, homeDir: e.target.value })}
@@ -668,16 +659,15 @@ function FTPServer() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowUserModal(false)}>
+ <Button variant="outline" onClick={() => setShowUserModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleCreateUser}
disabled={actionLoading || !newUser.username.trim()}
>
{actionLoading ? 'Creating...' : 'Create User'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -696,8 +686,8 @@ function FTPServer() {
<div className="modal-body">
<p>Changing password for user: <strong>{passwordTarget}</strong></p>
<div className="form-group">
- <label>New Password (leave empty to auto-generate)</label>
- <input
+ <Label>New Password (leave empty to auto-generate)</Label>
+ <Input
type="password"
value={newPassword}
onChange={(e) => setNewPassword(e.target.value)}
@@ -706,16 +696,15 @@ function FTPServer() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowPasswordModal(false)}>
+ <Button variant="outline" onClick={() => setShowPasswordModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleChangePassword}
disabled={actionLoading}
>
{actionLoading ? 'Changing...' : 'Change Password'}
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsx
index ddcc68c7..a01e3f74 100644
--- a/frontend/src/pages/FileManager.jsx
+++ b/frontend/src/pages/FileManager.jsx
@@ -11,6 +11,9 @@ import {
PieChart, Clock, PanelRightClose, PanelRightOpen
} from 'lucide-react';
import { PieChart as RechartsPie, Pie, Cell, ResponsiveContainer, Tooltip, Legend } from 'recharts';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
// LocalStorage keys
const SIDEBAR_VISIBLE_KEY = 'serverkit-fm-sidebar';
@@ -334,18 +337,18 @@ function FileManager() {
<p className="page-description">Browse, edit, and manage your server files</p>
</div>
<div className="page-header-actions">
- <button className="btn btn-secondary" onClick={() => fileInputRef.current?.click()}>
+ <Button variant="outline" onClick={() => fileInputRef.current?.click()}>
<Upload size={16} />
Upload
- </button>
- <button className="btn btn-secondary" onClick={() => setShowNewFolderModal(true)}>
+ </Button>
+ <Button variant="outline" onClick={() => setShowNewFolderModal(true)}>
<FolderPlus size={16} />
New Folder
- </button>
- <button className="btn btn-primary" onClick={() => setShowNewFileModal(true)}>
+ </Button>
+ <Button onClick={() => setShowNewFileModal(true)}>
<FilePlus size={16} />
New File
- </button>
+ </Button>
<input
type="file"
ref={fileInputRef}
@@ -366,13 +369,14 @@ function FileManager() {
<div className="file-manager-toolbar">
<div className="path-breadcrumb">
- <button
- className="btn btn-icon"
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => parentPath && setCurrentPath(parentPath)}
disabled={!parentPath}
>
<ArrowLeft size={16} />
- </button>
+ </Button>
<span className="current-path">{currentPath}</span>
</div>
<div className="toolbar-actions">
@@ -386,20 +390,21 @@ function FileManager() {
onKeyDown={(e) => e.key === 'Enter' && handleSearch()}
/>
{searchResults && (
- <button className="btn btn-icon btn-sm" onClick={() => setSearchResults(null)}>
+ <Button variant="ghost" size="icon" className="btn-sm" onClick={() => setSearchResults(null)}>
<X size={14} />
- </button>
+ </Button>
)}
</div>
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={analyzeDirectory}
disabled={analysisLoading}
title="Analyze directory sizes"
>
<BarChart3 size={14} />
Analyze
- </button>
+ </Button>
<label className="checkbox-label">
<input
type="checkbox"
@@ -409,16 +414,17 @@ function FileManager() {
{showHidden ? <Eye size={14} /> : <EyeOff size={14} />}
Hidden
</label>
- <button className="btn btn-icon" onClick={() => loadDirectory(currentPath)} title="Refresh">
+ <Button variant="ghost" size="icon" onClick={() => loadDirectory(currentPath)} title="Refresh">
<RefreshCw size={16} />
- </button>
- <button
- className="btn btn-icon"
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => setSidebarVisible(!sidebarVisible)}
title={sidebarVisible ? 'Hide sidebar' : 'Show sidebar'}
>
{sidebarVisible ? <PanelRightClose size={16} /> : <PanelRightOpen size={16} />}
- </button>
+ </Button>
</div>
</div>
@@ -462,35 +468,43 @@ function FileManager() {
<span className="col-permissions">{entry.permissions}</span>
<span className="col-actions" onClick={(e) => e.stopPropagation()}>
{!entry.is_dir && (
- <button
- className="btn btn-icon btn-sm"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="btn-sm"
onClick={() => handleDownload(entry)}
title="Download"
>
<Download size={14} />
- </button>
+ </Button>
)}
- <button
- className="btn btn-icon btn-sm"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="btn-sm"
onClick={() => openRenameModal(entry)}
title="Rename"
>
<Edit3 size={14} />
- </button>
- <button
- className="btn btn-icon btn-sm"
+ </Button>
+ <Button
+ variant="ghost"
+ size="icon"
+ className="btn-sm"
onClick={() => openPermissionsModal(entry)}
title="Permissions"
>
<Lock size={14} />
- </button>
- <button
- className="btn btn-icon btn-sm btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
+ size="icon"
+ className="btn-sm"
onClick={() => handleDelete(entry)}
title="Delete"
>
<Trash2 size={14} />
- </button>
+ </Button>
</span>
</div>
))}
@@ -504,24 +518,24 @@ function FileManager() {
<h3>{selectedFile.name}</h3>
<div className="preview-actions">
{selectedFile.is_editable && !editingFile && (
- <button className="btn btn-primary btn-sm" onClick={handleEditFile}>
+ <Button size="sm" onClick={handleEditFile}>
<Edit3 size={14} />
Edit
- </button>
+ </Button>
)}
{editingFile && (
<>
- <button className="btn btn-secondary btn-sm" onClick={() => setEditingFile(null)}>
+ <Button variant="outline" size="sm" onClick={() => setEditingFile(null)}>
Cancel
- </button>
- <button className="btn btn-primary btn-sm" onClick={handleSaveFile}>
+ </Button>
+ <Button size="sm" onClick={handleSaveFile}>
Save
- </button>
+ </Button>
</>
)}
- <button className="btn btn-icon btn-sm" onClick={() => setSelectedFile(null)}>
+ <Button variant="ghost" size="icon" className="btn-sm" onClick={() => setSelectedFile(null)}>
<X size={16} />
- </button>
+ </Button>
</div>
</div>
<div className="preview-info">
@@ -542,10 +556,10 @@ function FileManager() {
<div className="preview-unavailable">
<EyeOff size={48} strokeWidth={1.5} />
<p>Preview not available for this file type</p>
- <button className="btn btn-primary" onClick={() => handleDownload(selectedFile)}>
+ <Button onClick={() => handleDownload(selectedFile)}>
<Download size={16} />
Download File
- </button>
+ </Button>
</div>
)}
</div>
@@ -576,14 +590,16 @@ function FileManager() {
{diskLastUpdated.toLocaleTimeString()}
</span>
)}
- <button
- className="btn btn-icon btn-sm"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="btn-sm"
onClick={loadDiskMounts}
disabled={diskLoading}
title="Refresh"
>
<RefreshCw size={12} className={diskLoading ? 'spinning' : ''} />
- </button>
+ </Button>
</div>
{diskMounts.map((mount, idx) => (
@@ -616,12 +632,14 @@ function FileManager() {
<div className="sidebar-section-header static">
<BarChart3 size={16} />
<span>Directory Analysis</span>
- <button
- className="btn btn-icon btn-sm close-btn"
+ <Button
+ variant="ghost"
+ size="icon"
+ className="btn-sm close-btn"
onClick={closeAnalysis}
>
<X size={14} />
- </button>
+ </Button>
</div>
<div className="sidebar-section-content">
@@ -768,14 +786,14 @@ function FileManager() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Create New File</h2>
- <button className="btn btn-icon" onClick={() => setShowNewFileModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowNewFileModal(false)}>
<X size={20} />
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>File Name</label>
- <input
+ <Label>File Name</Label>
+ <Input
type="text"
value={newFileName}
onChange={(e) => setNewFileName(e.target.value)}
@@ -786,12 +804,12 @@ function FileManager() {
<p className="text-muted">File will be created in: {currentPath}</p>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowNewFileModal(false)}>
+ <Button variant="outline" onClick={() => setShowNewFileModal(false)}>
Cancel
- </button>
- <button className="btn btn-primary" onClick={handleCreateFile}>
+ </Button>
+ <Button onClick={handleCreateFile}>
Create File
- </button>
+ </Button>
</div>
</div>
</div>
@@ -803,14 +821,14 @@ function FileManager() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Create New Folder</h2>
- <button className="btn btn-icon" onClick={() => setShowNewFolderModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowNewFolderModal(false)}>
<X size={20} />
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>Folder Name</label>
- <input
+ <Label>Folder Name</Label>
+ <Input
type="text"
value={newFolderName}
onChange={(e) => setNewFolderName(e.target.value)}
@@ -821,12 +839,12 @@ function FileManager() {
<p className="text-muted">Folder will be created in: {currentPath}</p>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowNewFolderModal(false)}>
+ <Button variant="outline" onClick={() => setShowNewFolderModal(false)}>
Cancel
- </button>
- <button className="btn btn-primary" onClick={handleCreateFolder}>
+ </Button>
+ <Button onClick={handleCreateFolder}>
Create Folder
- </button>
+ </Button>
</div>
</div>
</div>
@@ -838,14 +856,14 @@ function FileManager() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Rename {renameTarget?.is_dir ? 'Folder' : 'File'}</h2>
- <button className="btn btn-icon" onClick={() => setShowRenameModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowRenameModal(false)}>
<X size={20} />
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>New Name</label>
- <input
+ <Label>New Name</Label>
+ <Input
type="text"
value={newName}
onChange={(e) => setNewName(e.target.value)}
@@ -854,12 +872,12 @@ function FileManager() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowRenameModal(false)}>
+ <Button variant="outline" onClick={() => setShowRenameModal(false)}>
Cancel
- </button>
- <button className="btn btn-primary" onClick={handleRename}>
+ </Button>
+ <Button onClick={handleRename}>
Rename
- </button>
+ </Button>
</div>
</div>
</div>
@@ -871,14 +889,14 @@ function FileManager() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Change Permissions</h2>
- <button className="btn btn-icon" onClick={() => setShowPermissionsModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowPermissionsModal(false)}>
<X size={20} />
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>Permissions (Octal)</label>
- <input
+ <Label>Permissions (Octal)</Label>
+ <Input
type="text"
value={newPermissions}
onChange={(e) => setNewPermissions(e.target.value)}
@@ -900,12 +918,12 @@ function FileManager() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowPermissionsModal(false)}>
+ <Button variant="outline" onClick={() => setShowPermissionsModal(false)}>
Cancel
- </button>
- <button className="btn btn-primary" onClick={handleChangePermissions}>
+ </Button>
+ <Button onClick={handleChangePermissions}>
Apply
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Firewall.jsx b/frontend/src/pages/Firewall.jsx
index 4e532418..a607881d 100644
--- a/frontend/src/pages/Firewall.jsx
+++ b/frontend/src/pages/Firewall.jsx
@@ -3,13 +3,24 @@ import { api } from '../services/api';
import { useToast } from '../contexts/ToastContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
+import {
+ Select,
+ SelectTrigger,
+ SelectContent,
+ SelectItem,
+ SelectValue,
+} from '@/components/ui/select';
function Firewall() {
const [status, setStatus] = useState(null);
const [rules, setRules] = useState([]);
const [blockedIPs, setBlockedIPs] = useState([]);
const [loading, setLoading] = useState(true);
- const [activeTab, setActiveTab] = useState('overview');
const [showBlockIPModal, setShowBlockIPModal] = useState(false);
const [showPortModal, setShowPortModal] = useState(false);
const [showInstallModal, setShowInstallModal] = useState(false);
@@ -235,39 +246,38 @@ function Firewall() {
</div>
<div className="page-header-actions">
{!status?.any_installed ? (
- <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ <Button onClick={() => setShowInstallModal(true)}>
Install Firewall
- </button>
+ </Button>
) : (
<>
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => setShowBlockIPModal(true)}
>
Block IP
- </button>
- <button
- className="btn btn-secondary"
+ </Button>
+ <Button
+ variant="outline"
onClick={() => setShowPortModal(true)}
>
Allow Port
- </button>
+ </Button>
{isActive ? (
- <button
- className="btn btn-danger"
+ <Button
+ variant="destructive"
onClick={handleDisable}
disabled={actionLoading}
>
Disable Firewall
- </button>
+ </Button>
) : (
- <button
- className="btn btn-primary"
+ <Button
onClick={handleEnable}
disabled={actionLoading}
>
Enable Firewall
- </button>
+ </Button>
)}
</>
)}
@@ -279,9 +289,9 @@ function Firewall() {
<span className="icon">security</span>
<h2>No Firewall Installed</h2>
<p>Install a firewall to protect your server from unauthorized access.</p>
- <button className="btn btn-primary btn-lg" onClick={() => setShowInstallModal(true)}>
+ <Button size="lg" onClick={() => setShowInstallModal(true)}>
Install Firewall
- </button>
+ </Button>
</div>
) : (
<>
@@ -324,35 +334,15 @@ function Firewall() {
</div>
</div>
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'overview' ? 'active' : ''}`}
- onClick={() => setActiveTab('overview')}
- >
- Overview
- </button>
- <button
- className={`tab ${activeTab === 'rules' ? 'active' : ''}`}
- onClick={() => setActiveTab('rules')}
- >
- Rules
- </button>
- <button
- className={`tab ${activeTab === 'blocked' ? 'active' : ''}`}
- onClick={() => setActiveTab('blocked')}
- >
- Blocked IPs
- </button>
- <button
- className={`tab ${activeTab === 'quick' ? 'active' : ''}`}
- onClick={() => setActiveTab('quick')}
- >
- Quick Actions
- </button>
- </div>
+ <Tabs defaultValue="overview">
+ <TabsList>
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="rules">Rules</TabsTrigger>
+ <TabsTrigger value="blocked">Blocked IPs</TabsTrigger>
+ <TabsTrigger value="quick">Quick Actions</TabsTrigger>
+ </TabsList>
- <div className="tab-content">
- {activeTab === 'overview' && (
+ <TabsContent value="overview">
<div className="overview-tab">
<div className="info-card">
<h3>Firewall Information</h3>
@@ -405,15 +395,15 @@ function Firewall() {
</div>
</div>
</div>
- )}
+ </TabsContent>
- {activeTab === 'rules' && (
+ <TabsContent value="rules">
<div className="rules-tab">
<div className="section-header">
<h3>Firewall Rules</h3>
- <button className="btn btn-primary" onClick={() => setShowPortModal(true)}>
+ <Button onClick={() => setShowPortModal(true)}>
Add Rule
- </button>
+ </Button>
</div>
{rules.length === 0 ? (
<div className="empty-state">
@@ -435,7 +425,7 @@ function Firewall() {
{rules.map((rule, index) => (
<tr key={index}>
<td>
- <span className="badge badge-info">{rule.type}</span>
+ <Badge variant="info">{rule.type}</Badge>
</td>
<td>
{rule.type === 'service' && rule.service}
@@ -447,12 +437,13 @@ function Firewall() {
<td>{rule.protocol || '-'}</td>
<td>
{rule.type === 'port' && (
- <button
- className="btn btn-sm btn-danger"
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleRemovePort(rule.port, rule.protocol)}
>
<span className="icon">delete</span>
- </button>
+ </Button>
)}
</td>
</tr>
@@ -462,15 +453,15 @@ function Firewall() {
</div>
)}
</div>
- )}
+ </TabsContent>
- {activeTab === 'blocked' && (
+ <TabsContent value="blocked">
<div className="blocked-tab">
<div className="section-header">
<h3>Blocked IP Addresses</h3>
- <button className="btn btn-primary" onClick={() => setShowBlockIPModal(true)}>
+ <Button onClick={() => setShowBlockIPModal(true)}>
Block IP
- </button>
+ </Button>
</div>
{blockedIPs.length === 0 ? (
<div className="empty-state">
@@ -485,20 +476,21 @@ function Firewall() {
<span className="blocked-ip">{item.ip}</span>
<code className="blocked-rule">{item.rule}</code>
</div>
- <button
- className="btn btn-sm btn-warning"
+ <Button
+ variant="secondary"
+ size="sm"
onClick={() => handleUnblockIP(item.ip)}
>
Unblock
- </button>
+ </Button>
</div>
))}
</div>
)}
</div>
- )}
+ </TabsContent>
- {activeTab === 'quick' && (
+ <TabsContent value="quick">
<div className="quick-tab">
<h3>Quick Port Access</h3>
<p className="text-muted">One-click enable/disable common service ports</p>
@@ -515,21 +507,22 @@ function Firewall() {
</div>
<div className="port-status">
{isAllowed ? (
- <button
- className="btn btn-sm btn-danger"
+ <Button
+ variant="destructive"
+ size="sm"
onClick={() => handleRemovePort(port, protocol)}
disabled={actionLoading}
>
Block
- </button>
+ </Button>
) : (
- <button
- className="btn btn-sm btn-success"
+ <Button
+ size="sm"
onClick={() => handleQuickAllowPort(port, protocol)}
disabled={actionLoading}
>
Allow
- </button>
+ </Button>
)}
</div>
</div>
@@ -537,8 +530,8 @@ function Firewall() {
})}
</div>
</div>
- )}
- </div>
+ </TabsContent>
+ </Tabs>
</>
)}
@@ -548,14 +541,14 @@ function Firewall() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Block IP Address</h2>
- <button className="btn btn-icon" onClick={() => setShowBlockIPModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowBlockIPModal(false)}>
<span className="icon">close</span>
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>IP Address</label>
- <input
+ <Label>IP Address</Label>
+ <Input
type="text"
value={blockIP}
onChange={(e) => setBlockIP(e.target.value)}
@@ -567,16 +560,16 @@ function Firewall() {
</p>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowBlockIPModal(false)}>
+ <Button variant="outline" onClick={() => setShowBlockIPModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-danger"
+ </Button>
+ <Button
+ variant="destructive"
onClick={handleBlockIP}
disabled={actionLoading || !blockIP.trim()}
>
{actionLoading ? 'Blocking...' : 'Block IP'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -588,15 +581,15 @@ function Firewall() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Allow Port</h2>
- <button className="btn btn-icon" onClick={() => setShowPortModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowPortModal(false)}>
<span className="icon">close</span>
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-row">
<div className="form-group">
- <label>Port Number</label>
- <input
+ <Label>Port Number</Label>
+ <Input
type="number"
value={newPort.port}
onChange={(e) => setNewPort({ ...newPort, port: e.target.value })}
@@ -606,28 +599,29 @@ function Firewall() {
/>
</div>
<div className="form-group">
- <label>Protocol</label>
- <select
- value={newPort.protocol}
- onChange={(e) => setNewPort({ ...newPort, protocol: e.target.value })}
- >
- <option value="tcp">TCP</option>
- <option value="udp">UDP</option>
- </select>
+ <Label>Protocol</Label>
+ <Select value={newPort.protocol} onValueChange={v => setNewPort({ ...newPort, protocol: v })}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="tcp">TCP</SelectItem>
+ <SelectItem value="udp">UDP</SelectItem>
+ </SelectContent>
+ </Select>
</div>
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowPortModal(false)}>
+ <Button variant="outline" onClick={() => setShowPortModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleAllowPort}
disabled={actionLoading || !newPort.port}
>
{actionLoading ? 'Adding...' : 'Allow Port'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -639,20 +633,22 @@ function Firewall() {
<div className="modal" onClick={(e) => e.stopPropagation()}>
<div className="modal-header">
<h2>Install Firewall</h2>
- <button className="btn btn-icon" onClick={() => setShowInstallModal(false)}>
+ <Button variant="ghost" size="icon" onClick={() => setShowInstallModal(false)}>
<span className="icon">close</span>
- </button>
+ </Button>
</div>
<div className="modal-body">
<div className="form-group">
- <label>Select Firewall</label>
- <select
- value={selectedFirewall}
- onChange={(e) => setSelectedFirewall(e.target.value)}
- >
- <option value="ufw">UFW (Recommended for Ubuntu)</option>
- <option value="firewalld">firewalld (CentOS/RHEL)</option>
- </select>
+ <Label>Select Firewall</Label>
+ <Select value={selectedFirewall} onValueChange={setSelectedFirewall}>
+ <SelectTrigger>
+ <SelectValue />
+ </SelectTrigger>
+ <SelectContent>
+ <SelectItem value="ufw">UFW (Recommended for Ubuntu)</SelectItem>
+ <SelectItem value="firewalld">firewalld (CentOS/RHEL)</SelectItem>
+ </SelectContent>
+ </Select>
</div>
<div className="install-info">
{selectedFirewall === 'ufw' ? (
@@ -670,16 +666,15 @@ function Firewall() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowInstallModal(false)}>
+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleInstall}
disabled={actionLoading}
>
{actionLoading ? 'Installing...' : 'Install'}
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/FleetMonitor.jsx b/frontend/src/pages/FleetMonitor.jsx
index ce740690..ee70a5d0 100644
--- a/frontend/src/pages/FleetMonitor.jsx
+++ b/frontend/src/pages/FleetMonitor.jsx
@@ -21,6 +21,9 @@ import {
} from 'recharts';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
const CHART_COLORS = [
'#6366f1', '#ec4899', '#14b8a6', '#f59e0b',
@@ -236,10 +239,10 @@ const FleetMonitor = () => {
<p>Cross-server monitoring, alerts, and capacity planning.</p>
</div>
<div className="header-actions">
- <button className="btn btn-primary" onClick={fetchTabData} disabled={loading}>
+ <Button onClick={fetchTabData} disabled={loading}>
<RefreshCw size={18} className={loading ? 'animate-spin' : ''} />
Refresh
- </button>
+ </Button>
</div>
</div>
@@ -317,9 +320,9 @@ const FleetMonitor = () => {
{server.containers ?? '-'}
</div>
<div className="fleet-heatmap__cell">
- <span className={`badge ${server.status === 'online' ? 'badge-success' : 'badge-error'}`}>
+ <Badge variant={server.status === 'online' ? 'success' : 'destructive'}>
{server.status}
- </span>
+ </Badge>
</div>
</div>
))}
@@ -349,9 +352,9 @@ const FleetMonitor = () => {
<div className="card-header flex justify-between items-center">
<h2>Server Comparison</h2>
<div className="flex gap-2">
- <button className="btn btn-sm btn-ghost" onClick={exportCsv} disabled={selectedServers.length === 0}>
+ <Button variant="ghost" size="sm" onClick={exportCsv} disabled={selectedServers.length === 0}>
<Download size={14} /> Export CSV
- </button>
+ </Button>
</div>
</div>
<div className="card-body">
@@ -360,13 +363,14 @@ const FleetMonitor = () => {
<label className="text-sm font-medium mb-1 block">Select Servers (click to toggle)</label>
<div className="flex flex-wrap gap-2 max-h-24 overflow-y-auto p-2 border rounded">
{servers.map(s => (
- <button
+ <Button
key={s.id}
- className={`btn btn-sm ${selectedServers.includes(s.id) ? 'btn-primary' : 'btn-ghost'}`}
+ size="sm"
+ variant={selectedServers.includes(s.id) ? 'default' : 'ghost'}
onClick={() => toggleServer(s.id)}
>
{s.name}
- </button>
+ </Button>
))}
</div>
</div>
@@ -382,25 +386,25 @@ const FleetMonitor = () => {
<label className="text-sm font-medium mb-1 block">Period</label>
<div className="flex gap-1">
{['1h', '6h', '24h', '7d'].map(p => (
- <button
+ <Button
key={p}
- className={`btn btn-sm ${compPeriod === p ? 'btn-primary' : 'btn-ghost'}`}
+ size="sm"
+ variant={compPeriod === p ? 'default' : 'ghost'}
onClick={() => setCompPeriod(p)}
>
{p}
- </button>
+ </Button>
))}
</div>
</div>
</div>
<div className="flex justify-end mb-4">
- <button
- className="btn btn-primary"
+ <Button
onClick={loadComparison}
disabled={selectedServers.length === 0 || loading}
>
<BarChart3 size={16} /> Compare
- </button>
+ </Button>
</div>
{compChartData.length > 0 && compData?.series && (
@@ -454,13 +458,14 @@ const FleetMonitor = () => {
<h2>Metric Alerts</h2>
<div className="flex gap-1">
{['active', 'acknowledged', 'resolved', 'all'].map(f => (
- <button
+ <Button
key={f}
- className={`btn btn-sm ${alertFilter === f ? 'btn-primary' : 'btn-ghost'}`}
+ size="sm"
+ variant={alertFilter === f ? 'default' : 'ghost'}
onClick={() => setAlertFilter(f)}
>
{f.charAt(0).toUpperCase() + f.slice(1)}
- </button>
+ </Button>
))}
</div>
</div>
@@ -487,31 +492,31 @@ const FleetMonitor = () => {
<td className="font-mono">{a.value}%</td>
<td className="font-mono">{a.threshold}%</td>
<td>
- <span className={`badge ${a.severity === 'critical' ? 'badge-error' : 'badge-warning'}`}>
+ <Badge variant={a.severity === 'critical' ? 'destructive' : 'warning'}>
{a.severity}
- </span>
+ </Badge>
</td>
<td>
- <span className={`badge ${a.status === 'active' ? 'badge-error' : a.status === 'acknowledged' ? 'badge-warning' : 'badge-success'}`}>
+ <Badge variant={a.status === 'active' ? 'destructive' : a.status === 'acknowledged' ? 'warning' : 'success'}>
{a.status}
- </span>
+ </Badge>
</td>
<td className="text-sm">{new Date(a.created_at).toLocaleString()}</td>
<td className="actions">
{a.status === 'active' && (
<>
- <button className="btn btn-sm btn-ghost" onClick={() => acknowledgeAlert(a.id)}>
+ <Button variant="ghost" size="sm" onClick={() => acknowledgeAlert(a.id)}>
<Eye size={14} /> Ack
- </button>
- <button className="btn btn-sm btn-ghost" onClick={() => resolveAlert(a.id)}>
+ </Button>
+ <Button variant="ghost" size="sm" onClick={() => resolveAlert(a.id)}>
<CheckCircle size={14} />
- </button>
+ </Button>
</>
)}
{a.status === 'acknowledged' && (
- <button className="btn btn-sm btn-ghost" onClick={() => resolveAlert(a.id)}>
+ <Button variant="ghost" size="sm" onClick={() => resolveAlert(a.id)}>
<CheckCircle size={14} /> Resolve
- </button>
+ </Button>
)}
</td>
</tr>
@@ -552,9 +557,9 @@ const FleetMonitor = () => {
<td className="text-red-600">{t.critical_threshold}%</td>
<td>{t.duration_seconds}s</td>
<td>
- <button className="btn btn-ghost btn-sm text-red-600" onClick={() => deleteThreshold(t.id)}>
+ <Button variant="ghost" size="sm" className="text-red-600" onClick={() => deleteThreshold(t.id)}>
<XCircle size={14} />
- </button>
+ </Button>
</td>
</tr>
))}
@@ -594,25 +599,25 @@ const FleetMonitor = () => {
</div>
<div className="form-group">
<label>Duration (seconds)</label>
- <input type="number" className="form-input w-full" value={newThreshold.duration_seconds}
+ <Input type="number" value={newThreshold.duration_seconds}
onChange={e => setNewThreshold(p => ({ ...p, duration_seconds: parseInt(e.target.value) || 300 }))} />
</div>
</div>
<div className="grid grid-cols-2 gap-4">
<div className="form-group">
<label>Warning (%)</label>
- <input type="number" className="form-input w-full" value={newThreshold.warning_threshold}
+ <Input type="number" value={newThreshold.warning_threshold}
onChange={e => setNewThreshold(p => ({ ...p, warning_threshold: parseFloat(e.target.value) || 80 }))} />
</div>
<div className="form-group">
<label>Critical (%)</label>
- <input type="number" className="form-input w-full" value={newThreshold.critical_threshold}
+ <Input type="number" value={newThreshold.critical_threshold}
onChange={e => setNewThreshold(p => ({ ...p, critical_threshold: parseFloat(e.target.value) || 95 }))} />
</div>
</div>
- <button className="btn btn-primary w-full" onClick={saveThreshold}>
+ <Button className="w-full" onClick={saveThreshold}>
Save Threshold
- </button>
+ </Button>
</div>
</div>
</div>
@@ -648,9 +653,9 @@ const FleetMonitor = () => {
<td className="font-mono">{a.stddev}</td>
<td className="font-mono font-bold">{a.z_score}</td>
<td>
- <span className={`badge ${a.direction === 'high' ? 'badge-error' : 'badge-info'}`}>
+ <Badge variant={a.direction === 'high' ? 'destructive' : 'info'}>
{a.direction === 'high' ? 'Unusually High' : 'Unusually Low'}
- </span>
+ </Badge>
</td>
</tr>
))}
@@ -687,9 +692,9 @@ const FleetMonitor = () => {
</select>
</div>
<div className="form-group flex items-end">
- <button className="btn btn-primary" onClick={() => loadForecast()} disabled={!forecastServer}>
+ <Button onClick={() => loadForecast()} disabled={!forecastServer}>
<TrendingUp size={16} /> Forecast
- </button>
+ </Button>
</div>
</div>
@@ -775,9 +780,8 @@ const FleetMonitor = () => {
<div className="card-body">
<div className="flex gap-3 mb-6">
<div className="flex-1">
- <input
+ <Input
type="text"
- className="form-input w-full"
placeholder="Search for servers, containers, tags..."
value={searchQuery}
onChange={e => setSearchQuery(e.target.value)}
@@ -790,9 +794,9 @@ const FleetMonitor = () => {
<option value="container">Containers</option>
<option value="tag">Tags</option>
</select>
- <button className="btn btn-primary" onClick={handleSearch} disabled={searchQuery.length < 2}>
+ <Button onClick={handleSearch} disabled={searchQuery.length < 2}>
<Search size={16} /> Search
- </button>
+ </Button>
</div>
{searchResults.length > 0 ? (
@@ -811,13 +815,13 @@ const FleetMonitor = () => {
{searchResults.map((r, i) => (
<tr key={i}>
<td className="font-semibold">{r.server_name}</td>
- <td><span className="badge badge-default">{r.match_type}</span></td>
+ <td><Badge variant="secondary">{r.match_type}</Badge></td>
<td>{r.match_name}</td>
<td className="text-sm text-gray-500">{r.match_detail}</td>
<td>
- <span className={`badge ${r.status === 'online' || r.status === 'running' ? 'badge-success' : 'badge-error'}`}>
+ <Badge variant={r.status === 'online' || r.status === 'running' ? 'success' : 'destructive'}>
{r.status}
- </span>
+ </Badge>
</td>
</tr>
))}
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index cd9b3784..3f166b00 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -4,6 +4,10 @@ import { api } from '../services/api';
import { useToast } from '../contexts/ToastContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['overview', 'repositories', 'access', 'webhooks', 'deployments', 'settings'];
@@ -569,34 +573,33 @@ function Git() {
</div>
<div className="page-header-actions">
{!status?.installed ? (
- <button className="btn btn-primary" onClick={() => setShowInstallModal(true)}>
+ <Button onClick={() => setShowInstallModal(true)}>
Install Git Server
- </button>
+ </Button>
) : (
<>
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={openGitea}
disabled={!status?.running}
>
Open Gitea
- </button>
+ </Button>
{status?.running ? (
- <button
- className="btn btn-warning"
+ <Button
+ variant="secondary"
onClick={handleStop}
disabled={actionLoading}
>
Stop Server
- </button>
+ </Button>
) : (
- <button
- className="btn btn-primary"
+ <Button
onClick={handleStart}
disabled={actionLoading}
>
Start Server
- </button>
+ </Button>
)}
</>
)}
@@ -631,9 +634,9 @@ function Git() {
</ul>
</div>
- <button className="btn btn-primary btn-lg" onClick={() => setShowInstallModal(true)}>
+ <Button size="lg" onClick={() => setShowInstallModal(true)}>
Install Git Server
- </button>
+ </Button>
</div>
) : (
<>
@@ -690,720 +693,693 @@ function Git() {
</div>
</div>
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'overview' ? 'active' : ''}`}
- onClick={() => setActiveTab('overview')}
- >
- Overview
- </button>
- <button
- className={`tab ${activeTab === 'repositories' ? 'active' : ''}`}
- onClick={() => setActiveTab('repositories')}
- >
- Repositories
- </button>
- <button
- className={`tab ${activeTab === 'access' ? 'active' : ''}`}
- onClick={() => setActiveTab('access')}
- >
- Access Info
- </button>
- <button
- className={`tab ${activeTab === 'webhooks' ? 'active' : ''}`}
- onClick={() => setActiveTab('webhooks')}
- >
- Webhooks
- </button>
- <button
- className={`tab ${activeTab === 'deployments' ? 'active' : ''}`}
- onClick={() => setActiveTab('deployments')}
- >
- Deployments
- </button>
- <button
- className={`tab ${activeTab === 'settings' ? 'active' : ''}`}
- onClick={() => setActiveTab('settings')}
- >
- Settings
- </button>
- </div>
-
- <div className="tab-content">
- {activeTab === 'overview' && (
- <div className="overview-tab">
- <div className="info-card">
- <h3>Server Information</h3>
- <div className="info-grid">
- <div className="info-item">
- <span className="info-label">Status</span>
- <span className={`info-value ${status?.running ? 'text-success' : 'text-danger'}`}>
- {status?.running ? 'Running' : 'Stopped'}
- </span>
- </div>
- <div className="info-item">
- <span className="info-label">HTTP URL</span>
- <span className="info-value">
- {status?.running ? (
- <a href={getGiteaUrl()} target="_blank" rel="noopener noreferrer">
- {getGiteaUrl()}
- </a>
- ) : 'Server not running'}
- </span>
- </div>
- <div className="info-item">
- <span className="info-label">SSH Clone URL</span>
- <span className="info-value code">
- ssh://git@{window.location.hostname}:{status?.ssh_port}/user/repo.git
- </span>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="repositories">Repositories</TabsTrigger>
+ <TabsTrigger value="access">Access Info</TabsTrigger>
+ <TabsTrigger value="webhooks">Webhooks</TabsTrigger>
+ <TabsTrigger value="deployments">Deployments</TabsTrigger>
+ <TabsTrigger value="settings">Settings</TabsTrigger>
+ </TabsList>
+
+ <div className="tab-content">
+ <TabsContent value="overview">
+ <div className="overview-tab">
+ <div className="info-card">
+ <h3>Server Information</h3>
+ <div className="info-grid">
+ <div className="info-item">
+ <span className="info-label">Status</span>
+ <span className={`info-value ${status?.running ? 'text-success' : 'text-danger'}`}>
+ {status?.running ? 'Running' : 'Stopped'}
+ </span>
+ </div>
+ <div className="info-item">
+ <span className="info-label">HTTP URL</span>
+ <span className="info-value">
+ {status?.running ? (
+ <a href={getGiteaUrl()} target="_blank" rel="noopener noreferrer">
+ {getGiteaUrl()}
+ </a>
+ ) : 'Server not running'}
+ </span>
+ </div>
+ <div className="info-item">
+ <span className="info-label">SSH Clone URL</span>
+ <span className="info-value code">
+ ssh://git@{window.location.hostname}:{status?.ssh_port}/user/repo.git
+ </span>
+ </div>
</div>
</div>
- </div>
- <div className="info-card">
- <h3>Quick Actions</h3>
- <div className="quick-actions">
- <button
- className="btn btn-secondary"
- onClick={openGitea}
- disabled={!status?.running}
- >
- Open Web Interface
- </button>
- <button
- className="btn btn-secondary"
- onClick={() => {
- navigator.clipboard.writeText(`git clone ssh://git@${window.location.hostname}:${status?.ssh_port}/user/repo.git`);
- toast.success('SSH URL copied to clipboard');
- }}
- >
- Copy SSH URL
- </button>
+ <div className="info-card">
+ <h3>Quick Actions</h3>
+ <div className="quick-actions">
+ <Button
+ variant="outline"
+ onClick={openGitea}
+ disabled={!status?.running}
+ >
+ Open Web Interface
+ </Button>
+ <Button
+ variant="outline"
+ onClick={() => {
+ navigator.clipboard.writeText(`git clone ssh://git@${window.location.hostname}:${status?.ssh_port}/user/repo.git`);
+ toast.success('SSH URL copied to clipboard');
+ }}
+ >
+ Copy SSH URL
+ </Button>
+ </div>
</div>
</div>
- </div>
- )}
-
- {activeTab === 'repositories' && (
- <div className="repositories-tab">
- {!status?.running ? (
- <div className="empty-state">
- <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
- <circle cx="12" cy="12" r="10"/>
- <line x1="12" y1="8" x2="12" y2="12"/>
- <line x1="12" y1="16" x2="12.01" y2="16"/>
- </svg>
- <h4>Server Not Running</h4>
- <p>Start the Git server to browse repositories</p>
- <button className="btn btn-primary" onClick={handleStart}>
- Start Server
- </button>
- </div>
- ) : repoView === 'list' ? (
- <>
- <div className="repos-header">
- <h3>Repositories</h3>
- <button
- className="btn btn-secondary btn-sm"
- onClick={loadRepositories}
- disabled={reposLoading}
- >
- Refresh
- </button>
+ </TabsContent>
+
+ <TabsContent value="repositories">
+ <div className="repositories-tab">
+ {!status?.running ? (
+ <div className="empty-state">
+ <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
+ <circle cx="12" cy="12" r="10"/>
+ <line x1="12" y1="8" x2="12" y2="12"/>
+ <line x1="12" y1="16" x2="12.01" y2="16"/>
+ </svg>
+ <h4>Server Not Running</h4>
+ <p>Start the Git server to browse repositories</p>
+ <Button onClick={handleStart}>
+ Start Server
+ </Button>
</div>
-
- {reposLoading ? (
- <div className="loading-state">
- <Spinner />
- </div>
- ) : repositories.length === 0 ? (
- <div className="empty-state">
- <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
- </svg>
- <h4>No Repositories Yet</h4>
- <p>Create your first repository in Gitea</p>
- <button className="btn btn-primary" onClick={openGitea}>
- Open Gitea
- </button>
+ ) : repoView === 'list' ? (
+ <>
+ <div className="repos-header">
+ <h3>Repositories</h3>
+ <Button
+ variant="outline"
+ size="sm"
+ onClick={loadRepositories}
+ disabled={reposLoading}
+ >
+ Refresh
+ </Button>
</div>
- ) : (
- <div className="repos-list">
- {repositories.map((repo) => (
- <div
- key={repo.id}
- className="repo-card"
- onClick={() => selectRepository(repo)}
- >
- <div className="repo-info">
- <div className="repo-name">
- <span className="owner">{repo.owner.login}/</span>
- <span className="name">{repo.name}</span>
- {repo.private && <span className="badge private">Private</span>}
- {repo.fork && <span className="badge fork">Fork</span>}
+
+ {reposLoading ? (
+ <div className="loading-state">
+ <Spinner />
+ </div>
+ ) : repositories.length === 0 ? (
+ <div className="empty-state">
+ <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
+ </svg>
+ <h4>No Repositories Yet</h4>
+ <p>Create your first repository in Gitea</p>
+ <Button onClick={openGitea}>
+ Open Gitea
+ </Button>
+ </div>
+ ) : (
+ <div className="repos-list">
+ {repositories.map((repo) => (
+ <div
+ key={repo.id}
+ className="repo-card"
+ onClick={() => selectRepository(repo)}
+ >
+ <div className="repo-info">
+ <div className="repo-name">
+ <span className="owner">{repo.owner.login}/</span>
+ <span className="name">{repo.name}</span>
+ {repo.private && <span className="badge private">Private</span>}
+ {repo.fork && <span className="badge fork">Fork</span>}
+ </div>
+ {repo.description && (
+ <p className="repo-description">{repo.description}</p>
+ )}
+ <div className="repo-meta">
+ <span className="meta-item">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <circle cx="18" cy="18" r="3"/>
+ <circle cx="6" cy="6" r="3"/>
+ <path d="M6 21V9a9 9 0 0 0 9 9"/>
+ </svg>
+ {repo.default_branch}
+ </span>
+ <span className="meta-item">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
+ </svg>
+ {repo.stars}
+ </span>
+ <span className="meta-item">
+ <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
+ <circle cx="12" cy="18" r="3"/>
+ <circle cx="6" cy="6" r="3"/>
+ <circle cx="18" cy="6" r="3"/>
+ <path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9"/>
+ <path d="M12 12v3"/>
+ </svg>
+ {repo.forks}
+ </span>
+ <span className="meta-item updated">
+ Updated {formatDate(repo.updated_at)}
+ </span>
+ </div>
</div>
- {repo.description && (
- <p className="repo-description">{repo.description}</p>
- )}
- <div className="repo-meta">
- <span className="meta-item">
- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
- <circle cx="18" cy="18" r="3"/>
- <circle cx="6" cy="6" r="3"/>
- <path d="M6 21V9a9 9 0 0 0 9 9"/>
- </svg>
- {repo.default_branch}
- </span>
- <span className="meta-item">
- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
- <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
- </svg>
- {repo.stars}
- </span>
- <span className="meta-item">
- <svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" fill="none" strokeWidth="2">
- <circle cx="12" cy="18" r="3"/>
- <circle cx="6" cy="6" r="3"/>
- <circle cx="18" cy="6" r="3"/>
- <path d="M18 9v1a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V9"/>
- <path d="M12 12v3"/>
- </svg>
- {repo.forks}
- </span>
- <span className="meta-item updated">
- Updated {formatDate(repo.updated_at)}
- </span>
+ <div className="repo-arrow">
+ <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="9 18 15 12 9 6"/>
+ </svg>
</div>
</div>
- <div className="repo-arrow">
- <svg viewBox="0 0 24 24" width="20" height="20" stroke="currentColor" fill="none" strokeWidth="2">
- <polyline points="9 18 15 12 9 6"/>
- </svg>
- </div>
- </div>
- ))}
- </div>
- )}
- </>
- ) : (
- <div className="repo-detail">
- <div className="repo-detail-header">
- <button className="btn btn-ghost btn-sm" onClick={backToRepoList}>
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <polyline points="15 18 9 12 15 6"/>
- </svg>
- Back
- </button>
- <div className="repo-title">
- <h3>{selectedRepo?.owner.login}/{selectedRepo?.name}</h3>
- {selectedRepo?.description && (
- <p>{selectedRepo.description}</p>
- )}
- </div>
- <div className="branch-selector">
- <select
- value={selectedBranch || ''}
- onChange={(e) => changeBranch(e.target.value)}
- >
- {branches.map((b) => (
- <option key={b.name} value={b.name}>{b.name}</option>
))}
- </select>
+ </div>
+ )}
+ </>
+ ) : (
+ <div className="repo-detail">
+ <div className="repo-detail-header">
+ <Button variant="ghost" size="sm" onClick={backToRepoList}>
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="15 18 9 12 15 6"/>
+ </svg>
+ Back
+ </Button>
+ <div className="repo-title">
+ <h3>{selectedRepo?.owner.login}/{selectedRepo?.name}</h3>
+ {selectedRepo?.description && (
+ <p>{selectedRepo.description}</p>
+ )}
+ </div>
+ <div className="branch-selector">
+ <select
+ value={selectedBranch || ''}
+ onChange={(e) => changeBranch(e.target.value)}
+ >
+ {branches.map((b) => (
+ <option key={b.name} value={b.name}>{b.name}</option>
+ ))}
+ </select>
+ </div>
</div>
- </div>
- <div className="repo-detail-tabs">
- <button
- className={`tab ${repoDetailTab === 'files' ? 'active' : ''}`}
- onClick={() => setRepoDetailTab('files')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
- </svg>
- Files
- </button>
- <button
- className={`tab ${repoDetailTab === 'commits' ? 'active' : ''}`}
- onClick={() => setRepoDetailTab('commits')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <circle cx="12" cy="12" r="4"/>
- <line x1="1.05" y1="12" x2="7" y2="12"/>
- <line x1="17.01" y1="12" x2="22.96" y2="12"/>
- </svg>
- Commits ({commits.length})
- </button>
- <button
- className={`tab ${repoDetailTab === 'branches' ? 'active' : ''}`}
- onClick={() => setRepoDetailTab('branches')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <line x1="6" y1="3" x2="6" y2="15"/>
- <circle cx="18" cy="6" r="3"/>
- <circle cx="6" cy="18" r="3"/>
- <path d="M18 9a9 9 0 0 1-9 9"/>
- </svg>
- Branches ({branches.length})
- </button>
- </div>
+ <div className="repo-detail-tabs">
+ <button
+ className={`tab ${repoDetailTab === 'files' ? 'active' : ''}`}
+ onClick={() => setRepoDetailTab('files')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
+ </svg>
+ Files
+ </button>
+ <button
+ className={`tab ${repoDetailTab === 'commits' ? 'active' : ''}`}
+ onClick={() => setRepoDetailTab('commits')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <circle cx="12" cy="12" r="4"/>
+ <line x1="1.05" y1="12" x2="7" y2="12"/>
+ <line x1="17.01" y1="12" x2="22.96" y2="12"/>
+ </svg>
+ Commits ({commits.length})
+ </button>
+ <button
+ className={`tab ${repoDetailTab === 'branches' ? 'active' : ''}`}
+ onClick={() => setRepoDetailTab('branches')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <line x1="6" y1="3" x2="6" y2="15"/>
+ <circle cx="18" cy="6" r="3"/>
+ <circle cx="6" cy="18" r="3"/>
+ <path d="M18 9a9 9 0 0 1-9 9"/>
+ </svg>
+ Branches ({branches.length})
+ </button>
+ </div>
- <div className="repo-detail-content">
- {repoDetailTab === 'files' && (
- <div className="files-browser">
- {currentPath && (
- <div className="breadcrumb">
- <button onClick={() => navigateToPath('')}>
- {selectedRepo?.name}
- </button>
- {currentPath.split('/').map((part, i, arr) => (
- <span key={i}>
- <span className="separator">/</span>
- <button
- onClick={() => navigateToPath(arr.slice(0, i + 1).join('/'))}
- >
- {part}
- </button>
- </span>
- ))}
- </div>
- )}
- <div className="files-list">
+ <div className="repo-detail-content">
+ {repoDetailTab === 'files' && (
+ <div className="files-browser">
{currentPath && (
- <div className="file-item dir" onClick={navigateUp}>
- <div className="file-icon">
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <polyline points="15 18 9 12 15 6"/>
- </svg>
- </div>
- <span className="file-name">..</span>
+ <div className="breadcrumb">
+ <button onClick={() => navigateToPath('')}>
+ {selectedRepo?.name}
+ </button>
+ {currentPath.split('/').map((part, i, arr) => (
+ <span key={i}>
+ <span className="separator">/</span>
+ <button
+ onClick={() => navigateToPath(arr.slice(0, i + 1).join('/'))}
+ >
+ {part}
+ </button>
+ </span>
+ ))}
</div>
)}
- {files
- .sort((a, b) => {
- if (a.type === 'dir' && b.type !== 'dir') return -1;
- if (a.type !== 'dir' && b.type === 'dir') return 1;
- return a.name.localeCompare(b.name);
- })
- .map((file) => (
- <div
- key={file.path}
- className={`file-item ${file.type}`}
- onClick={() => file.type === 'dir' && navigateToPath(file.path)}
- >
+ <div className="files-list">
+ {currentPath && (
+ <div className="file-item dir" onClick={navigateUp}>
<div className="file-icon">
- {file.type === 'dir' ? (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
- </svg>
- ) : (
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
- <polyline points="14 2 14 8 20 8"/>
- </svg>
- )}
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <polyline points="15 18 9 12 15 6"/>
+ </svg>
</div>
- <span className="file-name">{file.name}</span>
- {file.type === 'file' && (
- <span className="file-size">{formatFileSize(file.size)}</span>
- )}
+ <span className="file-name">..</span>
</div>
- ))}
+ )}
+ {files
+ .sort((a, b) => {
+ if (a.type === 'dir' && b.type !== 'dir') return -1;
+ if (a.type !== 'dir' && b.type === 'dir') return 1;
+ return a.name.localeCompare(b.name);
+ })
+ .map((file) => (
+ <div
+ key={file.path}
+ className={`file-item ${file.type}`}
+ onClick={() => file.type === 'dir' && navigateToPath(file.path)}
+ >
+ <div className="file-icon">
+ {file.type === 'dir' ? (
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"/>
+ </svg>
+ ) : (
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
+ <polyline points="14 2 14 8 20 8"/>
+ </svg>
+ )}
+ </div>
+ <span className="file-name">{file.name}</span>
+ {file.type === 'file' && (
+ <span className="file-size">{formatFileSize(file.size)}</span>
+ )}
+ </div>
+ ))}
+ </div>
</div>
- </div>
- )}
+ )}
- {repoDetailTab === 'commits' && (
- <div className="commits-list">
- {commits.map((commit) => (
- <div key={commit.sha} className="commit-item">
- <div className="commit-info">
- <div className="commit-message">
- {commit.message?.split('\n')[0]}
+ {repoDetailTab === 'commits' && (
+ <div className="commits-list">
+ {commits.map((commit) => (
+ <div key={commit.sha} className="commit-item">
+ <div className="commit-info">
+ <div className="commit-message">
+ {commit.message?.split('\n')[0]}
+ </div>
+ <div className="commit-meta">
+ <span className="author">{commit.author?.name}</span>
+ <span className="date">{formatDate(commit.author?.date)}</span>
+ </div>
</div>
- <div className="commit-meta">
- <span className="author">{commit.author?.name}</span>
- <span className="date">{formatDate(commit.author?.date)}</span>
+ <div className="commit-sha">
+ <code>{commit.short_sha}</code>
</div>
</div>
- <div className="commit-sha">
- <code>{commit.short_sha}</code>
- </div>
- </div>
- ))}
- {commits.length >= 30 && (
- <button
- className="btn btn-secondary btn-block"
- onClick={loadMoreCommits}
- >
- Load More
- </button>
- )}
- </div>
- )}
+ ))}
+ {commits.length >= 30 && (
+ <Button
+ variant="outline"
+ className="btn-block"
+ onClick={loadMoreCommits}
+ >
+ Load More
+ </Button>
+ )}
+ </div>
+ )}
- {repoDetailTab === 'branches' && (
- <div className="branches-list">
- {branches.map((branch) => (
- <div
- key={branch.name}
- className={`branch-item ${branch.name === selectedBranch ? 'active' : ''}`}
- >
- <div className="branch-info">
- <div className="branch-name">
- <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
- <line x1="6" y1="3" x2="6" y2="15"/>
- <circle cx="18" cy="6" r="3"/>
- <circle cx="6" cy="18" r="3"/>
- <path d="M18 9a9 9 0 0 1-9 9"/>
- </svg>
- {branch.name}
- {branch.name === selectedRepo?.default_branch && (
- <span className="badge default">default</span>
- )}
- {branch.protected && (
- <span className="badge protected">protected</span>
+ {repoDetailTab === 'branches' && (
+ <div className="branches-list">
+ {branches.map((branch) => (
+ <div
+ key={branch.name}
+ className={`branch-item ${branch.name === selectedBranch ? 'active' : ''}`}
+ >
+ <div className="branch-info">
+ <div className="branch-name">
+ <svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
+ <line x1="6" y1="3" x2="6" y2="15"/>
+ <circle cx="18" cy="6" r="3"/>
+ <circle cx="6" cy="18" r="3"/>
+ <path d="M18 9a9 9 0 0 1-9 9"/>
+ </svg>
+ {branch.name}
+ {branch.name === selectedRepo?.default_branch && (
+ <span className="badge default">default</span>
+ )}
+ {branch.protected && (
+ <span className="badge protected">protected</span>
+ )}
+ </div>
+ {branch.commit && (
+ <div className="branch-commit">
+ <code>{branch.commit.sha?.slice(0, 7)}</code>
+ <span className="commit-date">
+ {formatDate(branch.commit.date)}
+ </span>
+ </div>
)}
</div>
- {branch.commit && (
- <div className="branch-commit">
- <code>{branch.commit.sha?.slice(0, 7)}</code>
- <span className="commit-date">
- {formatDate(branch.commit.date)}
- </span>
- </div>
- )}
+ <Button
+ size="sm"
+ variant="ghost"
+ onClick={() => changeBranch(branch.name)}
+ >
+ Switch
+ </Button>
</div>
- <button
- className="btn btn-sm btn-ghost"
- onClick={() => changeBranch(branch.name)}
- >
- Switch
- </button>
- </div>
- ))}
- </div>
- )}
+ ))}
+ </div>
+ )}
+ </div>
</div>
- </div>
- )}
- </div>
- )}
-
- {activeTab === 'access' && (
- <div className="access-tab">
- <div className="info-card">
- <h3>HTTP Access</h3>
- <p className="text-muted">Access Gitea through your web browser</p>
- <div className="access-url">
- <code>{getGiteaUrl()}</code>
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => {
- navigator.clipboard.writeText(getGiteaUrl());
- toast.success('URL copied');
- }}
- >
- Copy
- </button>
- </div>
+ )}
</div>
- <div className="info-card">
- <h3>SSH Access</h3>
- <p className="text-muted">Clone repositories via SSH</p>
- <div className="access-url">
- <code>ssh://git@{window.location.hostname}:{status?.ssh_port}/username/repo.git</code>
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => {
- navigator.clipboard.writeText(`ssh://git@${window.location.hostname}:${status?.ssh_port}/username/repo.git`);
- toast.success('URL copied');
- }}
- >
- Copy
- </button>
+ </TabsContent>
+
+ <TabsContent value="access">
+ <div className="access-tab">
+ <div className="info-card">
+ <h3>HTTP Access</h3>
+ <p className="text-muted">Access Gitea through your web browser</p>
+ <div className="access-url">
+ <code>{getGiteaUrl()}</code>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => {
+ navigator.clipboard.writeText(getGiteaUrl());
+ toast.success('URL copied');
+ }}
+ >
+ Copy
+ </Button>
+ </div>
</div>
- <div className="ssh-note">
- <strong>Note:</strong> Add your SSH public key in Gitea settings to use SSH access.
+ <div className="info-card">
+ <h3>SSH Access</h3>
+ <p className="text-muted">Clone repositories via SSH</p>
+ <div className="access-url">
+ <code>ssh://git@{window.location.hostname}:{status?.ssh_port}/username/repo.git</code>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => {
+ navigator.clipboard.writeText(`ssh://git@${window.location.hostname}:${status?.ssh_port}/username/repo.git`);
+ toast.success('URL copied');
+ }}
+ >
+ Copy
+ </Button>
+ </div>
+ <div className="ssh-note">
+ <strong>Note:</strong> Add your SSH public key in Gitea settings to use SSH access.
+ </div>
</div>
</div>
- </div>
- )}
-
- {activeTab === 'webhooks' && (
- <div className="webhooks-tab">
- <div className="webhooks-header">
- <div>
- <h3>External Repository Webhooks</h3>
- <p className="text-muted">Sync repositories from GitHub, GitLab, or Bitbucket</p>
+ </TabsContent>
+
+ <TabsContent value="webhooks">
+ <div className="webhooks-tab">
+ <div className="webhooks-header">
+ <div>
+ <h3>External Repository Webhooks</h3>
+ <p className="text-muted">Sync repositories from GitHub, GitLab, or Bitbucket</p>
+ </div>
+ <Button onClick={() => setShowWebhookModal(true)}>
+ Add Webhook
+ </Button>
</div>
- <button
- className="btn btn-primary"
- onClick={() => setShowWebhookModal(true)}
- >
- Add Webhook
- </button>
- </div>
- {webhooksLoading ? (
- <div className="loading-state">
- <Spinner />
- </div>
- ) : webhooks.length === 0 ? (
- <div className="empty-state">
- <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
- <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
- <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
- </svg>
- <h4>No Webhooks Configured</h4>
- <p>Add a webhook to sync repositories from external sources</p>
- <button
- className="btn btn-primary"
- onClick={() => setShowWebhookModal(true)}
- >
- Add Your First Webhook
- </button>
- </div>
- ) : (
- <div className="webhooks-list">
- {webhooks.map((webhook) => (
- <div key={webhook.id} className={`webhook-card ${!webhook.is_active ? 'inactive' : ''}`}>
- <div className="webhook-header">
- <div className="webhook-info">
- <span className={`source-badge ${webhook.source}`}>
- {webhook.source}
- </span>
- <h4>{webhook.name}</h4>
- </div>
- <div className="webhook-status">
- <span className={`status-dot ${webhook.is_active ? 'active' : 'inactive'}`}></span>
- {webhook.is_active ? 'Active' : 'Inactive'}
+ {webhooksLoading ? (
+ <div className="loading-state">
+ <Spinner />
+ </div>
+ ) : webhooks.length === 0 ? (
+ <div className="empty-state">
+ <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
+ <path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
+ <path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
+ </svg>
+ <h4>No Webhooks Configured</h4>
+ <p>Add a webhook to sync repositories from external sources</p>
+ <Button onClick={() => setShowWebhookModal(true)}>
+ Add Your First Webhook
+ </Button>
+ </div>
+ ) : (
+ <div className="webhooks-list">
+ {webhooks.map((webhook) => (
+ <div key={webhook.id} className={`webhook-card ${!webhook.is_active ? 'inactive' : ''}`}>
+ <div className="webhook-header">
+ <div className="webhook-info">
+ <span className={`source-badge ${webhook.source}`}>
+ {webhook.source}
+ </span>
+ <h4>{webhook.name}</h4>
+ </div>
+ <div className="webhook-status">
+ <span className={`status-dot ${webhook.is_active ? 'active' : 'inactive'}`}></span>
+ {webhook.is_active ? 'Active' : 'Inactive'}
+ </div>
</div>
- </div>
- <div className="webhook-details">
- <div className="detail-item">
- <span className="label">Repository:</span>
- <span className="value">{webhook.source_repo_url}</span>
- </div>
- <div className="detail-item">
- <span className="label">Branch:</span>
- <span className="value">{webhook.source_branch}</span>
- </div>
- <div className="detail-item">
- <span className="label">Last Sync:</span>
- <span className="value">
- {webhook.last_sync_at
- ? new Date(webhook.last_sync_at).toLocaleString()
- : 'Never'}
- </span>
- </div>
- <div className="detail-item">
- <span className="label">Sync Count:</span>
- <span className="value">{webhook.sync_count}</span>
+ <div className="webhook-details">
+ <div className="detail-item">
+ <span className="label">Repository:</span>
+ <span className="value">{webhook.source_repo_url}</span>
+ </div>
+ <div className="detail-item">
+ <span className="label">Branch:</span>
+ <span className="value">{webhook.source_branch}</span>
+ </div>
+ <div className="detail-item">
+ <span className="label">Last Sync:</span>
+ <span className="value">
+ {webhook.last_sync_at
+ ? new Date(webhook.last_sync_at).toLocaleString()
+ : 'Never'}
+ </span>
+ </div>
+ <div className="detail-item">
+ <span className="label">Sync Count:</span>
+ <span className="value">{webhook.sync_count}</span>
+ </div>
</div>
- </div>
- <div className="webhook-actions">
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => copyWebhookUrl(webhook)}
- title="Copy webhook URL"
- >
- Copy URL
- </button>
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => handleTestWebhook(webhook.id)}
- title="Test webhook"
- >
- Test
- </button>
- <button
- className={`btn btn-sm ${webhook.is_active ? 'btn-warning' : 'btn-primary'}`}
- onClick={() => handleToggleWebhook(webhook.id)}
- >
- {webhook.is_active ? 'Disable' : 'Enable'}
- </button>
- <button
- className="btn btn-sm btn-danger"
- onClick={() => handleDeleteWebhook(webhook.id)}
- >
- Delete
- </button>
+ <div className="webhook-actions">
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => copyWebhookUrl(webhook)}
+ title="Copy webhook URL"
+ >
+ Copy URL
+ </Button>
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => handleTestWebhook(webhook.id)}
+ title="Test webhook"
+ >
+ Test
+ </Button>
+ <Button
+ size="sm"
+ variant={webhook.is_active ? 'secondary' : 'default'}
+ onClick={() => handleToggleWebhook(webhook.id)}
+ >
+ {webhook.is_active ? 'Disable' : 'Enable'}
+ </Button>
+ <Button
+ size="sm"
+ variant="destructive"
+ onClick={() => handleDeleteWebhook(webhook.id)}
+ >
+ Delete
+ </Button>
+ </div>
</div>
- </div>
- ))}
- </div>
- )}
- </div>
- )}
-
- {activeTab === 'deployments' && (
- <div className="deployments-tab">
- <div className="deployments-header">
- <div>
- <h3>Deployment History</h3>
- <p className="text-muted">Track automatic and manual deployments</p>
- </div>
- <button
- className="btn btn-secondary"
- onClick={loadAllDeployments}
- disabled={deploymentsLoading}
- >
- Refresh
- </button>
+ ))}
+ </div>
+ )}
</div>
-
- {deploymentsLoading ? (
- <div className="loading-state">
- <Spinner />
- </div>
- ) : deployments.length === 0 ? (
- <div className="empty-state">
- <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
- <path d="M12 2L2 7l10 5 10-5-10-5z"/>
- <path d="M2 17l10 5 10-5"/>
- <path d="M2 12l10 5 10-5"/>
- </svg>
- <h4>No Deployments Yet</h4>
- <p>Configure a webhook with "Deploy on Push" enabled to see deployments here</p>
- <button
- className="btn btn-primary"
- onClick={() => setActiveTab('webhooks')}
+ </TabsContent>
+
+ <TabsContent value="deployments">
+ <div className="deployments-tab">
+ <div className="deployments-header">
+ <div>
+ <h3>Deployment History</h3>
+ <p className="text-muted">Track automatic and manual deployments</p>
+ </div>
+ <Button
+ variant="outline"
+ onClick={loadAllDeployments}
+ disabled={deploymentsLoading}
>
- Configure Webhooks
- </button>
+ Refresh
+ </Button>
</div>
- ) : (
- <div className="deployments-list">
- {deployments.map((deployment) => (
- <div key={deployment.id} className={`deployment-card ${deployment.status}`}>
- <div className="deployment-header">
- <div className="deployment-version">
- <span className="version">v{deployment.version}</span>
- {deployment.is_rollback && (
- <span className="badge rollback">Rollback</span>
- )}
- <span className={`status-badge ${deployment.status}`}>
- {deployment.status}
- </span>
- </div>
- <div className="deployment-time">
- {formatDate(deployment.created_at)}
- </div>
- </div>
- <div className="deployment-details">
- {deployment.commit_sha && (
- <div className="detail-item">
- <span className="label">Commit:</span>
- <code>{deployment.commit_sha.slice(0, 7)}</code>
+ {deploymentsLoading ? (
+ <div className="loading-state">
+ <Spinner />
+ </div>
+ ) : deployments.length === 0 ? (
+ <div className="empty-state">
+ <svg viewBox="0 0 24 24" width="48" height="48" stroke="currentColor" fill="none" strokeWidth="1.5">
+ <path d="M12 2L2 7l10 5 10-5-10-5z"/>
+ <path d="M2 17l10 5 10-5"/>
+ <path d="M2 12l10 5 10-5"/>
+ </svg>
+ <h4>No Deployments Yet</h4>
+ <p>Configure a webhook with &quot;Deploy on Push&quot; enabled to see deployments here</p>
+ <Button onClick={() => setActiveTab('webhooks')}>
+ Configure Webhooks
+ </Button>
+ </div>
+ ) : (
+ <div className="deployments-list">
+ {deployments.map((deployment) => (
+ <div key={deployment.id} className={`deployment-card ${deployment.status}`}>
+ <div className="deployment-header">
+ <div className="deployment-version">
+ <span className="version">v{deployment.version}</span>
+ {deployment.is_rollback && (
+ <span className="badge rollback">Rollback</span>
+ )}
+ <span className={`status-badge ${deployment.status}`}>
+ {deployment.status}
+ </span>
</div>
- )}
- {deployment.commit_message && (
- <div className="detail-item commit-message">
- <span className="message">{deployment.commit_message.split('\n')[0]}</span>
+ <div className="deployment-time">
+ {formatDate(deployment.created_at)}
</div>
- )}
- <div className="detail-item">
- <span className="label">Branch:</span>
- <span className="value">{deployment.branch}</span>
</div>
- <div className="detail-item">
- <span className="label">Triggered by:</span>
- <span className="value">{deployment.triggered_by}</span>
- </div>
- {deployment.webhook_name && (
+
+ <div className="deployment-details">
+ {deployment.commit_sha && (
+ <div className="detail-item">
+ <span className="label">Commit:</span>
+ <code>{deployment.commit_sha.slice(0, 7)}</code>
+ </div>
+ )}
+ {deployment.commit_message && (
+ <div className="detail-item commit-message">
+ <span className="message">{deployment.commit_message.split('\n')[0]}</span>
+ </div>
+ )}
<div className="detail-item">
- <span className="label">Webhook:</span>
- <span className="value">{deployment.webhook_name}</span>
+ <span className="label">Branch:</span>
+ <span className="value">{deployment.branch}</span>
</div>
- )}
- {deployment.duration_seconds != null && (
<div className="detail-item">
- <span className="label">Duration:</span>
- <span className="value">{deployment.duration_seconds}s</span>
- </div>
- )}
- {deployment.error_message && (
- <div className="detail-item error">
- <span className="label">Error:</span>
- <span className="value">{deployment.error_message}</span>
+ <span className="label">Triggered by:</span>
+ <span className="value">{deployment.triggered_by}</span>
</div>
- )}
- </div>
+ {deployment.webhook_name && (
+ <div className="detail-item">
+ <span className="label">Webhook:</span>
+ <span className="value">{deployment.webhook_name}</span>
+ </div>
+ )}
+ {deployment.duration_seconds != null && (
+ <div className="detail-item">
+ <span className="label">Duration:</span>
+ <span className="value">{deployment.duration_seconds}s</span>
+ </div>
+ )}
+ {deployment.error_message && (
+ <div className="detail-item error">
+ <span className="label">Error:</span>
+ <span className="value">{deployment.error_message}</span>
+ </div>
+ )}
+ </div>
- <div className="deployment-actions">
- <button
- className="btn btn-sm btn-secondary"
- onClick={() => viewDeploymentLogs(deployment.id)}
- >
- View Logs
- </button>
- {deployment.status === 'success' && !deployment.is_rollback && (
- <button
- className="btn btn-sm btn-warning"
- onClick={() => handleRollback(deployment.app_id, deployment.version)}
+ <div className="deployment-actions">
+ <Button
+ size="sm"
+ variant="outline"
+ onClick={() => viewDeploymentLogs(deployment.id)}
>
- Rollback to This
- </button>
- )}
- {deployment.status === 'success' && (
- <button
- className="btn btn-sm btn-primary"
- onClick={() => handleTriggerDeploy(deployment.app_id)}
- disabled={deployingAppId === deployment.app_id}
- >
- {deployingAppId === deployment.app_id ? 'Deploying...' : 'Redeploy'}
- </button>
- )}
+ View Logs
+ </Button>
+ {deployment.status === 'success' && !deployment.is_rollback && (
+ <Button
+ size="sm"
+ variant="secondary"
+ onClick={() => handleRollback(deployment.app_id, deployment.version)}
+ >
+ Rollback to This
+ </Button>
+ )}
+ {deployment.status === 'success' && (
+ <Button
+ size="sm"
+ onClick={() => handleTriggerDeploy(deployment.app_id)}
+ disabled={deployingAppId === deployment.app_id}
+ >
+ {deployingAppId === deployment.app_id ? 'Deploying...' : 'Redeploy'}
+ </Button>
+ )}
+ </div>
</div>
- </div>
- ))}
- </div>
- )}
- </div>
- )}
-
- {activeTab === 'settings' && (
- <div className="settings-tab">
- <div className="info-card">
- <h3>Server Management</h3>
- <div className="settings-actions">
- {status?.running ? (
- <button
- className="btn btn-warning"
- onClick={handleStop}
- disabled={actionLoading}
- >
- Stop Server
- </button>
- ) : (
- <button
- className="btn btn-primary"
- onClick={handleStart}
+ ))}
+ </div>
+ )}
+ </div>
+ </TabsContent>
+
+ <TabsContent value="settings">
+ <div className="settings-tab">
+ <div className="info-card">
+ <h3>Server Management</h3>
+ <div className="settings-actions">
+ {status?.running ? (
+ <Button
+ variant="secondary"
+ onClick={handleStop}
+ disabled={actionLoading}
+ >
+ Stop Server
+ </Button>
+ ) : (
+ <Button
+ onClick={handleStart}
+ disabled={actionLoading}
+ >
+ Start Server
+ </Button>
+ )}
+ <Button
+ variant="destructive"
+ onClick={handleUninstall}
disabled={actionLoading}
>
- Start Server
- </button>
- )}
- <button
- className="btn btn-danger"
- onClick={handleUninstall}
- disabled={actionLoading}
- >
- Uninstall
- </button>
+ Uninstall
+ </Button>
+ </div>
+ </div>
+ <div className="info-card danger-zone">
+ <h3>Danger Zone</h3>
+ <p className="text-muted">
+ Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it.
+ </p>
</div>
</div>
- <div className="info-card danger-zone">
- <h3>Danger Zone</h3>
- <p className="text-muted">
- Uninstalling will stop the Gitea container. Your data will be preserved unless you choose to remove it.
- </p>
- </div>
- </div>
- )}
- </div>
+ </TabsContent>
+ </div>
+ </Tabs>
</>
)}
@@ -1435,7 +1411,7 @@ function Git() {
<div className="form-group">
<label>Admin Username</label>
- <input
+ <Input
type="text"
value={installForm.adminUser}
onChange={(e) => setInstallForm({ ...installForm, adminUser: e.target.value })}
@@ -1444,7 +1420,7 @@ function Git() {
</div>
<div className="form-group">
<label>Admin Email <span className="required">*</span></label>
- <input
+ <Input
type="email"
value={installForm.adminEmail}
onChange={(e) => setInstallForm({ ...installForm, adminEmail: e.target.value })}
@@ -1453,7 +1429,7 @@ function Git() {
</div>
<div className="form-group">
<label>Admin Password (leave empty to auto-generate)</label>
- <input
+ <Input
type="password"
value={installForm.adminPassword}
onChange={(e) => setInstallForm({ ...installForm, adminPassword: e.target.value })}
@@ -1462,16 +1438,15 @@ function Git() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowInstallModal(false)}>
+ <Button variant="outline" onClick={() => setShowInstallModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleInstall}
disabled={actionLoading || !installForm.adminEmail}
>
{actionLoading ? 'Installing...' : 'Install Git Server'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1490,7 +1465,7 @@ function Git() {
<div className="modal-body">
<div className="form-group">
<label>Name <span className="required">*</span></label>
- <input
+ <Input
type="text"
value={webhookForm.name}
onChange={(e) => setWebhookForm({ ...webhookForm, name: e.target.value })}
@@ -1512,7 +1487,7 @@ function Git() {
<div className="form-group">
<label>Repository URL <span className="required">*</span></label>
- <input
+ <Input
type="text"
value={webhookForm.sourceRepoUrl}
onChange={(e) => setWebhookForm({ ...webhookForm, sourceRepoUrl: e.target.value })}
@@ -1523,7 +1498,7 @@ function Git() {
<div className="form-row">
<div className="form-group">
<label>Branch</label>
- <input
+ <Input
type="text"
value={webhookForm.sourceBranch}
onChange={(e) => setWebhookForm({ ...webhookForm, sourceBranch: e.target.value })}
@@ -1546,7 +1521,7 @@ function Git() {
<div className="form-group">
<label>Local Repository Name (optional)</label>
- <input
+ <Input
type="text"
value={webhookForm.localRepoName}
onChange={(e) => setWebhookForm({ ...webhookForm, localRepoName: e.target.value })}
@@ -1616,7 +1591,7 @@ function Git() {
<div className="form-group">
<label>Pre-deploy Script (optional)</label>
- <textarea
+ <Textarea
value={webhookForm.preDeployScript}
onChange={(e) => setWebhookForm({ ...webhookForm, preDeployScript: e.target.value })}
placeholder="#!/bin/bash&#10;npm install"
@@ -1627,7 +1602,7 @@ function Git() {
<div className="form-group">
<label>Post-deploy Script (optional)</label>
- <textarea
+ <Textarea
value={webhookForm.postDeployScript}
onChange={(e) => setWebhookForm({ ...webhookForm, postDeployScript: e.target.value })}
placeholder="#!/bin/bash&#10;npm run cache:clear"
@@ -1640,16 +1615,15 @@ function Git() {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowWebhookModal(false)}>
+ <Button variant="outline" onClick={() => setShowWebhookModal(false)}>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleCreateWebhook}
disabled={actionLoading || !webhookForm.name || !webhookForm.sourceRepoUrl}
>
{actionLoading ? 'Creating...' : 'Create Webhook'}
- </button>
+ </Button>
</div>
</div>
</div>
@@ -1676,24 +1650,25 @@ function Git() {
</div>
<div className="secret-display">
<code>{webhookSecret}</code>
- <button
- className="btn btn-sm btn-secondary"
+ <Button
+ size="sm"
+ variant="outline"
onClick={() => {
navigator.clipboard.writeText(webhookSecret);
toast.success('Secret copied to clipboard');
}}
>
Copy
- </button>
+ </Button>
</div>
<p className="text-muted">
Use this secret when configuring the webhook in your repository settings.
</p>
</div>
<div className="modal-footer">
- <button className="btn btn-primary" onClick={() => setWebhookSecret(null)}>
- I've Saved It
- </button>
+ <Button onClick={() => setWebhookSecret(null)}>
+ I&apos;ve Saved It
+ </Button>
</div>
</div>
</div>
@@ -1773,9 +1748,9 @@ function Git() {
)}
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowDeploymentLogs(false)}>
+ <Button variant="outline" onClick={() => setShowDeploymentLogs(false)}>
Close
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx
index 42e6d7f6..fbff0e56 100644
--- a/frontend/src/pages/Login.jsx
+++ b/frontend/src/pages/Login.jsx
@@ -4,6 +4,9 @@ import { useAuth } from '../contexts/AuthContext';
import api from '../services/api';
import SSOProviderIcon from '../components/SSOProviderIcon';
import ServerKitLogo from '../components/ServerKitLogo';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
const Login = () => {
const [email, setEmail] = useState('');
@@ -203,8 +206,8 @@ const Login = () => {
</div>
) : (
<div className="form-group">
- <label htmlFor="backupCode">Backup Code</label>
- <input
+ <Label htmlFor="backupCode">Backup Code</Label>
+ <Input
type="text"
id="backupCode"
value={backupCode}
@@ -215,26 +218,26 @@ const Login = () => {
</div>
)}
- <button type="submit" className="btn btn-primary btn-full" disabled={loading}>
+ <Button type="submit" className="btn-full" disabled={loading}>
{loading ? 'Verifying...' : 'Verify'}
- </button>
+ </Button>
</form>
<div className="auth-footer-links">
- <button
+ <Button
type="button"
- className="link-button"
+ variant="link"
onClick={() => setUseBackupCode(!useBackupCode)}
>
{useBackupCode ? 'Use authenticator app instead' : 'Use a backup code instead'}
- </button>
- <button
+ </Button>
+ <Button
type="button"
- className="link-button"
+ variant="link"
onClick={handleBack}
>
Back to login
- </button>
+ </Button>
</div>
</div>
</div>
@@ -280,8 +283,8 @@ const Login = () => {
{passwordLoginEnabled && (
<form onSubmit={handleSubmit}>
<div className="form-group">
- <label htmlFor="email">Username or Email</label>
- <input
+ <Label htmlFor="email">Username or Email</Label>
+ <Input
type="text"
id="email"
value={email}
@@ -293,8 +296,8 @@ const Login = () => {
</div>
<div className="form-group">
- <label htmlFor="password">Password</label>
- <input
+ <Label htmlFor="password">Password</Label>
+ <Input
type="password"
id="password"
value={password}
@@ -304,9 +307,9 @@ const Login = () => {
/>
</div>
- <button type="submit" className="btn btn-primary btn-full" disabled={loading}>
+ <Button type="submit" className="btn-full" disabled={loading}>
{loading ? 'Signing in...' : 'Sign In'}
- </button>
+ </Button>
</form>
)}
diff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsx
index 800869c2..3cc54f31 100644
--- a/frontend/src/pages/Marketplace.jsx
+++ b/frontend/src/pages/Marketplace.jsx
@@ -3,6 +3,11 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const Marketplace = () => {
const toast = useToast();
@@ -13,7 +18,6 @@ const Marketplace = () => {
const [loading, setLoading] = useState(true);
const [search, setSearch] = useState('');
const [category, setCategory] = useState('');
- const [tab, setTab] = useState('browse');
const [showSubmit, setShowSubmit] = useState(false);
const [pluginUrl, setPluginUrl] = useState('');
const [installing, setInstalling] = useState(false);
@@ -103,7 +107,13 @@ const Marketplace = () => {
const renderStars = (rating) => {
const full = Math.floor(rating);
- return '\u2605'.repeat(full) + '\u2606'.repeat(5 - full);
+ return '★'.repeat(full) + '☆'.repeat(5 - full);
+ };
+
+ const pluginStatusVariant = (status) => {
+ if (status === 'active') return 'success';
+ if (status === 'error') return 'destructive';
+ return 'outline';
};
if (loading) return <Spinner />;
@@ -118,20 +128,20 @@ const Marketplace = () => {
<p className="page-description">{extensions.length} extensions available</p>
</div>
<div className="page-header-actions">
- <button className="btn" onClick={() => setShowSubmit(true)}>Submit Extension</button>
+ <Button variant="outline" onClick={() => setShowSubmit(true)}>Submit Extension</Button>
</div>
</div>
- <div className="tabs">
- <button className={`tab ${tab === 'browse' ? 'active' : ''}`} onClick={() => setTab('browse')}>Browse</button>
- <button className={`tab ${tab === 'installed' ? 'active' : ''}`} onClick={() => setTab('installed')}>Installed ({myExtensions.length})</button>
- <button className={`tab ${tab === 'plugins' ? 'active' : ''}`} onClick={() => setTab('plugins')}>Plugins ({plugins.length})</button>
- </div>
+ <Tabs defaultValue="browse">
+ <TabsList>
+ <TabsTrigger value="browse">Browse</TabsTrigger>
+ <TabsTrigger value="installed">Installed ({myExtensions.length})</TabsTrigger>
+ <TabsTrigger value="plugins">Plugins ({plugins.length})</TabsTrigger>
+ </TabsList>
- {tab === 'browse' && (
- <>
+ <TabsContent value="browse">
<div className="marketplace-filters">
- <input className="form-input" placeholder="Search extensions..." value={search} onChange={e => setSearch(e.target.value)} />
+ <Input placeholder="Search extensions..." value={search} onChange={e => setSearch(e.target.value)} />
<select className="form-select" value={category} onChange={e => setCategory(e.target.value)}>
<option value="">All Categories</option>
{categories.map(c => <option key={c} value={c}>{c.charAt(0).toUpperCase() + c.slice(1)}</option>)}
@@ -143,7 +153,7 @@ const Marketplace = () => {
<div key={ext.id} className="extension-card card">
<div className="extension-card__header">
<h3>{ext.display_name}</h3>
- <span className="badge badge--outline">{ext.category}</span>
+ <Badge variant="outline">{ext.category}</Badge>
</div>
<p className="extension-card__desc">{ext.description}</p>
<div className="extension-card__meta">
@@ -153,107 +163,109 @@ const Marketplace = () => {
<div className="extension-card__info">
<span>v{ext.version}</span>
{ext.author && <span>by {ext.author}</span>}
- <span className="badge badge--subtle">{ext.extension_type}</span>
+ <Badge variant="secondary">{ext.extension_type}</Badge>
</div>
<div className="extension-card__actions">
{installedIds.has(ext.id) ? (
- <span className="badge badge--success">Installed</span>
+ <Badge variant="success">Installed</Badge>
) : (
- <button className="btn btn-sm btn-primary" onClick={() => handleInstall(ext.id)}>Install</button>
+ <Button size="sm" onClick={() => handleInstall(ext.id)}>Install</Button>
)}
</div>
</div>
))}
{extensions.length === 0 && <div className="empty-state"><p>No extensions found.</p></div>}
</div>
- </>
- )}
-
- {tab === 'installed' && (
- <div className="installed-list">
- {myExtensions.map(inst => (
- <div key={inst.id} className="installed-item card">
- <div className="installed-item__info">
- <strong>{inst.extension_name}</strong>
- <span className="text-muted">v{inst.installed_version}</span>
- </div>
- <button className="btn btn-sm btn-danger" onClick={() => handleUninstall(inst.id)}>Uninstall</button>
- </div>
- ))}
- {myExtensions.length === 0 && <div className="empty-state"><p>No extensions installed.</p></div>}
- </div>
- )}
-
- {tab === 'plugins' && (
- <div className="plugins-section">
- <div className="plugin-install-form card">
- <h3>Install Plugin from URL</h3>
- <p className="text-muted">Paste a GitHub repo URL, release URL, or direct zip link.</p>
- <div className="plugin-install-row">
- <input
- className="form-input"
- placeholder="https://github.com/user/serverkit-plugin"
- value={pluginUrl}
- onChange={e => setPluginUrl(e.target.value)}
- onKeyDown={e => e.key === 'Enter' && handlePluginInstall()}
- disabled={installing}
- />
- <button
- className="btn btn-primary"
- onClick={handlePluginInstall}
- disabled={installing || !pluginUrl.trim()}
- >
- {installing ? 'Installing...' : 'Install'}
- </button>
- </div>
- </div>
+ </TabsContent>
+ <TabsContent value="installed">
<div className="installed-list">
- {plugins.map(plugin => (
- <div key={plugin.id} className={`installed-item card ${plugin.status === 'error' ? 'installed-item--error' : ''}`}>
+ {myExtensions.map(inst => (
+ <div key={inst.id} className="installed-item card">
<div className="installed-item__info">
- <strong>{plugin.display_name}</strong>
- <span className="text-muted">v{plugin.version}</span>
- <span className={`badge badge--${plugin.status === 'active' ? 'success' : plugin.status === 'error' ? 'danger' : 'outline'}`}>
- {plugin.status}
- </span>
- {plugin.has_backend && <span className="badge badge--subtle">Backend</span>}
- {plugin.has_frontend && <span className="badge badge--subtle">Frontend</span>}
- </div>
- {plugin.description && <p className="text-muted" style={{ margin: '4px 0 8px', fontSize: '13px' }}>{plugin.description}</p>}
- {plugin.error_message && <p className="text-danger" style={{ margin: '4px 0 8px', fontSize: '12px' }}>{plugin.error_message}</p>}
- <div className="installed-item__actions">
- <button
- className={`btn btn-sm ${plugin.status === 'active' ? 'btn-outline' : 'btn-primary'}`}
- onClick={() => handlePluginToggle(plugin)}
- >
- {plugin.status === 'active' ? 'Disable' : 'Enable'}
- </button>
- <button className="btn btn-sm btn-danger" onClick={() => handlePluginUninstall(plugin.id)}>Uninstall</button>
+ <strong>{inst.extension_name}</strong>
+ <span className="text-muted">v{inst.installed_version}</span>
</div>
+ <Button size="sm" variant="destructive" onClick={() => handleUninstall(inst.id)}>Uninstall</Button>
</div>
))}
- {plugins.length === 0 && (
- <div className="empty-state">
- <p>No plugins installed. Use the form above to install one from a URL.</p>
+ {myExtensions.length === 0 && <div className="empty-state"><p>No extensions installed.</p></div>}
+ </div>
+ </TabsContent>
+
+ <TabsContent value="plugins">
+ <div className="plugins-section">
+ <div className="plugin-install-form card">
+ <h3>Install Plugin from URL</h3>
+ <p className="text-muted">Paste a GitHub repo URL, release URL, or direct zip link.</p>
+ <div className="plugin-install-row">
+ <Input
+ placeholder="https://github.com/user/serverkit-plugin"
+ value={pluginUrl}
+ onChange={e => setPluginUrl(e.target.value)}
+ onKeyDown={e => e.key === 'Enter' && handlePluginInstall()}
+ disabled={installing}
+ />
+ <Button
+ onClick={handlePluginInstall}
+ disabled={installing || !pluginUrl.trim()}
+ >
+ {installing ? 'Installing...' : 'Install'}
+ </Button>
</div>
- )}
+ </div>
+
+ <div className="installed-list">
+ {plugins.map(plugin => (
+ <div key={plugin.id} className={`installed-item card ${plugin.status === 'error' ? 'installed-item--error' : ''}`}>
+ <div className="installed-item__info">
+ <strong>{plugin.display_name}</strong>
+ <span className="text-muted">v{plugin.version}</span>
+ <Badge variant={pluginStatusVariant(plugin.status)}>
+ {plugin.status}
+ </Badge>
+ {plugin.has_backend && <Badge variant="secondary">Backend</Badge>}
+ {plugin.has_frontend && <Badge variant="secondary">Frontend</Badge>}
+ </div>
+ {plugin.description && <p className="text-muted" style={{ margin: '4px 0 8px', fontSize: '13px' }}>{plugin.description}</p>}
+ {plugin.error_message && <p className="text-danger" style={{ margin: '4px 0 8px', fontSize: '12px' }}>{plugin.error_message}</p>}
+ <div className="installed-item__actions">
+ <Button
+ size="sm"
+ variant={plugin.status === 'active' ? 'outline' : 'default'}
+ onClick={() => handlePluginToggle(plugin)}
+ >
+ {plugin.status === 'active' ? 'Disable' : 'Enable'}
+ </Button>
+ <Button size="sm" variant="destructive" onClick={() => handlePluginUninstall(plugin.id)}>Uninstall</Button>
+ </div>
+ </div>
+ ))}
+ {plugins.length === 0 && (
+ <div className="empty-state">
+ <p>No plugins installed. Use the form above to install one from a URL.</p>
+ </div>
+ )}
+ </div>
</div>
- </div>
- )}
+ </TabsContent>
+ </Tabs>
{showSubmit && (
<div className="modal-overlay" onClick={() => setShowSubmit(false)}>
<div className="modal" onClick={e => e.stopPropagation()}>
<div className="modal-header"><h2>Submit Extension</h2><button className="modal-close" onClick={() => setShowSubmit(false)}>&times;</button></div>
<div className="modal-body">
- <div className="form-group"><label>Name</label><input className="form-input" value={form.name} onChange={e => setForm({...form, name: e.target.value})} /></div>
- <div className="form-group"><label>Display Name</label><input className="form-input" value={form.display_name} onChange={e => setForm({...form, display_name: e.target.value})} /></div>
- <div className="form-group"><label>Description</label><textarea className="form-input" value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={3} /></div>
+ <div className="form-group"><label>Name</label><Input value={form.name} onChange={e => setForm({...form, name: e.target.value})} /></div>
+ <div className="form-group"><label>Display Name</label><Input value={form.display_name} onChange={e => setForm({...form, display_name: e.target.value})} /></div>
+ <div className="form-group"><label>Description</label><Textarea value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={3} /></div>
<div className="form-group"><label>Category</label><select className="form-select" value={form.category} onChange={e => setForm({...form, category: e.target.value})}>{categories.map(c => <option key={c} value={c}>{c}</option>)}</select></div>
- <div className="form-group"><label>Author</label><input className="form-input" value={form.author} onChange={e => setForm({...form, author: e.target.value})} /></div>
+ <div className="form-group"><label>Author</label><Input value={form.author} onChange={e => setForm({...form, author: e.target.value})} /></div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowSubmit(false)}>Cancel</Button>
+ <Button onClick={handleSubmit} disabled={!form.name}>Submit</Button>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowSubmit(false)}>Cancel</button><button className="btn btn-primary" onClick={handleSubmit} disabled={!form.name}>Submit</button></div>
</div>
</div>
)}
diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsx
index 48cb30a3..c08ffc21 100644
--- a/frontend/src/pages/Monitoring.jsx
+++ b/frontend/src/pages/Monitoring.jsx
@@ -2,6 +2,12 @@ import React, { useState, useEffect } from 'react';
import useTabParam from '../hooks/useTabParam';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Checkbox } from '@/components/ui/checkbox';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['overview', 'alerts', 'config', 'thresholds'];
@@ -123,12 +129,12 @@ const Monitoring = () => {
}
};
- const getAlertSeverityClass = (severity) => {
+ const getAlertSeverityVariant = (severity) => {
switch (severity) {
- case 'critical': return 'badge-danger';
- case 'warning': return 'badge-warning';
- case 'info': return 'badge-info';
- default: return 'badge-secondary';
+ case 'critical': return 'destructive';
+ case 'warning': return 'warning';
+ case 'info': return 'info';
+ default: return 'secondary';
}
};
@@ -148,8 +154,8 @@ const Monitoring = () => {
<p className="page-subtitle">System monitoring and alert configuration</p>
</div>
<div className="page-actions">
- <button
- className={`btn ${status?.monitoring_active ? 'btn-danger' : 'btn-primary'}`}
+ <Button
+ variant={status?.monitoring_active ? 'destructive' : 'default'}
onClick={handleToggleMonitoring}
>
{status?.monitoring_active ? (
@@ -168,7 +174,7 @@ const Monitoring = () => {
Start Monitoring
</>
)}
- </button>
+ </Button>
</div>
</div>
@@ -179,338 +185,319 @@ const Monitoring = () => {
</div>
)}
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'overview' ? 'active' : ''}`}
- onClick={() => setActiveTab('overview')}
- >
- Overview
- </button>
- <button
- className={`tab ${activeTab === 'alerts' ? 'active' : ''}`}
- onClick={() => setActiveTab('alerts')}
- >
- Alert History
- </button>
- <button
- className={`tab ${activeTab === 'config' ? 'active' : ''}`}
- onClick={() => setActiveTab('config')}
- >
- Configuration
- </button>
- <button
- className={`tab ${activeTab === 'thresholds' ? 'active' : ''}`}
- onClick={() => setActiveTab('thresholds')}
- >
- Thresholds
- </button>
- </div>
-
- {activeTab === 'overview' && (
- <div className="monitoring-overview">
- <div className="stats-grid">
- <div className="stat-card">
- <div className="stat-icon status">
- <svg viewBox="0 0 24 24" width="24" height="24">
- <circle cx="12" cy="12" r="10"/>
- </svg>
- </div>
- <div className="stat-content">
- <span className="stat-label">Monitoring Status</span>
- <span className={`stat-value ${status?.monitoring_active ? 'text-success' : 'text-muted'}`}>
- {status?.monitoring_active ? 'Active' : 'Inactive'}
- </span>
- </div>
- </div>
-
- <div className="stat-card">
- <div className="stat-icon alerts">
- <svg viewBox="0 0 24 24" width="24" height="24">
- <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>
- <path d="M13.73 21a2 2 0 0 1-3.46 0"/>
- </svg>
- </div>
- <div className="stat-content">
- <span className="stat-label">Recent Alerts</span>
- <span className="stat-value">{alertHistory.length}</span>
- </div>
- </div>
-
- <div className="stat-card">
- <div className="stat-icon interval">
- <svg viewBox="0 0 24 24" width="24" height="24">
- <circle cx="12" cy="12" r="10"/>
- <polyline points="12 6 12 12 16 14"/>
- </svg>
- </div>
- <div className="stat-content">
- <span className="stat-label">Check Interval</span>
- <span className="stat-value">{config?.check_interval || 60}s</span>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="alerts">Alert History</TabsTrigger>
+ <TabsTrigger value="config">Configuration</TabsTrigger>
+ <TabsTrigger value="thresholds">Thresholds</TabsTrigger>
+ </TabsList>
+
+ <TabsContent value="overview">
+ <div className="monitoring-overview">
+ <div className="stats-grid">
+ <div className="stat-card">
+ <div className="stat-icon status">
+ <svg viewBox="0 0 24 24" width="24" height="24">
+ <circle cx="12" cy="12" r="10"/>
+ </svg>
+ </div>
+ <div className="stat-content">
+ <span className="stat-label">Monitoring Status</span>
+ <span className={`stat-value ${status?.monitoring_active ? 'text-success' : 'text-muted'}`}>
+ {status?.monitoring_active ? 'Active' : 'Inactive'}
+ </span>
+ </div>
</div>
- </div>
- <div className="stat-card">
- <div className="stat-icon notifications">
- <svg viewBox="0 0 24 24" width="24" height="24">
- <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
- <polyline points="22,6 12,13 2,6"/>
- </svg>
- </div>
- <div className="stat-content">
- <span className="stat-label">Notifications</span>
- <span className="stat-value">
- {config?.alert_email ? 'Email' : ''}
- {config?.alert_email && config?.alert_webhook ? ' + ' : ''}
- {config?.alert_webhook ? 'Webhook' : ''}
- {!config?.alert_email && !config?.alert_webhook ? 'None' : ''}
- </span>
+ <div className="stat-card">
+ <div className="stat-icon alerts">
+ <svg viewBox="0 0 24 24" width="24" height="24">
+ <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>
+ <path d="M13.73 21a2 2 0 0 1-3.46 0"/>
+ </svg>
+ </div>
+ <div className="stat-content">
+ <span className="stat-label">Recent Alerts</span>
+ <span className="stat-value">{alertHistory.length}</span>
+ </div>
</div>
- </div>
- </div>
- <div className="card">
- <div className="card-header">
- <h3>Current Thresholds</h3>
- </div>
- <div className="card-body">
- <div className="threshold-grid">
- <div className="threshold-item">
- <span className="threshold-label">CPU Usage</span>
- <span className="threshold-value">{thresholds?.cpu_percent || 90}%</span>
+ <div className="stat-card">
+ <div className="stat-icon interval">
+ <svg viewBox="0 0 24 24" width="24" height="24">
+ <circle cx="12" cy="12" r="10"/>
+ <polyline points="12 6 12 12 16 14"/>
+ </svg>
</div>
- <div className="threshold-item">
- <span className="threshold-label">Memory Usage</span>
- <span className="threshold-value">{thresholds?.memory_percent || 90}%</span>
+ <div className="stat-content">
+ <span className="stat-label">Check Interval</span>
+ <span className="stat-value">{config?.check_interval || 60}s</span>
</div>
- <div className="threshold-item">
- <span className="threshold-label">Disk Usage</span>
- <span className="threshold-value">{thresholds?.disk_percent || 90}%</span>
+ </div>
+
+ <div className="stat-card">
+ <div className="stat-icon notifications">
+ <svg viewBox="0 0 24 24" width="24" height="24">
+ <path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/>
+ <polyline points="22,6 12,13 2,6"/>
+ </svg>
</div>
- <div className="threshold-item">
- <span className="threshold-label">Load Average</span>
- <span className="threshold-value">{thresholds?.load_average || 5.0}</span>
+ <div className="stat-content">
+ <span className="stat-label">Notifications</span>
+ <span className="stat-value">
+ {config?.alert_email ? 'Email' : ''}
+ {config?.alert_email && config?.alert_webhook ? ' + ' : ''}
+ {config?.alert_webhook ? 'Webhook' : ''}
+ {!config?.alert_email && !config?.alert_webhook ? 'None' : ''}
+ </span>
</div>
</div>
</div>
- </div>
- {alertHistory.length > 0 && (
<div className="card">
<div className="card-header">
- <h3>Recent Alerts</h3>
+ <h3>Current Thresholds</h3>
</div>
<div className="card-body">
- <div className="alert-list">
- {alertHistory.slice(0, 5).map((alert, index) => (
- <div key={index} className="alert-item">
- <span className={`badge ${getAlertSeverityClass(alert.severity)}`}>
- {alert.severity}
- </span>
- <span className="alert-message">{alert.message}</span>
- <span className="alert-time">{formatTimestamp(alert.timestamp)}</span>
- </div>
- ))}
+ <div className="threshold-grid">
+ <div className="threshold-item">
+ <span className="threshold-label">CPU Usage</span>
+ <span className="threshold-value">{thresholds?.cpu_percent || 90}%</span>
+ </div>
+ <div className="threshold-item">
+ <span className="threshold-label">Memory Usage</span>
+ <span className="threshold-value">{thresholds?.memory_percent || 90}%</span>
+ </div>
+ <div className="threshold-item">
+ <span className="threshold-label">Disk Usage</span>
+ <span className="threshold-value">{thresholds?.disk_percent || 90}%</span>
+ </div>
+ <div className="threshold-item">
+ <span className="threshold-label">Load Average</span>
+ <span className="threshold-value">{thresholds?.load_average || 5.0}</span>
+ </div>
</div>
</div>
</div>
- )}
- </div>
- )}
- {activeTab === 'alerts' && (
- <div className="card">
- <div className="card-header">
- <h3>Alert History</h3>
- <button className="btn btn-secondary btn-sm" onClick={loadData}>
- Refresh
- </button>
- </div>
- <div className="card-body">
- {alertHistory.length === 0 ? (
- <div className="empty-state">
- <svg viewBox="0 0 24 24" width="48" height="48">
- <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>
- <path d="M13.73 21a2 2 0 0 1-3.46 0"/>
- </svg>
- <h3>No Alerts</h3>
- <p>No alerts have been triggered yet.</p>
- </div>
- ) : (
- <table className="table">
- <thead>
- <tr>
- <th>Severity</th>
- <th>Type</th>
- <th>Message</th>
- <th>Value</th>
- <th>Threshold</th>
- <th>Time</th>
- </tr>
- </thead>
- <tbody>
- {alertHistory.map((alert, index) => (
- <tr key={index}>
- <td>
- <span className={`badge ${getAlertSeverityClass(alert.severity)}`}>
+ {alertHistory.length > 0 && (
+ <div className="card">
+ <div className="card-header">
+ <h3>Recent Alerts</h3>
+ </div>
+ <div className="card-body">
+ <div className="alert-list">
+ {alertHistory.slice(0, 5).map((alert, index) => (
+ <div key={index} className="alert-item">
+ <Badge variant={getAlertSeverityVariant(alert.severity)}>
{alert.severity}
- </span>
- </td>
- <td>{alert.type}</td>
- <td>{alert.message}</td>
- <td>{alert.value?.toFixed(1)}</td>
- <td>{alert.threshold}</td>
- <td>{formatTimestamp(alert.timestamp)}</td>
- </tr>
- ))}
- </tbody>
- </table>
- )}
- </div>
- </div>
- )}
-
- {activeTab === 'config' && (
- <div className="card">
- <div className="card-header">
- <h3>Monitoring Configuration</h3>
- </div>
- <div className="card-body">
- <form onSubmit={handleSaveConfig}>
- <div className="form-group">
- <label className="checkbox-label">
- <input
- type="checkbox"
- checked={configForm.enabled}
- onChange={(e) => setConfigForm({...configForm, enabled: e.target.checked})}
- />
- <span>Enable Monitoring</span>
- </label>
- </div>
-
- <div className="form-group">
- <label>Check Interval (seconds)</label>
- <input
- type="number"
- value={configForm.check_interval}
- onChange={(e) => setConfigForm({...configForm, check_interval: parseInt(e.target.value)})}
- min="10"
- max="3600"
- />
- </div>
-
- <div className="form-group">
- <label>Alert Email</label>
- <div className="input-group">
- <input
- type="email"
- value={configForm.alert_email}
- onChange={(e) => setConfigForm({...configForm, alert_email: e.target.value})}
- placeholder="[email protected]"
- />
- <button
- type="button"
- className="btn btn-secondary"
- onClick={handleTestEmail}
- disabled={!configForm.alert_email}
- >
- Test
- </button>
+ </Badge>
+ <span className="alert-message">{alert.message}</span>
+ <span className="alert-time">{formatTimestamp(alert.timestamp)}</span>
+ </div>
+ ))}
+ </div>
</div>
</div>
+ )}
+ </div>
+ </TabsContent>
- <div className="form-group">
- <label>Webhook URL</label>
- <div className="input-group">
- <input
- type="url"
- value={configForm.alert_webhook}
- onChange={(e) => setConfigForm({...configForm, alert_webhook: e.target.value})}
- placeholder="https://hooks.slack.com/..."
- />
- <button
- type="button"
- className="btn btn-secondary"
- onClick={handleTestWebhook}
- disabled={!configForm.alert_webhook}
- >
- Test
- </button>
+ <TabsContent value="alerts">
+ <div className="card">
+ <div className="card-header">
+ <h3>Alert History</h3>
+ <Button variant="outline" size="sm" onClick={loadData}>
+ Refresh
+ </Button>
+ </div>
+ <div className="card-body">
+ {alertHistory.length === 0 ? (
+ <div className="empty-state">
+ <svg viewBox="0 0 24 24" width="48" height="48">
+ <path d="M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"/>
+ <path d="M13.73 21a2 2 0 0 1-3.46 0"/>
+ </svg>
+ <h3>No Alerts</h3>
+ <p>No alerts have been triggered yet.</p>
</div>
- </div>
-
- <div className="form-actions">
- <button type="submit" className="btn btn-primary">Save Configuration</button>
- </div>
- </form>
+ ) : (
+ <table className="table">
+ <thead>
+ <tr>
+ <th>Severity</th>
+ <th>Type</th>
+ <th>Message</th>
+ <th>Value</th>
+ <th>Threshold</th>
+ <th>Time</th>
+ </tr>
+ </thead>
+ <tbody>
+ {alertHistory.map((alert, index) => (
+ <tr key={index}>
+ <td>
+ <Badge variant={getAlertSeverityVariant(alert.severity)}>
+ {alert.severity}
+ </Badge>
+ </td>
+ <td>{alert.type}</td>
+ <td>{alert.message}</td>
+ <td>{alert.value?.toFixed(1)}</td>
+ <td>{alert.threshold}</td>
+ <td>{formatTimestamp(alert.timestamp)}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ )}
+ </div>
</div>
- </div>
- )}
+ </TabsContent>
- {activeTab === 'thresholds' && (
- <div className="card">
- <div className="card-header">
- <h3>Alert Thresholds</h3>
- </div>
- <div className="card-body">
- <form onSubmit={handleSaveThresholds}>
- <div className="threshold-form-grid">
+ <TabsContent value="config">
+ <div className="card">
+ <div className="card-header">
+ <h3>Monitoring Configuration</h3>
+ </div>
+ <div className="card-body">
+ <form onSubmit={handleSaveConfig}>
<div className="form-group">
- <label>CPU Usage (%)</label>
- <input
- type="number"
- value={thresholdForm.cpu_percent}
- onChange={(e) => setThresholdForm({...thresholdForm, cpu_percent: parseInt(e.target.value)})}
- min="1"
- max="100"
- />
- <span className="form-help">Alert when CPU exceeds this percentage</span>
+ <label className="checkbox-label">
+ <Checkbox
+ checked={configForm.enabled}
+ onCheckedChange={(checked) => setConfigForm({...configForm, enabled: checked})}
+ />
+ <span>Enable Monitoring</span>
+ </label>
</div>
<div className="form-group">
- <label>Memory Usage (%)</label>
- <input
+ <Label>Check Interval (seconds)</Label>
+ <Input
type="number"
- value={thresholdForm.memory_percent}
- onChange={(e) => setThresholdForm({...thresholdForm, memory_percent: parseInt(e.target.value)})}
- min="1"
- max="100"
+ value={configForm.check_interval}
+ onChange={(e) => setConfigForm({...configForm, check_interval: parseInt(e.target.value)})}
+ min="10"
+ max="3600"
/>
- <span className="form-help">Alert when memory exceeds this percentage</span>
</div>
<div className="form-group">
- <label>Disk Usage (%)</label>
- <input
- type="number"
- value={thresholdForm.disk_percent}
- onChange={(e) => setThresholdForm({...thresholdForm, disk_percent: parseInt(e.target.value)})}
- min="1"
- max="100"
- />
- <span className="form-help">Alert when disk exceeds this percentage</span>
+ <Label>Alert Email</Label>
+ <div className="input-group">
+ <Input
+ type="email"
+ value={configForm.alert_email}
+ onChange={(e) => setConfigForm({...configForm, alert_email: e.target.value})}
+ placeholder="[email protected]"
+ />
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleTestEmail}
+ disabled={!configForm.alert_email}
+ >
+ Test
+ </Button>
+ </div>
</div>
<div className="form-group">
- <label>Load Average</label>
- <input
- type="number"
- step="0.1"
- value={thresholdForm.load_average}
- onChange={(e) => setThresholdForm({...thresholdForm, load_average: parseFloat(e.target.value)})}
- min="0.1"
- max="100"
- />
- <span className="form-help">Alert when load average exceeds this value</span>
+ <Label>Webhook URL</Label>
+ <div className="input-group">
+ <Input
+ type="url"
+ value={configForm.alert_webhook}
+ onChange={(e) => setConfigForm({...configForm, alert_webhook: e.target.value})}
+ placeholder="https://hooks.slack.com/..."
+ />
+ <Button
+ type="button"
+ variant="outline"
+ onClick={handleTestWebhook}
+ disabled={!configForm.alert_webhook}
+ >
+ Test
+ </Button>
+ </div>
</div>
- </div>
- <div className="form-actions">
- <button type="submit" className="btn btn-primary">Save Thresholds</button>
- </div>
- </form>
+ <div className="form-actions">
+ <Button type="submit">Save Configuration</Button>
+ </div>
+ </form>
+ </div>
</div>
- </div>
- )}
+ </TabsContent>
+
+ <TabsContent value="thresholds">
+ <div className="card">
+ <div className="card-header">
+ <h3>Alert Thresholds</h3>
+ </div>
+ <div className="card-body">
+ <form onSubmit={handleSaveThresholds}>
+ <div className="threshold-form-grid">
+ <div className="form-group">
+ <Label>CPU Usage (%)</Label>
+ <Input
+ type="number"
+ value={thresholdForm.cpu_percent}
+ onChange={(e) => setThresholdForm({...thresholdForm, cpu_percent: parseInt(e.target.value)})}
+ min="1"
+ max="100"
+ />
+ <span className="form-help">Alert when CPU exceeds this percentage</span>
+ </div>
+
+ <div className="form-group">
+ <Label>Memory Usage (%)</Label>
+ <Input
+ type="number"
+ value={thresholdForm.memory_percent}
+ onChange={(e) => setThresholdForm({...thresholdForm, memory_percent: parseInt(e.target.value)})}
+ min="1"
+ max="100"
+ />
+ <span className="form-help">Alert when memory exceeds this percentage</span>
+ </div>
+
+ <div className="form-group">
+ <Label>Disk Usage (%)</Label>
+ <Input
+ type="number"
+ value={thresholdForm.disk_percent}
+ onChange={(e) => setThresholdForm({...thresholdForm, disk_percent: parseInt(e.target.value)})}
+ min="1"
+ max="100"
+ />
+ <span className="form-help">Alert when disk exceeds this percentage</span>
+ </div>
+
+ <div className="form-group">
+ <Label>Load Average</Label>
+ <Input
+ type="number"
+ step="0.1"
+ value={thresholdForm.load_average}
+ onChange={(e) => setThresholdForm({...thresholdForm, load_average: parseFloat(e.target.value)})}
+ min="0.1"
+ max="100"
+ />
+ <span className="form-help">Alert when load average exceeds this value</span>
+ </div>
+ </div>
+
+ <div className="form-actions">
+ <Button type="submit">Save Thresholds</Button>
+ </div>
+ </form>
+ </div>
+ </div>
+ </TabsContent>
+ </Tabs>
</div>
);
};
diff --git a/frontend/src/pages/Register.jsx b/frontend/src/pages/Register.jsx
index 92414257..cbd440e3 100644
--- a/frontend/src/pages/Register.jsx
+++ b/frontend/src/pages/Register.jsx
@@ -3,6 +3,9 @@ import { useNavigate, Link, useSearchParams } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
import api from '../services/api';
import ServerKitLogo from '../components/ServerKitLogo';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
const Register = () => {
const [email, setEmail] = useState('');
@@ -130,8 +133,8 @@ const Register = () => {
<form onSubmit={handleSubmit}>
<div className="form-group">
- <label htmlFor="email">Email</label>
- <input
+ <Label htmlFor="email">Email</Label>
+ <Input
type="email"
id="email"
value={email}
@@ -143,8 +146,8 @@ const Register = () => {
</div>
<div className="form-group">
- <label htmlFor="username">Username</label>
- <input
+ <Label htmlFor="username">Username</Label>
+ <Input
type="text"
id="username"
value={username}
@@ -155,8 +158,8 @@ const Register = () => {
</div>
<div className="form-group">
- <label htmlFor="password">Password</label>
- <input
+ <Label htmlFor="password">Password</Label>
+ <Input
type="password"
id="password"
value={password}
@@ -167,8 +170,8 @@ const Register = () => {
</div>
<div className="form-group">
- <label htmlFor="confirmPassword">Confirm Password</label>
- <input
+ <Label htmlFor="confirmPassword">Confirm Password</Label>
+ <Input
type="password"
id="confirmPassword"
value={confirmPassword}
@@ -178,9 +181,9 @@ const Register = () => {
/>
</div>
- <button type="submit" className="btn btn-primary btn-full" disabled={loading}>
+ <Button type="submit" className="btn-full" disabled={loading}>
{loading ? 'Creating account...' : 'Create Account'}
- </button>
+ </Button>
</form>
<p className="auth-footer">
diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsx
index ceb9e04a..cd94bdd2 100644
--- a/frontend/src/pages/SSLCertificates.jsx
+++ b/frontend/src/pages/SSLCertificates.jsx
@@ -8,6 +8,12 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
+import { Checkbox } from '@/components/ui/checkbox';
+import { Skeleton } from '@/components/ui/skeleton';
const SSLCertificates = () => {
const toast = useToast();
@@ -170,10 +176,10 @@ const SSLCertificates = () => {
<div className="ssl-status-bar">
{[1, 2, 3].map(i => (
<div key={i} className="ssl-status-item">
- <div className="skeleton-box" style={{ width: 48, height: 48, borderRadius: 12 }} />
+ <Skeleton className="w-12 h-12 rounded-xl" />
<div>
- <div className="skeleton-box" style={{ width: 80, height: 14, marginBottom: 6 }} />
- <div className="skeleton-box" style={{ width: 50, height: 12 }} />
+ <Skeleton className="w-20 h-3.5 mb-1.5" />
+ <Skeleton className="w-12 h-3" />
</div>
</div>
))}
@@ -181,10 +187,10 @@ const SSLCertificates = () => {
<div className="ssl-cert-list">
{[1, 2].map(i => (
<div key={i} className="ssl-cert-item">
- <div className="skeleton-box" style={{ width: 40, height: 40, borderRadius: 10 }} />
+ <Skeleton className="w-10 h-10 rounded-xl" />
<div className="flex-1">
- <div className="skeleton-box" style={{ width: 200, height: 14, marginBottom: 8 }} />
- <div className="skeleton-box" style={{ width: 300, height: 12 }} />
+ <Skeleton className="w-48 h-3.5 mb-2" />
+ <Skeleton className="w-72 h-3" />
</div>
</div>
))}
@@ -205,37 +211,36 @@ const SSLCertificates = () => {
<p className="subtitle">Manage Let's Encrypt SSL certificates</p>
</div>
<div className="top-bar-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleSetupAutoRenewal}
disabled={actionLoading || !certbotInstalled}
title="Configure automatic renewal via systemd or cron"
>
<Settings size={16} />
Auto-Renew
- </button>
+ </Button>
{certificates.length > 0 && (
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleRenewAll}
disabled={actionLoading}
>
<RefreshCw size={16} />
Renew All
- </button>
+ </Button>
)}
- <button className="btn btn-secondary" onClick={loadData}>
+ <Button variant="outline" onClick={loadData}>
<RefreshCw size={16} />
Refresh
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={() => setShowObtainModal(true)}
disabled={!certbotInstalled}
>
<Plus size={16} />
New Certificate
- </button>
+ </Button>
</div>
</header>
@@ -250,14 +255,15 @@ const SSLCertificates = () => {
<span>{certbotInstalled ? 'Installed' : 'Not Installed'}</span>
</div>
{!certbotInstalled && (
- <button
- className="btn btn-primary btn-sm ml-auto"
+ <Button
+ size="sm"
onClick={handleInstallCertbot}
disabled={actionLoading}
+ className="ml-auto"
>
<Download size={14} />
Install
- </button>
+ </Button>
)}
</div>
<div className="ssl-status-item">
@@ -292,15 +298,15 @@ const SSLCertificates = () => {
<h3>No SSL certificates</h3>
<p>Obtain your first Let's Encrypt certificate to secure your domains.</p>
{certbotInstalled ? (
- <button className="btn btn-primary" onClick={() => setShowObtainModal(true)}>
+ <Button onClick={() => setShowObtainModal(true)}>
<Plus size={16} />
New Certificate
- </button>
+ </Button>
) : (
- <button className="btn btn-primary" onClick={handleInstallCertbot} disabled={actionLoading}>
+ <Button onClick={handleInstallCertbot} disabled={actionLoading}>
<Download size={16} />
Install Certbot First
- </button>
+ </Button>
)}
</div>
) : (
@@ -329,34 +335,36 @@ const SSLCertificates = () => {
</div>
<div className="ssl-cert-item-status">
{cert.expiry_valid ? (
- <span className="status-badge status-active">
+ <Badge variant="success">
<CheckCircle size={14} />
Valid
- </span>
+ </Badge>
) : (
- <span className="status-badge status-warning">
+ <Badge variant="warning">
<AlertTriangle size={14} />
Expiring
- </span>
+ </Badge>
)}
</div>
<div className="ssl-cert-item-actions">
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleRenewCertificate(cert.name)}
disabled={renewingDomain === cert.name || actionLoading}
>
<RefreshCw size={14} className={renewingDomain === cert.name ? 'spin' : ''} />
{renewingDomain === cert.name ? 'Renewing...' : 'Renew'}
- </button>
- <button
- className="btn btn-secondary btn-sm"
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleRevokeCertificate(cert.name)}
disabled={actionLoading}
>
<Trash2 size={14} />
Revoke
- </button>
+ </Button>
</div>
</div>
))}
@@ -371,14 +379,14 @@ const SSLCertificates = () => {
<strong>Certificates expiring soon:</strong>{' '}
{expiringSoon.join(', ')}
</div>
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ size="sm"
onClick={handleRenewAll}
disabled={actionLoading}
>
<RefreshCw size={14} />
Renew All
- </button>
+ </Button>
</div>
)}
@@ -399,8 +407,8 @@ const SSLCertificates = () => {
</div>
</div>
<div className="form-group">
- <label>Domains</label>
- <input
+ <Label>Domains</Label>
+ <Input
type="text"
placeholder="example.com, www.example.com"
value={domains}
@@ -410,8 +418,8 @@ const SSLCertificates = () => {
<p className="hint">Comma-separated list of domains</p>
</div>
<div className="form-group">
- <label>Email Address</label>
- <input
+ <Label>Email Address</Label>
+ <Input
type="email"
placeholder="[email protected]"
value={email}
@@ -422,18 +430,17 @@ const SSLCertificates = () => {
</div>
<div className="form-group">
<label className="checkbox-label">
- <input
- type="checkbox"
+ <Checkbox
checked={useNginx}
- onChange={e => setUseNginx(e.target.checked)}
+ onCheckedChange={setUseNginx}
/>
Use Nginx plugin (recommended)
</label>
</div>
{!useNginx && (
<div className="form-group">
- <label>Webroot Path</label>
- <input
+ <Label>Webroot Path</Label>
+ <Input
type="text"
placeholder="/var/www/html"
value={webrootPath}
@@ -444,20 +451,19 @@ const SSLCertificates = () => {
</div>
)}
<div className="modal-actions">
- <button
+ <Button
type="button"
- className="btn btn-secondary"
+ variant="outline"
onClick={() => setShowObtainModal(false)}
>
Cancel
- </button>
- <button
+ </Button>
+ <Button
type="submit"
- className="btn btn-primary"
disabled={actionLoading}
>
{actionLoading ? 'Obtaining...' : 'Obtain Certificate'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/SSOCallback.jsx b/frontend/src/pages/SSOCallback.jsx
index 936592fa..01d7822c 100644
--- a/frontend/src/pages/SSOCallback.jsx
+++ b/frontend/src/pages/SSOCallback.jsx
@@ -3,6 +3,7 @@ import { useParams, useNavigate, useSearchParams, Link } from 'react-router-dom'
import { useAuth } from '../contexts/AuthContext';
import api from '../services/api';
import { Loader } from 'lucide-react';
+import { Button } from '@/components/ui/button';
const SSOCallback = () => {
const { provider } = useParams();
@@ -54,9 +55,9 @@ const SSOCallback = () => {
<h1>Authentication Failed</h1>
<p className="error-message">{error}</p>
</div>
- <Link to="/login" className="btn btn-primary btn-full">
- Back to Login
- </Link>
+ <Button asChild className="btn-full">
+ <Link to="/login">Back to Login</Link>
+ </Button>
</div>
</div>
);
diff --git a/frontend/src/pages/Security.jsx b/frontend/src/pages/Security.jsx
index ee7c586c..9bc9aa86 100644
--- a/frontend/src/pages/Security.jsx
+++ b/frontend/src/pages/Security.jsx
@@ -17,6 +17,7 @@ import {
EventsTab,
SecurityConfigTab,
} from '../components/security';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['overview', 'firewall', 'fail2ban', 'ssh-keys', 'ip-lists', 'scanner', 'quarantine', 'integrity', 'audit', 'vulnerability', 'updates', 'events', 'settings'];
@@ -54,63 +55,39 @@ const Security = () => {
</div>
</div>
- <div className="tabs-nav tabs-nav-scrollable">
- <button className={`tab-btn ${activeTab === 'overview' ? 'active' : ''}`} onClick={() => setActiveTab('overview')}>
- Overview
- </button>
- <button className={`tab-btn ${activeTab === 'firewall' ? 'active' : ''}`} onClick={() => setActiveTab('firewall')}>
- Firewall
- </button>
- <button className={`tab-btn ${activeTab === 'fail2ban' ? 'active' : ''}`} onClick={() => setActiveTab('fail2ban')}>
- Fail2ban
- </button>
- <button className={`tab-btn ${activeTab === 'ssh-keys' ? 'active' : ''}`} onClick={() => setActiveTab('ssh-keys')}>
- SSH Keys
- </button>
- <button className={`tab-btn ${activeTab === 'ip-lists' ? 'active' : ''}`} onClick={() => setActiveTab('ip-lists')}>
- IP Lists
- </button>
- <button className={`tab-btn ${activeTab === 'scanner' ? 'active' : ''}`} onClick={() => setActiveTab('scanner')}>
- Malware Scanner
- </button>
- <button className={`tab-btn ${activeTab === 'quarantine' ? 'active' : ''}`} onClick={() => setActiveTab('quarantine')}>
- Quarantine
- </button>
- <button className={`tab-btn ${activeTab === 'integrity' ? 'active' : ''}`} onClick={() => setActiveTab('integrity')}>
- File Integrity
- </button>
- <button className={`tab-btn ${activeTab === 'audit' ? 'active' : ''}`} onClick={() => setActiveTab('audit')}>
- Audit
- </button>
- <button className={`tab-btn ${activeTab === 'vulnerability' ? 'active' : ''}`} onClick={() => setActiveTab('vulnerability')}>
- Vulnerability Scan
- </button>
- <button className={`tab-btn ${activeTab === 'updates' ? 'active' : ''}`} onClick={() => setActiveTab('updates')}>
- Auto Updates
- </button>
- <button className={`tab-btn ${activeTab === 'events' ? 'active' : ''}`} onClick={() => setActiveTab('events')}>
- Events
- </button>
- <button className={`tab-btn ${activeTab === 'settings' ? 'active' : ''}`} onClick={() => setActiveTab('settings')}>
- Settings
- </button>
- </div>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList className="tabs-nav tabs-nav-scrollable">
+ <TabsTrigger value="overview">Overview</TabsTrigger>
+ <TabsTrigger value="firewall">Firewall</TabsTrigger>
+ <TabsTrigger value="fail2ban">Fail2ban</TabsTrigger>
+ <TabsTrigger value="ssh-keys">SSH Keys</TabsTrigger>
+ <TabsTrigger value="ip-lists">IP Lists</TabsTrigger>
+ <TabsTrigger value="scanner">Malware Scanner</TabsTrigger>
+ <TabsTrigger value="quarantine">Quarantine</TabsTrigger>
+ <TabsTrigger value="integrity">File Integrity</TabsTrigger>
+ <TabsTrigger value="audit">Audit</TabsTrigger>
+ <TabsTrigger value="vulnerability">Vulnerability Scan</TabsTrigger>
+ <TabsTrigger value="updates">Auto Updates</TabsTrigger>
+ <TabsTrigger value="events">Events</TabsTrigger>
+ <TabsTrigger value="settings">Settings</TabsTrigger>
+ </TabsList>
- <div className="tab-content">
- {activeTab === 'overview' && <OverviewTab status={status} onRefresh={loadStatus} />}
- {activeTab === 'firewall' && <FirewallTab />}
- {activeTab === 'fail2ban' && <Fail2banTab />}
- {activeTab === 'ssh-keys' && <SSHKeysTab />}
- {activeTab === 'ip-lists' && <IPListsTab />}
- {activeTab === 'scanner' && <ScannerTab />}
- {activeTab === 'quarantine' && <QuarantineTab />}
- {activeTab === 'integrity' && <IntegrityTab />}
- {activeTab === 'audit' && <AuditTab />}
- {activeTab === 'vulnerability' && <VulnerabilityTab />}
- {activeTab === 'updates' && <AutoUpdatesTab />}
- {activeTab === 'events' && <EventsTab />}
- {activeTab === 'settings' && <SecurityConfigTab />}
- </div>
+ <div className="tab-content">
+ <TabsContent value="overview"><OverviewTab status={status} onRefresh={loadStatus} /></TabsContent>
+ <TabsContent value="firewall"><FirewallTab /></TabsContent>
+ <TabsContent value="fail2ban"><Fail2banTab /></TabsContent>
+ <TabsContent value="ssh-keys"><SSHKeysTab /></TabsContent>
+ <TabsContent value="ip-lists"><IPListsTab /></TabsContent>
+ <TabsContent value="scanner"><ScannerTab /></TabsContent>
+ <TabsContent value="quarantine"><QuarantineTab /></TabsContent>
+ <TabsContent value="integrity"><IntegrityTab /></TabsContent>
+ <TabsContent value="audit"><AuditTab /></TabsContent>
+ <TabsContent value="vulnerability"><VulnerabilityTab /></TabsContent>
+ <TabsContent value="updates"><AutoUpdatesTab /></TabsContent>
+ <TabsContent value="events"><EventsTab /></TabsContent>
+ <TabsContent value="settings"><SecurityConfigTab /></TabsContent>
+ </div>
+ </Tabs>
</div>
);
};
diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsx
index bbb875e0..c64d0500 100644
--- a/frontend/src/pages/ServerDetail.jsx
+++ b/frontend/src/pages/ServerDetail.jsx
@@ -5,6 +5,10 @@ import { useToast } from '../contexts/ToastContext';
import MetricsGraph from '../components/MetricsGraph';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
const ServerDetail = () => {
const { id, tab } = useParams();
@@ -137,7 +141,7 @@ const ServerDetail = () => {
<div className="error-page">
<h2>Error Loading Server</h2>
<p>{error}</p>
- <Link to="/servers" className="btn btn-primary">Back to Servers</Link>
+ <Button asChild><Link to="/servers">Back to Servers</Link></Button>
</div>
);
}
@@ -147,7 +151,7 @@ const ServerDetail = () => {
<div className="error-page">
<h2>Server Not Found</h2>
<p>The requested server could not be found.</p>
- <Link to="/servers" className="btn btn-primary">Back to Servers</Link>
+ <Button asChild><Link to="/servers">Back to Servers</Link></Button>
</div>
);
}
@@ -199,15 +203,15 @@ const ServerDetail = () => {
</div>
</div>
<div className="server-detail-header__actions">
- <button className="btn btn-secondary" onClick={handlePingServer}>
+ <Button variant="outline" onClick={handlePingServer}>
<RefreshIcon /> Ping
- </button>
- <Link className="btn btn-secondary" to={`/servers/${id}/docker`}>
- Docker
- </Link>
- <button className="btn btn-primary" onClick={handleGenerateToken}>
+ </Button>
+ <Button variant="outline" asChild>
+ <Link to={`/servers/${id}/docker`}>Docker</Link>
+ </Button>
+ <Button onClick={handleGenerateToken}>
<KeyIcon /> Generate Token
- </button>
+ </Button>
</div>
</header>
@@ -715,9 +719,9 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
<div className="install-script-header">
<TerminalIcon />
<span>Linux</span>
- <button className="btn btn-sm btn-secondary" onClick={() => copyToClipboard(linuxScript)}>
+ <Button variant="outline" size="sm" onClick={() => copyToClipboard(linuxScript)}>
<CopyIcon /> Copy
- </button>
+ </Button>
</div>
<pre className="install-script-code">{linuxScript}</pre>
</div>
@@ -726,16 +730,16 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
<div className="install-script-header">
<WindowsIcon />
<span>Windows (PowerShell)</span>
- <button className="btn btn-sm btn-secondary" onClick={() => copyToClipboard(windowsScript)}>
+ <Button variant="outline" size="sm" onClick={() => copyToClipboard(windowsScript)}>
<CopyIcon /> Copy
- </button>
+ </Button>
</div>
<pre className="install-script-code">{windowsScript}</pre>
</div>
- <button className="btn btn-secondary" onClick={onRegenerateToken}>
+ <Button variant="outline" onClick={onRegenerateToken}>
<RefreshIcon /> Regenerate Token
- </button>
+ </Button>
</div>
) : (
<div className="install-inactive">
@@ -744,9 +748,9 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
? 'The registration token has expired. Generate a new one to install or reinstall the agent.'
: 'Generate a registration token to install the agent on your server.'}
</p>
- <button className="btn btn-primary" onClick={onRegenerateToken}>
+ <Button onClick={onRegenerateToken}>
<KeyIcon /> Generate Token
- </button>
+ </Button>
</div>
)}
</div>
@@ -891,7 +895,7 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
<div className="form-group">
<label>Server Name</label>
- <input
+ <Input
type="text"
name="name"
value={formData.name}
@@ -902,7 +906,7 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
<div className="form-group">
<label>Description</label>
- <textarea
+ <Textarea
name="description"
value={formData.description}
onChange={handleChange}
@@ -913,7 +917,7 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
<div className="form-row">
<div className="form-group">
<label>Hostname</label>
- <input
+ <Input
type="text"
name="hostname"
value={formData.hostname}
@@ -922,7 +926,7 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
</div>
<div className="form-group">
<label>IP Address</label>
- <input
+ <Input
type="text"
name="ip_address"
value={formData.ip_address}
@@ -941,9 +945,9 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
</select>
</div>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ <Button type="submit" disabled={loading}>
{loading ? 'Saving...' : 'Save Changes'}
- </button>
+ </Button>
</div>
</form>
@@ -987,7 +991,7 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
<div key={idx} className="ip-item">
<code>{ip}</code>
{connectionInfo?.ip_address === ip && (
- <span className="badge badge-success">Current</span>
+ <Badge variant="success">Current</Badge>
)}
<button
className="btn-icon danger"
@@ -1002,16 +1006,16 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
</div>
<div className="ip-add-form">
- <input
+ <Input
type="text"
placeholder="IP address or CIDR (e.g., 192.168.1.0/24)"
value={newIP}
onChange={(e) => setNewIP(e.target.value)}
onKeyPress={(e) => e.key === 'Enter' && (e.preventDefault(), handleAddIP())}
/>
- <button className="btn btn-secondary" onClick={handleAddIP}>
+ <Button variant="outline" onClick={handleAddIP}>
Add
- </button>
+ </Button>
</div>
{connectionInfo?.ip_address && allowedIPs.length > 0 && !allowedIPs.some(ip => {
@@ -1030,13 +1034,13 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
Rotate the API credentials used by the agent. The agent must be online to receive new credentials.
</p>
<div className="key-rotation-actions">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={handleRotateKey}
disabled={rotatingKey || server.status !== 'online'}
>
<KeyIcon /> {rotatingKey ? 'Rotating...' : 'Rotate API Key'}
- </button>
+ </Button>
{server.api_key_last_rotated && (
<span className="key-rotation-hint">Last rotated: {new Date(server.api_key_last_rotated).toLocaleString()}</span>
)}
@@ -1068,19 +1072,21 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
</div>
<div className="alert-item-actions">
{alert.status === 'open' && (
- <button
- className="btn btn-sm btn-secondary"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleAcknowledgeAlert(alert.id)}
>
Acknowledge
- </button>
+ </Button>
)}
- <button
- className="btn btn-sm btn-success"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleResolveAlert(alert.id)}
>
Resolve
- </button>
+ </Button>
</div>
</div>
))}
@@ -1093,9 +1099,9 @@ const SettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) => {
<p className="section-description">
Removing this server will disconnect the agent and delete all associated data.
</p>
- <button className="btn btn-danger" onClick={onDelete}>
+ <Button variant="destructive" onClick={onDelete}>
<TrashIcon /> Remove Server
- </button>
+ </Button>
</div>
<ConfirmDialog
isOpen={confirmSettingsState.isOpen}
@@ -1150,9 +1156,9 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
<span>Linux</span>
<span className="install-tab-description">Linux server with curl, tar, sudo, and systemd</span>
</div>
- <button className="btn btn-sm btn-secondary" onClick={() => copyToClipboard(linuxScript)}>
+ <Button variant="outline" size="sm" onClick={() => copyToClipboard(linuxScript)}>
<CopyIcon /> Copy
- </button>
+ </Button>
</div>
<pre className="install-script">{linuxScript}</pre>
</div>
@@ -1164,9 +1170,9 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
<span>Windows (PowerShell)</span>
<span className="install-tab-description">Run as Administrator</span>
</div>
- <button className="btn btn-sm btn-secondary" onClick={() => copyToClipboard(windowsScript)}>
+ <Button variant="outline" size="sm" onClick={() => copyToClipboard(windowsScript)}>
<CopyIcon /> Copy
- </button>
+ </Button>
</div>
<pre className="install-script">{windowsScript}</pre>
</div>
@@ -1185,7 +1191,7 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${token}"` :
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onClose}>Close</button>
+ <Button onClick={onClose}>Close</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/ServerTemplates.jsx b/frontend/src/pages/ServerTemplates.jsx
index bda639a7..a2594de7 100644
--- a/frontend/src/pages/ServerTemplates.jsx
+++ b/frontend/src/pages/ServerTemplates.jsx
@@ -4,6 +4,11 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const ServerTemplates = () => {
const toast = useToast();
@@ -18,7 +23,6 @@ const ServerTemplates = () => {
const [selectedDetail, setSelectedDetail] = useState(null);
const [deleteConfirm, setDeleteConfirm] = useState(null);
const [servers, setServers] = useState([]);
- const [tab, setTab] = useState('templates');
const [form, setForm] = useState({
name: '', description: '', category: 'general',
@@ -128,14 +132,14 @@ const ServerTemplates = () => {
<h1>Server Templates</h1>
<p className="page-description">
{templates.length} template{templates.length !== 1 ? 's' : ''}
- {compliance && ` \u2022 ${compliance.compliance_pct}% fleet compliance`}
+ {compliance && ` • ${compliance.compliance_pct}% fleet compliance`}
</p>
</div>
<div className="page-header-actions">
{user?.is_admin && (
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
Create Template
- </button>
+ </Button>
)}
</div>
</div>
@@ -162,71 +166,73 @@ const ServerTemplates = () => {
</div>
)}
- <div className="tabs">
- <button className={`tab ${tab === 'templates' ? 'active' : ''}`} onClick={() => setTab('templates')}>Templates</button>
- <button className={`tab ${tab === 'library' ? 'active' : ''}`} onClick={() => setTab('library')}>Library</button>
- </div>
+ <Tabs defaultValue="templates">
+ <TabsList>
+ <TabsTrigger value="templates">Templates</TabsTrigger>
+ <TabsTrigger value="library">Library</TabsTrigger>
+ </TabsList>
- {tab === 'templates' && (
- <div className="templates-grid">
- {templates.map(tmpl => (
- <div key={tmpl.id} className="template-card card" onClick={() => setSelectedDetail(selectedDetail?.id === tmpl.id ? null : tmpl)}>
- <div className="template-card__header">
- <h3>{tmpl.name}</h3>
- <span className="badge badge--outline">{categoryLabels[tmpl.category] || tmpl.category}</span>
- </div>
- {tmpl.description && <p className="template-card__desc">{tmpl.description}</p>}
- <div className="template-card__meta">
- <span>v{tmpl.version}</span>
- <span>{tmpl.assignment_count} server{tmpl.assignment_count !== 1 ? 's' : ''}</span>
- {tmpl.parent_name && <span>Inherits: {tmpl.parent_name}</span>}
+ <TabsContent value="templates">
+ <div className="templates-grid">
+ {templates.map(tmpl => (
+ <div key={tmpl.id} className="template-card card" onClick={() => setSelectedDetail(selectedDetail?.id === tmpl.id ? null : tmpl)}>
+ <div className="template-card__header">
+ <h3>{tmpl.name}</h3>
+ <Badge variant="outline">{categoryLabels[tmpl.category] || tmpl.category}</Badge>
+ </div>
+ {tmpl.description && <p className="template-card__desc">{tmpl.description}</p>}
+ <div className="template-card__meta">
+ <span>v{tmpl.version}</span>
+ <span>{tmpl.assignment_count} server{tmpl.assignment_count !== 1 ? 's' : ''}</span>
+ {tmpl.parent_name && <span>Inherits: {tmpl.parent_name}</span>}
+ </div>
+ <div className="template-card__spec">
+ {tmpl.packages?.length > 0 && <span>{tmpl.packages.length} packages</span>}
+ {tmpl.services?.length > 0 && <span>{tmpl.services.length} services</span>}
+ {tmpl.firewall_rules?.length > 0 && <span>{tmpl.firewall_rules.length} firewall rules</span>}
+ </div>
+ <div className="template-card__actions" onClick={e => e.stopPropagation()}>
+ <Button size="sm" onClick={() => { setSelectedTemplate(tmpl); setShowAssignModal(true); }}>
+ Assign
+ </Button>
+ {user?.is_admin && (
+ <Button size="sm" variant="destructive" onClick={() => setDeleteConfirm(tmpl)}>Delete</Button>
+ )}
+ </div>
</div>
- <div className="template-card__spec">
- {tmpl.packages?.length > 0 && <span>{tmpl.packages.length} packages</span>}
- {tmpl.services?.length > 0 && <span>{tmpl.services.length} services</span>}
- {tmpl.firewall_rules?.length > 0 && <span>{tmpl.firewall_rules.length} firewall rules</span>}
+ ))}
+ {templates.length === 0 && (
+ <div className="empty-state">
+ <p>No templates yet. Create one or use a library template.</p>
</div>
- <div className="template-card__actions" onClick={e => e.stopPropagation()}>
- <button className="btn btn-sm btn-primary" onClick={() => { setSelectedTemplate(tmpl); setShowAssignModal(true); }}>
- Assign
- </button>
- {user?.is_admin && (
- <button className="btn btn-sm btn-danger" onClick={() => setDeleteConfirm(tmpl)}>Delete</button>
- )}
- </div>
- </div>
- ))}
- {templates.length === 0 && (
- <div className="empty-state">
- <p>No templates yet. Create one or use a library template.</p>
- </div>
- )}
- </div>
- )}
+ )}
+ </div>
+ </TabsContent>
- {tab === 'library' && (
- <div className="templates-grid">
- {Object.entries(library).map(([key, tmpl]) => (
- <div key={key} className="template-card card">
- <div className="template-card__header">
- <h3>{tmpl.name}</h3>
- <span className="badge badge--outline">{categoryLabels[tmpl.category] || tmpl.category}</span>
- </div>
- <p className="template-card__desc">{tmpl.description}</p>
- <div className="template-card__spec">
- {tmpl.packages?.length > 0 && <span>{tmpl.packages.length} packages</span>}
- {tmpl.services?.length > 0 && <span>{tmpl.services.length} services</span>}
- {tmpl.firewall_rules?.length > 0 && <span>{tmpl.firewall_rules.length} firewall rules</span>}
+ <TabsContent value="library">
+ <div className="templates-grid">
+ {Object.entries(library).map(([key, tmpl]) => (
+ <div key={key} className="template-card card">
+ <div className="template-card__header">
+ <h3>{tmpl.name}</h3>
+ <Badge variant="outline">{categoryLabels[tmpl.category] || tmpl.category}</Badge>
+ </div>
+ <p className="template-card__desc">{tmpl.description}</p>
+ <div className="template-card__spec">
+ {tmpl.packages?.length > 0 && <span>{tmpl.packages.length} packages</span>}
+ {tmpl.services?.length > 0 && <span>{tmpl.services.length} services</span>}
+ {tmpl.firewall_rules?.length > 0 && <span>{tmpl.firewall_rules.length} firewall rules</span>}
+ </div>
+ <div className="template-card__actions">
+ <Button size="sm" onClick={() => handleCreateFromLibrary(key)}>
+ Use Template
+ </Button>
+ </div>
</div>
- <div className="template-card__actions">
- <button className="btn btn-sm btn-primary" onClick={() => handleCreateFromLibrary(key)}>
- Use Template
- </button>
- </div>
- </div>
- ))}
- </div>
- )}
+ ))}
+ </div>
+ </TabsContent>
+ </Tabs>
{/* Create Modal */}
{showCreateModal && (
@@ -239,11 +245,11 @@ const ServerTemplates = () => {
<div className="modal-body">
<div className="form-group">
<label>Name</label>
- <input className="form-input" value={form.name} onChange={e => setForm({...form, name: e.target.value})} />
+ <Input value={form.name} onChange={e => setForm({...form, name: e.target.value})} />
</div>
<div className="form-group">
<label>Description</label>
- <textarea className="form-input" value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={2} />
+ <Textarea value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={2} />
</div>
<div className="form-group">
<label>Category</label>
@@ -253,7 +259,7 @@ const ServerTemplates = () => {
</div>
<div className="form-group">
<label>Packages (one per line)</label>
- <textarea className="form-input form-input--mono" value={form.packages} onChange={e => setForm({...form, packages: e.target.value})} rows={4} placeholder="nginx&#10;php-fpm&#10;certbot" />
+ <Textarea className="form-input--mono" value={form.packages} onChange={e => setForm({...form, packages: e.target.value})} rows={4} placeholder={"nginx\nphp-fpm\ncertbot"} />
</div>
<div className="form-group">
<label className="checkbox-label">
@@ -263,8 +269,8 @@ const ServerTemplates = () => {
</div>
</div>
<div className="modal-footer">
- <button className="btn" onClick={() => setShowCreateModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleCreate} disabled={!form.name}>Create</button>
+ <Button variant="outline" onClick={() => setShowCreateModal(false)}>Cancel</Button>
+ <Button onClick={handleCreate} disabled={!form.name}>Create</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 2b5e047d..03105513 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -3,6 +3,9 @@ import { Link } from 'react-router-dom';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
const Servers = () => {
const [servers, setServers] = useState([]);
@@ -198,12 +201,12 @@ const Servers = () => {
<p>{servers.length} {servers.length === 1 ? 'machine' : 'machines'} · {fleetStats.online} online · {availability}% availability</p>
</div>
<div className="servers-header__actions">
- <button className="btn btn-secondary" onClick={() => setShowGroupModal(true)}>
+ <Button variant="outline" onClick={() => setShowGroupModal(true)}>
<FolderIcon /> Groups
- </button>
- <button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
+ </Button>
+ <Button onClick={() => setShowAddModal(true)}>
<PlusIcon /> Add Server
- </button>
+ </Button>
</div>
</header>
@@ -230,7 +233,7 @@ const Servers = () => {
<div className="servers-toolbar">
<label className="search-box">
<SearchIcon />
- <input
+ <Input
type="text"
placeholder="Search by name, host, or IP..."
value={searchTerm}
@@ -275,12 +278,12 @@ const Servers = () => {
<span>selected</span>
</div>
<div className="servers-bulk-bar__actions">
- <button type="button" className="btn btn-sm btn-ghost" onClick={() => setSelectedIds(new Set())}>
+ <Button type="button" variant="ghost" size="sm" onClick={() => setSelectedIds(new Set())}>
Clear selection
- </button>
- <button type="button" className="btn btn-sm btn-danger" onClick={() => setBulkDeleteOpen(true)}>
+ </Button>
+ <Button type="button" variant="destructive" size="sm" onClick={() => setBulkDeleteOpen(true)}>
<TrashIcon /> Delete {selectedIds.size}
- </button>
+ </Button>
</div>
</div>
)}
@@ -297,13 +300,13 @@ const Servers = () => {
: 'Try a different status, group, or search term to bring machines back into view.'}
</p>
{servers.length === 0 ? (
- <button className="btn btn-primary" onClick={() => setShowAddModal(true)}>
+ <Button onClick={() => setShowAddModal(true)}>
<PlusIcon /> Add your first server
- </button>
+ </Button>
) : (
- <button
+ <Button
type="button"
- className="btn btn-secondary"
+ variant="outline"
onClick={() => {
setSelectedGroup('all');
setSelectedStatus('all');
@@ -311,7 +314,7 @@ const Servers = () => {
}}
>
Clear filters
- </button>
+ </Button>
)}
</div>
) : (
@@ -658,7 +661,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
<div className="form-group">
<label>Pair code</label>
- <input
+ <Input
type="text"
value={formatDisplay(formattedCode)}
onChange={(e) => {
@@ -695,7 +698,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
<div className="form-group">
<label>Passphrase *</label>
- <input
+ <Input
type="password"
value={passphrase}
onChange={(e) => setPassphrase(e.target.value)}
@@ -708,7 +711,7 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
<div className="form-row">
<div className="form-group">
<label>Server name</label>
- <input
+ <Input
type="text"
value={name}
onChange={(e) => setName(e.target.value)}
@@ -731,12 +734,12 @@ const PairAgentForm = ({ groups, onClose, onClaimed }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading || formattedCode.length !== 6}>
+ </Button>
+ <Button type="submit" disabled={loading || formattedCode.length !== 6}>
{loading ? 'Pairing…' : 'Pair Agent'}
- </button>
+ </Button>
</div>
</form>
);
@@ -842,7 +845,7 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
<div className="form-group">
<label>Server Name *</label>
- <input
+ <Input
type="text"
name="name"
value={formData.name}
@@ -901,7 +904,7 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
<div className="form-row">
<div className="form-group">
<label>Hostname</label>
- <input
+ <Input
type="text"
name="hostname"
value={formData.hostname}
@@ -911,7 +914,7 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
</div>
<div className="form-group">
<label>IP Address</label>
- <input
+ <Input
type="text"
name="ip_address"
value={formData.ip_address}
@@ -925,12 +928,12 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating…' : 'Create & Get Install Script'}
- </button>
+ </Button>
</div>
</form>
) : (
@@ -975,9 +978,9 @@ Install-ServerKitAgent -Server "${window.location.origin}" -Token "${registratio
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onCreated}>
+ <Button onClick={onCreated}>
Close
- </button>
+ </Button>
</div>
</div>
)}
@@ -995,9 +998,9 @@ const InstallTab = ({ title, description, icon, script, onCopy }) => {
<span>{title}</span>
{description && <span className="install-tab-description">{description}</span>}
</div>
- <button className="btn btn-sm btn-secondary" onClick={onCopy}>
+ <Button variant="outline" size="sm" onClick={onCopy}>
<CopyIcon /> Copy
- </button>
+ </Button>
</div>
<pre className="install-script">{script}</pre>
</div>
@@ -1066,16 +1069,16 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {
</div>
<form onSubmit={handleCreateGroup} className="group-form">
- <input
+ <Input
type="text"
value={newGroupName}
onChange={(e) => setNewGroupName(e.target.value)}
placeholder="New group name..."
disabled={loading}
/>
- <button type="submit" className="btn btn-primary" disabled={loading || !newGroupName.trim()}>
+ <Button type="submit" disabled={loading || !newGroupName.trim()}>
<PlusIcon /> Add
- </button>
+ </Button>
</form>
<div className="groups-list">
@@ -1085,7 +1088,7 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {
groupList.map(group => (
<div key={group.id} className="group-item">
{editingGroup === group.id ? (
- <input
+ <Input
type="text"
defaultValue={group.name}
onBlur={(e) => handleUpdateGroup(group.id, e.target.value)}
@@ -1126,7 +1129,7 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {
</div>
<div className="modal-actions">
- <button className="btn btn-primary" onClick={onClose}>Done</button>
+ <Button onClick={onClose}>Done</Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index c7931261..13b617c6 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -16,6 +16,7 @@ import GunicornTab from '../components/service-detail/GunicornTab';
import CommandsTab from '../components/service-detail/CommandsTab';
import GitConnectModal from '../components/service-detail/GitConnectModal';
import OverviewTab from '../components/service-detail/OverviewTab';
+import { Button } from '@/components/ui/button';
const TAB_LABELS = {
overview: 'Overview',
@@ -104,9 +105,9 @@ const ServiceDetail = () => {
<div className="empty-state">
<h3>Service not found</h3>
<p>{error || 'The service you are looking for does not exist.'}</p>
- <button className="btn btn-primary" onClick={() => navigate('/services')}>
+ <Button onClick={() => navigate('/services')}>
Back to Services
- </button>
+ </Button>
</div>
);
}
@@ -156,15 +157,12 @@ const ServiceDetail = () => {
<div className="svc-detail__header-actions">
{/* Deploy dropdown */}
<div className="svc-detail__dropdown" ref={deployMenuRef}>
- <button
- className="btn btn-primary"
- onClick={() => setShowDeployMenu(!showDeployMenu)}
- >
+ <Button onClick={() => setShowDeployMenu(!showDeployMenu)}>
Deploy
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" className="ml-1">
<polyline points="6 9 12 15 18 9"/>
</svg>
- </button>
+ </Button>
{showDeployMenu && (
<div className="svc-detail__dropdown-menu">
<button onClick={() => handleAction('restart')} disabled={actionLoading === 'restart'}>
@@ -193,30 +191,31 @@ const ServiceDetail = () => {
{/* Restart button */}
{service.isRunning && (
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => handleAction('restart')}
disabled={actionLoading === 'restart'}
>
{actionLoading === 'restart' ? 'Restarting...' : 'Restart'}
- </button>
+ </Button>
)}
{/* Start/Stop */}
{!service.isRunning && (
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => handleAction('start')}
disabled={actionLoading === 'start'}
>
{actionLoading === 'start' ? 'Starting...' : 'Start'}
- </button>
+ </Button>
)}
{/* Three-dot menu */}
<div className="svc-detail__dropdown" ref={moreMenuRef}>
- <button
- className="btn btn-ghost btn-icon"
+ <Button
+ variant="ghost"
+ size="icon"
onClick={() => setShowMoreMenu(!showMoreMenu)}
>
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
@@ -224,7 +223,7 @@ const ServiceDetail = () => {
<circle cx="12" cy="12" r="2"/>
<circle cx="12" cy="19" r="2"/>
</svg>
- </button>
+ </Button>
{showMoreMenu && (
<div className="svc-detail__dropdown-menu svc-detail__dropdown-menu--right">
{service.isRunning && (
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 35983eae..46dd7945 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -3,6 +3,9 @@ import { useNavigate, Link } from 'react-router-dom';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Checkbox } from '@/components/ui/checkbox';
const SERVICE_TYPE_OPTIONS = ['all', 'docker', 'flask', 'django', 'php', 'static', 'wordpress'];
const STATUS_OPTIONS = ['all', 'running', 'stopped'];
@@ -79,16 +82,6 @@ const Services = () => {
}
}
- function toggleSelect(e, appId) {
- e.stopPropagation();
- setSelectedIds(prev => {
- const next = new Set(prev);
- if (next.has(appId)) next.delete(appId);
- else next.add(appId);
- return next;
- });
- }
-
function toggleSelectAll() {
if (selectedIds.size === filteredApps.length) {
setSelectedIds(new Set());
@@ -149,13 +142,15 @@ const Services = () => {
{stats.total} services &middot; {stats.running} live
</p>
</div>
- <Link to="/templates" className="btn btn-primary">
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
- <line x1="12" y1="5" x2="12" y2="19"/>
- <line x1="5" y1="12" x2="19" y2="12"/>
- </svg>
- New Service
- </Link>
+ <Button asChild>
+ <Link to="/templates">
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
+ <line x1="12" y1="5" x2="12" y2="19"/>
+ <line x1="5" y1="12" x2="19" y2="12"/>
+ </svg>
+ New Service
+ </Link>
+ </Button>
</div>
{/* Summary Cards */}
@@ -224,7 +219,7 @@ const Services = () => {
<circle cx="11" cy="11" r="8"/>
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
- <input
+ <Input
type="text"
placeholder="Search services..."
value={searchTerm}
@@ -269,18 +264,18 @@ const Services = () => {
<div className="services-page__bulk-bar">
<span>{selectedIds.size} selected</span>
<div className="services-page__bulk-actions">
- <button className="btn btn-sm" onClick={() => handleBulkAction('restart')} disabled={bulkLoading}>
+ <Button variant="outline" size="sm" onClick={() => handleBulkAction('restart')} disabled={bulkLoading}>
Restart All
- </button>
- <button className="btn btn-sm" onClick={() => handleBulkAction('stop')} disabled={bulkLoading}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={() => handleBulkAction('stop')} disabled={bulkLoading}>
Stop All
- </button>
- <button className="btn btn-sm" onClick={() => handleBulkAction('start')} disabled={bulkLoading}>
+ </Button>
+ <Button variant="outline" size="sm" onClick={() => handleBulkAction('start')} disabled={bulkLoading}>
Start All
- </button>
- <button className="btn btn-ghost btn-sm" onClick={() => setSelectedIds(new Set())}>
+ </Button>
+ <Button variant="ghost" size="sm" onClick={() => setSelectedIds(new Set())}>
Clear
- </button>
+ </Button>
</div>
</div>
)}
@@ -297,7 +292,9 @@ const Services = () => {
? 'Try adjusting your filters'
: 'Deploy your first service to get started'}</p>
{!searchTerm && typeFilter === 'all' && statusFilter === 'all' && (
- <Link to="/templates" className="btn btn-primary">Create Service</Link>
+ <Button asChild>
+ <Link to="/templates">Create Service</Link>
+ </Button>
)}
</div>
) : (
@@ -305,10 +302,9 @@ const Services = () => {
{/* List Header */}
<div className="services-page__list-header">
<div className="services-page__list-header-left">
- <input
- type="checkbox"
+ <Checkbox
checked={selectedIds.size === filteredApps.length && filteredApps.length > 0}
- onChange={toggleSelectAll}
+ onCheckedChange={toggleSelectAll}
className="services-page__checkbox"
/>
<span>Service</span>
@@ -338,10 +334,16 @@ const Services = () => {
}}
>
<div className="services-page__row-main">
- <input
- type="checkbox"
+ <Checkbox
checked={selectedIds.has(app.id)}
- onChange={(e) => toggleSelect(e, app.id)}
+ onCheckedChange={(checked) => {
+ setSelectedIds(prev => {
+ const next = new Set(prev);
+ if (checked) next.add(app.id);
+ else next.delete(app.id);
+ return next;
+ });
+ }}
onClick={(e) => e.stopPropagation()}
className="services-page__checkbox"
/>
@@ -395,8 +397,9 @@ const Services = () => {
<div className="services-page__actions" onClick={e => e.stopPropagation()}>
{isRunning ? (
<>
- <button
- className="btn btn-ghost btn-sm"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={(e) => handleAction(e, app.id, 'restart')}
disabled={actionLoading === `${app.id}-restart`}
title="Restart"
@@ -405,9 +408,10 @@ const Services = () => {
<polyline points="23 4 23 10 17 10"/>
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
- </button>
- <button
- className="btn btn-ghost btn-sm"
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
onClick={(e) => handleAction(e, app.id, 'stop')}
disabled={actionLoading === `${app.id}-stop`}
title="Stop"
@@ -415,11 +419,12 @@ const Services = () => {
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<rect x="6" y="6" width="12" height="12" rx="1"/>
</svg>
- </button>
+ </Button>
</>
) : (
- <button
- className="btn btn-ghost btn-sm"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={(e) => handleAction(e, app.id, 'start')}
disabled={actionLoading === `${app.id}-start`}
title="Start"
@@ -427,7 +432,7 @@ const Services = () => {
<svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
<polygon points="5 3 19 12 5 21 5 3"/>
</svg>
- </button>
+ </Button>
)}
</div>
</div>
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index d23d9bd6..5a0bcbe1 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -18,6 +18,7 @@ import MigrationHistoryTab from '../components/settings/MigrationHistoryTab';
import IconReferenceTab from '../components/settings/IconReferenceTab';
import AboutTab from '../components/settings/AboutTab';
import { Activity, Code, Database, Layers } from 'lucide-react';
+import { Button } from '@/components/ui/button';
const VALID_TABS = ['profile', 'security', 'appearance', 'sidebar', 'whitelabel', 'notifications', 'system', 'users', 'activity', 'site', 'sso', 'api', 'migrations', 'developer', 'about'];
@@ -46,7 +47,8 @@ const Settings = () => {
<div className="settings-layout">
<nav className="settings-nav">
<div className="settings-nav-divider">Account</div>
- <button
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'profile' ? 'active' : ''}`}
onClick={() => setActiveTab('profile')}
>
@@ -55,8 +57,9 @@ const Settings = () => {
<circle cx="12" cy="7" r="4"/>
</svg>
Profile
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'security' ? 'active' : ''}`}
onClick={() => setActiveTab('security')}
>
@@ -65,8 +68,9 @@ const Settings = () => {
<path d="M7 11V7a5 5 0 0 1 10 0v4"/>
</svg>
Security
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'notifications' ? 'active' : ''}`}
onClick={() => setActiveTab('notifications')}
>
@@ -75,9 +79,10 @@ const Settings = () => {
<path d="M13.73 21a2 2 0 0 1-3.46 0"/>
</svg>
Notifications
- </button>
+ </Button>
<div className="settings-nav-divider">Preferences</div>
- <button
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'appearance' ? 'active' : ''}`}
onClick={() => setActiveTab('appearance')}
>
@@ -93,8 +98,9 @@ const Settings = () => {
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"/>
</svg>
Appearance
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'sidebar' ? 'active' : ''}`}
onClick={() => setActiveTab('sidebar')}
>
@@ -103,18 +109,20 @@ const Settings = () => {
<line x1="9" y1="3" x2="9" y2="21"/>
</svg>
Sidebar
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'whitelabel' ? 'active' : ''}`}
onClick={() => setActiveTab('whitelabel')}
>
<Layers size={18} />
White Label
- </button>
+ </Button>
{isAdmin && (
<>
<div className="settings-nav-divider">Admin</div>
- <button
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'users' ? 'active' : ''}`}
onClick={() => setActiveTab('users')}
>
@@ -125,15 +133,17 @@ const Settings = () => {
<path d="M16 3.13a4 4 0 0 1 0 7.75"/>
</svg>
Users
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'activity' ? 'active' : ''}`}
onClick={() => setActiveTab('activity')}
>
<Activity size={18} />
Activity
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'site' ? 'active' : ''}`}
onClick={() => setActiveTab('site')}
>
@@ -142,8 +152,9 @@ const Settings = () => {
<path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
</svg>
Site Settings
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'sso' ? 'active' : ''}`}
onClick={() => setActiveTab('sso')}
>
@@ -153,22 +164,25 @@ const Settings = () => {
<line x1="15" y1="12" x2="3" y2="12"/>
</svg>
SSO
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'api' ? 'active' : ''}`}
onClick={() => setActiveTab('api')}
>
<Code size={18} />
API
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'migrations' ? 'active' : ''}`}
onClick={() => setActiveTab('migrations')}
>
<Database size={18} />
Migrations
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'system' ? 'active' : ''}`}
onClick={() => setActiveTab('system')}
>
@@ -178,22 +192,24 @@ const Settings = () => {
<line x1="12" y1="17" x2="12" y2="21"/>
</svg>
System Info
- </button>
+ </Button>
</>
)}
{devMode && isAdmin && (
<>
<div className="settings-nav-divider">Developer</div>
- <button
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'developer' ? 'active' : ''}`}
onClick={() => setActiveTab('developer')}
>
<Code size={18} />
Icon Reference
- </button>
+ </Button>
</>
)}
- <button
+ <Button
+ variant="ghost"
className={`settings-nav-item ${activeTab === 'about' ? 'active' : ''}`}
onClick={() => setActiveTab('about')}
>
@@ -203,7 +219,7 @@ const Settings = () => {
<line x1="12" y1="8" x2="12.01" y2="8"/>
</svg>
About
- </button>
+ </Button>
</nav>
<div className="settings-content">
diff --git a/frontend/src/pages/Setup.jsx b/frontend/src/pages/Setup.jsx
index d96f3969..bc4d9701 100644
--- a/frontend/src/pages/Setup.jsx
+++ b/frontend/src/pages/Setup.jsx
@@ -7,6 +7,7 @@ import SetupStepAccount from '../components/setup/SetupStepAccount';
import SetupStepIntent from '../components/setup/SetupStepIntent';
import SetupStepTier from '../components/setup/SetupStepTier';
import SetupStepSummary from '../components/setup/SetupStepSummary';
+import { Button } from '@/components/ui/button';
const TOTAL_STEPS = 4;
@@ -124,13 +125,14 @@ const Setup = () => {
{renderProgressBar()}
{currentStep > 2 && (
- <button
+ <Button
+ variant="ghost"
className="btn-wizard-prev mb-4"
onClick={handleBack}
>
<ArrowLeft size={16} />
Back
- </button>
+ </Button>
)}
{renderStep()}
diff --git a/frontend/src/pages/StatusPages.jsx b/frontend/src/pages/StatusPages.jsx
index 26da290f..c9157803 100644
--- a/frontend/src/pages/StatusPages.jsx
+++ b/frontend/src/pages/StatusPages.jsx
@@ -4,6 +4,11 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const StatusPages = () => {
const toast = useToast();
@@ -17,7 +22,6 @@ const StatusPages = () => {
const [showCreateComponent, setShowCreateComponent] = useState(false);
const [showCreateIncident, setShowCreateIncident] = useState(false);
const [deleteConfirm, setDeleteConfirm] = useState(null);
- const [tab, setTab] = useState('components');
const [pageForm, setPageForm] = useState({ name: '', slug: '', description: '', primary_color: '#4f46e5' });
const [compForm, setCompForm] = useState({ name: '', group: 'Services', check_type: 'http', check_target: '', check_interval: 60 });
@@ -122,7 +126,7 @@ const StatusPages = () => {
</div>
<div className="page-header-actions">
{user?.is_admin && (
- <button className="btn btn-primary" onClick={() => setShowCreatePage(true)}>Create Page</button>
+ <Button onClick={() => setShowCreatePage(true)}>Create Page</Button>
)}
</div>
</div>
@@ -133,7 +137,7 @@ const StatusPages = () => {
<div key={page.id} className={`status-page-item ${selectedPage?.id === page.id ? 'active' : ''}`}
onClick={() => loadPageDetails(page.id)}>
<strong>{page.name}</strong>
- <span className="text-muted">/{page.slug} \u2022 {page.component_count} components</span>
+ <span className="text-muted">/{page.slug} &bull; {page.component_count} components</span>
</div>
))}
{pages.length === 0 && <div className="empty-state"><p>No status pages yet.</p></div>}
@@ -146,16 +150,16 @@ const StatusPages = () => {
<span className="text-muted">/{selectedPage.slug}</span>
</div>
- <div className="tabs">
- <button className={`tab ${tab === 'components' ? 'active' : ''}`} onClick={() => setTab('components')}>Components</button>
- <button className={`tab ${tab === 'incidents' ? 'active' : ''}`} onClick={() => setTab('incidents')}>Incidents</button>
- </div>
+ <Tabs defaultValue="components">
+ <TabsList>
+ <TabsTrigger value="components">Components</TabsTrigger>
+ <TabsTrigger value="incidents">Incidents</TabsTrigger>
+ </TabsList>
- {tab === 'components' && (
- <>
+ <TabsContent value="components">
<div className="status-actions-bar">
{user?.is_admin && (
- <button className="btn btn-sm btn-primary" onClick={() => setShowCreateComponent(true)}>Add Component</button>
+ <Button size="sm" onClick={() => setShowCreateComponent(true)}>Add Component</Button>
)}
</div>
<div className="components-list">
@@ -165,7 +169,7 @@ const StatusPages = () => {
<span className={`status-dot status-dot--${statusColors[comp.status] || 'muted'}`} />
<div>
<strong>{comp.name}</strong>
- <span className="text-muted"> \u2022 {comp.group}</span>
+ <span className="text-muted"> &bull; {comp.group}</span>
</div>
</div>
<div className="component-row__stats">
@@ -173,20 +177,18 @@ const StatusPages = () => {
{comp.last_response_time && <span>{comp.last_response_time}ms</span>}
</div>
<div className="component-row__actions">
- <button className="btn btn-sm" onClick={() => handleRunCheck(comp.id)}>Check Now</button>
+ <Button size="sm" variant="outline" onClick={() => handleRunCheck(comp.id)}>Check Now</Button>
</div>
</div>
))}
{components.length === 0 && <p className="text-muted">No components yet.</p>}
</div>
- </>
- )}
+ </TabsContent>
- {tab === 'incidents' && (
- <>
+ <TabsContent value="incidents">
<div className="status-actions-bar">
{user?.is_admin && (
- <button className="btn btn-sm btn-primary" onClick={() => setShowCreateIncident(true)}>Create Incident</button>
+ <Button size="sm" onClick={() => setShowCreateIncident(true)}>Create Incident</Button>
)}
</div>
<div className="incidents-list">
@@ -194,19 +196,19 @@ const StatusPages = () => {
<div key={inc.id} className="incident-row">
<div className="incident-row__header">
<strong>{inc.title}</strong>
- <span className={`badge badge--${inc.status === 'resolved' ? 'success' : 'warning'}`}>{inc.status}</span>
+ <Badge variant={inc.status === 'resolved' ? 'success' : 'warning'}>{inc.status}</Badge>
</div>
<span className="text-muted">Impact: {inc.impact}</span>
{inc.body && <p>{inc.body}</p>}
{inc.status !== 'resolved' && user?.is_admin && (
- <button className="btn btn-sm btn-success" onClick={() => handleResolveIncident(inc.id)}>Resolve</button>
+ <Button size="sm" variant="secondary" onClick={() => handleResolveIncident(inc.id)}>Resolve</Button>
)}
</div>
))}
{incidents.length === 0 && <p className="text-muted">No incidents.</p>}
</div>
- </>
- )}
+ </TabsContent>
+ </Tabs>
</div>
)}
</div>
@@ -216,11 +218,14 @@ const StatusPages = () => {
<div className="modal" onClick={e => e.stopPropagation()}>
<div className="modal-header"><h2>Create Status Page</h2><button className="modal-close" onClick={() => setShowCreatePage(false)}>&times;</button></div>
<div className="modal-body">
- <div className="form-group"><label>Name</label><input className="form-input" value={pageForm.name} onChange={e => setPageForm({...pageForm, name: e.target.value})} /></div>
- <div className="form-group"><label>Slug (URL path)</label><input className="form-input" value={pageForm.slug} onChange={e => setPageForm({...pageForm, slug: e.target.value})} placeholder="my-services" /></div>
- <div className="form-group"><label>Description</label><textarea className="form-input" value={pageForm.description} onChange={e => setPageForm({...pageForm, description: e.target.value})} rows={2} /></div>
+ <div className="form-group"><label>Name</label><Input value={pageForm.name} onChange={e => setPageForm({...pageForm, name: e.target.value})} /></div>
+ <div className="form-group"><label>Slug (URL path)</label><Input value={pageForm.slug} onChange={e => setPageForm({...pageForm, slug: e.target.value})} placeholder="my-services" /></div>
+ <div className="form-group"><label>Description</label><Textarea value={pageForm.description} onChange={e => setPageForm({...pageForm, description: e.target.value})} rows={2} /></div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowCreatePage(false)}>Cancel</Button>
+ <Button onClick={handleCreatePage} disabled={!pageForm.name || !pageForm.slug}>Create</Button>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowCreatePage(false)}>Cancel</button><button className="btn btn-primary" onClick={handleCreatePage} disabled={!pageForm.name || !pageForm.slug}>Create</button></div>
</div>
</div>
)}
@@ -230,13 +235,16 @@ const StatusPages = () => {
<div className="modal" onClick={e => e.stopPropagation()}>
<div className="modal-header"><h2>Add Component</h2><button className="modal-close" onClick={() => setShowCreateComponent(false)}>&times;</button></div>
<div className="modal-body">
- <div className="form-group"><label>Name</label><input className="form-input" value={compForm.name} onChange={e => setCompForm({...compForm, name: e.target.value})} /></div>
- <div className="form-group"><label>Group</label><input className="form-input" value={compForm.group} onChange={e => setCompForm({...compForm, group: e.target.value})} /></div>
+ <div className="form-group"><label>Name</label><Input value={compForm.name} onChange={e => setCompForm({...compForm, name: e.target.value})} /></div>
+ <div className="form-group"><label>Group</label><Input value={compForm.group} onChange={e => setCompForm({...compForm, group: e.target.value})} /></div>
<div className="form-group"><label>Check Type</label><select className="form-select" value={compForm.check_type} onChange={e => setCompForm({...compForm, check_type: e.target.value})}><option value="http">HTTP</option><option value="tcp">TCP</option><option value="dns">DNS</option><option value="ping">Ping</option></select></div>
- <div className="form-group"><label>Check Target</label><input className="form-input" value={compForm.check_target} onChange={e => setCompForm({...compForm, check_target: e.target.value})} placeholder="https://example.com or host:port" /></div>
- <div className="form-group"><label>Check Interval (seconds)</label><input className="form-input" type="number" value={compForm.check_interval} onChange={e => setCompForm({...compForm, check_interval: parseInt(e.target.value) || 60})} /></div>
+ <div className="form-group"><label>Check Target</label><Input value={compForm.check_target} onChange={e => setCompForm({...compForm, check_target: e.target.value})} placeholder="https://example.com or host:port" /></div>
+ <div className="form-group"><label>Check Interval (seconds)</label><Input type="number" value={compForm.check_interval} onChange={e => setCompForm({...compForm, check_interval: parseInt(e.target.value) || 60})} /></div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowCreateComponent(false)}>Cancel</Button>
+ <Button onClick={handleCreateComponent} disabled={!compForm.name}>Add</Button>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowCreateComponent(false)}>Cancel</button><button className="btn btn-primary" onClick={handleCreateComponent} disabled={!compForm.name}>Add</button></div>
</div>
</div>
)}
@@ -246,11 +254,14 @@ const StatusPages = () => {
<div className="modal" onClick={e => e.stopPropagation()}>
<div className="modal-header"><h2>Create Incident</h2><button className="modal-close" onClick={() => setShowCreateIncident(false)}>&times;</button></div>
<div className="modal-body">
- <div className="form-group"><label>Title</label><input className="form-input" value={incidentForm.title} onChange={e => setIncidentForm({...incidentForm, title: e.target.value})} /></div>
+ <div className="form-group"><label>Title</label><Input value={incidentForm.title} onChange={e => setIncidentForm({...incidentForm, title: e.target.value})} /></div>
<div className="form-group"><label>Impact</label><select className="form-select" value={incidentForm.impact} onChange={e => setIncidentForm({...incidentForm, impact: e.target.value})}><option value="none">None</option><option value="minor">Minor</option><option value="major">Major</option><option value="critical">Critical</option></select></div>
- <div className="form-group"><label>Description</label><textarea className="form-input" value={incidentForm.body} onChange={e => setIncidentForm({...incidentForm, body: e.target.value})} rows={3} /></div>
+ <div className="form-group"><label>Description</label><Textarea value={incidentForm.body} onChange={e => setIncidentForm({...incidentForm, body: e.target.value})} rows={3} /></div>
+ </div>
+ <div className="modal-footer">
+ <Button variant="outline" onClick={() => setShowCreateIncident(false)}>Cancel</Button>
+ <Button onClick={handleCreateIncident} disabled={!incidentForm.title}>Create</Button>
</div>
- <div className="modal-footer"><button className="btn" onClick={() => setShowCreateIncident(false)}>Cancel</button><button className="btn btn-primary" onClick={handleCreateIncident} disabled={!incidentForm.title}>Create</button></div>
</div>
</div>
)}
diff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsx
index 6bdb620a..29ea7be9 100644
--- a/frontend/src/pages/StyleGuide.jsx
+++ b/frontend/src/pages/StyleGuide.jsx
@@ -13,13 +13,17 @@ import { ConfirmDialog } from '../components/ConfirmDialog';
import StatusBadge from '../components/StatusBadge';
import EmptyState from '../components/EmptyState';
import { Spinner } from '../components/Spinner';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
export default function StyleGuide() {
const [activeSection, setActiveSection] = useState('colors');
const [modalOpen, setModalOpen] = useState(false);
const [confirmOpen, setConfirmOpen] = useState(false);
const [confirmVariant, setConfirmVariant] = useState('danger');
- const [tabActive, setTabActive] = useState('tab1');
const [inputValue, setInputValue] = useState('');
const [selectValue, setSelectValue] = useState('');
const [checkValue, setCheckValue] = useState(false);
@@ -242,51 +246,52 @@ export default function StyleGuide() {
<SectionTitle title="Button Variants" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap gap-3 mb-6">
- <button className="btn btn-primary"><Plus size={16} /> Primary</button>
- <button className="btn btn-secondary"><Edit3 size={16} /> Secondary</button>
- <button className="btn btn-danger"><Trash2 size={16} /> Danger</button>
- <button className="btn btn-ghost"><Eye size={16} /> Ghost</button>
+ <Button><Plus size={16} /> Primary</Button>
+ <Button variant="outline"><Edit3 size={16} /> Outline</Button>
+ <Button variant="destructive"><Trash2 size={16} /> Destructive</Button>
+ <Button variant="ghost"><Eye size={16} /> Ghost</Button>
+ <Button variant="secondary"><Settings size={16} /> Secondary</Button>
</div>
<div className="flex flex-wrap gap-3">
- <button className="btn btn-primary" disabled>Disabled Primary</button>
- <button className="btn btn-secondary" disabled>Disabled Secondary</button>
- <button className="btn btn-danger" disabled>Disabled Danger</button>
+ <Button disabled>Disabled Primary</Button>
+ <Button variant="outline" disabled>Disabled Outline</Button>
+ <Button variant="destructive" disabled>Disabled Destructive</Button>
</div>
</div>
<SectionTitle title="Button Sizes" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap items-center gap-3">
- <button className="btn btn-primary btn-sm">Small</button>
- <button className="btn btn-primary">Default</button>
- <button className="btn btn-primary btn-lg">Large</button>
+ <Button size="sm">Small</Button>
+ <Button>Default</Button>
+ <Button size="lg">Large</Button>
</div>
</div>
<SectionTitle title="Icon Buttons" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap gap-3">
- <button className="btn btn-icon btn-primary"><Plus size={16} /></button>
- <button className="btn btn-icon btn-secondary"><Edit3 size={16} /></button>
- <button className="btn btn-icon btn-danger"><Trash2 size={16} /></button>
- <button className="btn btn-icon btn-ghost"><Settings size={16} /></button>
- <button className="btn btn-icon btn-ghost"><Copy size={16} /></button>
- <button className="btn btn-icon btn-ghost"><RefreshCw size={16} /></button>
+ <Button size="icon"><Plus size={16} /></Button>
+ <Button size="icon" variant="outline"><Edit3 size={16} /></Button>
+ <Button size="icon" variant="destructive"><Trash2 size={16} /></Button>
+ <Button size="icon" variant="ghost"><Settings size={16} /></Button>
+ <Button size="icon" variant="ghost"><Copy size={16} /></Button>
+ <Button size="icon" variant="ghost"><RefreshCw size={16} /></Button>
</div>
</div>
<SectionTitle title="Full Width & Loading" />
<div className="card" style={{ padding: 24 }}>
- <button className="btn btn-primary btn-full mb-4">Full Width Button</button>
+ <Button className="w-full mb-4">Full Width Button</Button>
<div className="flex flex-wrap gap-3">
- <button className="btn btn-primary btn-loading">
+ <Button disabled>
<span className="spinner spinner-sm"><span className="spinner-ring"></span></span>
Saving...
- </button>
- <button className="btn btn-secondary btn-loading">
+ </Button>
+ <Button variant="outline" disabled>
<span className="spinner spinner-sm"><span className="spinner-ring"></span></span>
Loading...
- </button>
+ </Button>
</div>
</div>
</div>
@@ -299,12 +304,12 @@ export default function StyleGuide() {
<div className="card" style={{ padding: 24 }}>
<div className="form-group">
<label>Default Input</label>
- <input type="text" placeholder="Enter text..." value={inputValue} onChange={e => setInputValue(e.target.value)} />
+ <Input type="text" placeholder="Enter text..." value={inputValue} onChange={e => setInputValue(e.target.value)} />
<span className="hint">This is a hint text below the input</span>
</div>
<div className="form-group">
<label>Disabled Input</label>
- <input type="text" placeholder="Disabled..." disabled />
+ <Input type="text" placeholder="Disabled..." disabled />
</div>
</div>
@@ -320,11 +325,11 @@ export default function StyleGuide() {
</div>
<div className="form-group">
<label>Textarea</label>
- <textarea rows={3} placeholder="Enter multiline text..." />
+ <Textarea rows={3} placeholder="Enter multiline text..." />
</div>
<div className="form-group">
<label>Code Editor</label>
- <textarea className="code-editor" rows={3} placeholder="server { listen 80; }" />
+ <Textarea className="code-editor" rows={3} placeholder="server { listen 80; }" />
</div>
</div>
@@ -333,11 +338,11 @@ export default function StyleGuide() {
<div className="form-row">
<div className="form-group">
<label>First Name</label>
- <input type="text" placeholder="John" />
+ <Input type="text" placeholder="John" />
</div>
<div className="form-group">
<label>Last Name</label>
- <input type="text" placeholder="Doe" />
+ <Input type="text" placeholder="Doe" />
</div>
</div>
</div>
@@ -345,8 +350,8 @@ export default function StyleGuide() {
<SectionTitle title="Inline Form" />
<div className="card" style={{ padding: 24 }}>
<div className="install-form">
- <input type="text" placeholder="Search packages..." />
- <button className="btn btn-primary"><Search size={16} /> Search</button>
+ <Input type="text" placeholder="Search packages..." />
+ <Button><Search size={16} /> Search</Button>
</div>
</div>
@@ -368,8 +373,8 @@ export default function StyleGuide() {
<div className="card-header">
<h3>SSH Authorized Keys</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-primary">Add Key</button>
- <button className="btn btn-sm btn-secondary">Refresh</button>
+ <Button size="sm">Add Key</Button>
+ <Button size="sm" variant="outline">Refresh</Button>
</div>
</div>
<div className="card-body">
@@ -387,19 +392,19 @@ export default function StyleGuide() {
<td><code>ssh-ed25519</code></td>
<td><code>SHA256:abc123def456...</code></td>
<td>deploy@server</td>
- <td><button className="btn btn-sm btn-danger">Remove</button></td>
+ <td><Button size="sm" variant="destructive">Remove</Button></td>
</tr>
<tr>
<td><code>ssh-rsa</code></td>
<td><code>SHA256:xyz789ghi012...</code></td>
<td>admin@laptop</td>
- <td><button className="btn btn-sm btn-danger">Remove</button></td>
+ <td><Button size="sm" variant="destructive">Remove</Button></td>
</tr>
<tr>
<td><code>ssh-ed25519</code></td>
<td><code>SHA256:mno345pqr678...</code></td>
<td>ci-pipeline</td>
- <td><button className="btn btn-sm btn-danger">Remove</button></td>
+ <td><Button size="sm" variant="destructive">Remove</Button></td>
</tr>
</tbody>
</table>
@@ -410,7 +415,7 @@ export default function StyleGuide() {
<div className="card" style={{ padding: 24 }}>
<div className="card-header">
<h3>Scan History</h3>
- <button className="btn btn-sm btn-secondary">Refresh</button>
+ <Button size="sm" variant="outline">Refresh</Button>
</div>
<div className="card-body">
<table className="table">
@@ -426,19 +431,19 @@ export default function StyleGuide() {
<tr>
<td>2026-03-29 14:30</td>
<td>/var/www</td>
- <td><span className="badge badge-success">completed</span></td>
- <td><span className="badge badge-success">Clean</span></td>
+ <td><Badge variant="success">completed</Badge></td>
+ <td><Badge variant="success">Clean</Badge></td>
</tr>
<tr>
<td>2026-03-28 09:15</td>
<td>/home/deploy</td>
- <td><span className="badge badge-success">completed</span></td>
- <td><span className="badge badge-error">2 found</span></td>
+ <td><Badge variant="success">completed</Badge></td>
+ <td><Badge variant="destructive">2 found</Badge></td>
</tr>
<tr>
<td>2026-03-27 22:00</td>
<td>/var/www</td>
- <td><span className="badge badge-warning">cancelled</span></td>
+ <td><Badge variant="warning">cancelled</Badge></td>
<td>&mdash;</td>
</tr>
</tbody>
@@ -466,21 +471,21 @@ export default function StyleGuide() {
<tr>
<td><code>22</code></td>
<td>TCP</td>
- <td><span className="badge badge-success">Allow</span></td>
+ <td><Badge variant="success">Allow</Badge></td>
<td>Anywhere</td>
<td><StatusBadge status="active" /></td>
</tr>
<tr>
<td><code>80</code></td>
<td>TCP</td>
- <td><span className="badge badge-success">Allow</span></td>
+ <td><Badge variant="success">Allow</Badge></td>
<td>Anywhere</td>
<td><StatusBadge status="active" /></td>
</tr>
<tr>
<td><code>3306</code></td>
<td>TCP</td>
- <td><span className="badge badge-error">Deny</span></td>
+ <td><Badge variant="destructive">Deny</Badge></td>
<td>External</td>
<td><StatusBadge status="active" /></td>
</tr>
@@ -499,8 +504,8 @@ export default function StyleGuide() {
<div className="card-header">
<h3>Card Title</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-secondary">Refresh</button>
- <button className="btn btn-sm btn-primary">Action</button>
+ <Button size="sm" variant="outline">Refresh</Button>
+ <Button size="sm">Action</Button>
</div>
</div>
<div className="card-body">
@@ -589,7 +594,7 @@ export default function StyleGuide() {
<h4>Delete Application</h4>
<p className="text-secondary">Once deleted, this cannot be undone. All data will be permanently removed.</p>
</div>
- <button className="btn btn-danger"><Trash2 size={16} /> Delete</button>
+ <Button variant="destructive"><Trash2 size={16} /> Delete</Button>
</div>
</div>
)}
@@ -626,14 +631,16 @@ export default function StyleGuide() {
</div>
</div>
- <SectionTitle title="Generic Badges (.badge)" />
+ <SectionTitle title="shadcn Badge Variants" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap gap-3">
- <span className="badge badge-default">Default</span>
- <span className="badge badge-info">Info</span>
- <span className="badge badge-success">Success</span>
- <span className="badge badge-warning">Warning</span>
- <span className="badge badge-error">Error</span>
+ <Badge>Default</Badge>
+ <Badge variant="info">Info</Badge>
+ <Badge variant="success">Success</Badge>
+ <Badge variant="warning">Warning</Badge>
+ <Badge variant="destructive">Destructive</Badge>
+ <Badge variant="secondary">Secondary</Badge>
+ <Badge variant="outline">Outline</Badge>
</div>
</div>
@@ -714,22 +721,22 @@ export default function StyleGuide() {
<div className="space-y-6">
<SectionTitle title="Modal Dialog" />
<div className="card" style={{ padding: 24 }}>
- <button className="btn btn-primary" onClick={() => setModalOpen(true)}>
+ <Button onClick={() => setModalOpen(true)}>
Open Modal
- </button>
+ </Button>
<Modal
open={modalOpen}
onClose={() => setModalOpen(false)}
title="Example Modal"
footer={<>
- <button className="btn btn-secondary" onClick={() => setModalOpen(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={() => setModalOpen(false)}>Save Changes</button>
+ <Button variant="outline" onClick={() => setModalOpen(false)}>Cancel</Button>
+ <Button onClick={() => setModalOpen(false)}>Save Changes</Button>
</>}
>
<p className="text-secondary">Modal body content with a form field.</p>
<div className="form-group mt-4">
<label>Example Field</label>
- <input type="text" placeholder="Type something..." />
+ <Input type="text" placeholder="Type something..." />
</div>
</Modal>
</div>
@@ -737,9 +744,9 @@ export default function StyleGuide() {
<SectionTitle title="Confirm Dialogs" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap gap-3">
- <button className="btn btn-danger" onClick={() => { setConfirmVariant('danger'); setConfirmOpen(true); }}>Danger</button>
- <button className="btn btn-secondary" onClick={() => { setConfirmVariant('warning'); setConfirmOpen(true); }}>Warning</button>
- <button className="btn btn-secondary" onClick={() => { setConfirmVariant('info'); setConfirmOpen(true); }}>Info</button>
+ <Button variant="destructive" onClick={() => { setConfirmVariant('danger'); setConfirmOpen(true); }}>Danger</Button>
+ <Button variant="outline" onClick={() => { setConfirmVariant('warning'); setConfirmOpen(true); }}>Warning</Button>
+ <Button variant="outline" onClick={() => { setConfirmVariant('info'); setConfirmOpen(true); }}>Info</Button>
</div>
<ConfirmDialog
isOpen={confirmOpen}
@@ -757,24 +764,24 @@ export default function StyleGuide() {
{/* ── TABS ── */}
{activeSection === 'tabs' && (
<div className="space-y-6">
- <SectionTitle title="Tabs (Primary)" />
+ <SectionTitle title="Tabs (shadcn)" />
<div className="card" style={{ padding: 24 }}>
- <div className="tabs-container">
- <div className="tabs">
- {['tab1', 'tab2', 'tab3'].map(t => (
- <button key={t} className={`tab ${tabActive === t ? 'active' : ''}`} onClick={() => setTabActive(t)}>
- {t === 'tab1' && <><Server size={14} /> General</>}
- {t === 'tab2' && <><Shield size={14} /> Security</>}
- {t === 'tab3' && <><Activity size={14} /> Monitoring</>}
- </button>
- ))}
- </div>
- <div className="tab-content" style={{ padding: '16px 0' }}>
- {tabActive === 'tab1' && <p className="text-secondary">General tab content.</p>}
- {tabActive === 'tab2' && <p className="text-secondary">Security tab content.</p>}
- {tabActive === 'tab3' && <p className="text-secondary">Monitoring tab content.</p>}
- </div>
- </div>
+ <Tabs defaultValue="tab1">
+ <TabsList>
+ <TabsTrigger value="tab1"><Server size={14} /> General</TabsTrigger>
+ <TabsTrigger value="tab2"><Shield size={14} /> Security</TabsTrigger>
+ <TabsTrigger value="tab3"><Activity size={14} /> Monitoring</TabsTrigger>
+ </TabsList>
+ <TabsContent value="tab1">
+ <p className="text-secondary" style={{ paddingTop: 16 }}>General tab content.</p>
+ </TabsContent>
+ <TabsContent value="tab2">
+ <p className="text-secondary" style={{ paddingTop: 16 }}>Security tab content.</p>
+ </TabsContent>
+ <TabsContent value="tab3">
+ <p className="text-secondary" style={{ paddingTop: 16 }}>Monitoring tab content.</p>
+ </TabsContent>
+ </Tabs>
</div>
</div>
)}
@@ -808,7 +815,7 @@ export default function StyleGuide() {
<div className="env-list">
{[
['DATABASE_URL', 'postgresql://localhost:5432/mydb'],
- ['SECRET_KEY', '\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022'],
+ ['SECRET_KEY', '••••••••••'],
['NODE_ENV', 'production'],
].map(([key, val]) => (
<div key={key} className="env-item">
@@ -866,7 +873,7 @@ export default function StyleGuide() {
icon={Server}
title="No servers connected"
description="Connect your first server to start managing it from the dashboard."
- action={<button className="btn btn-primary"><Plus size={16} /> Add Server</button>}
+ action={<Button><Plus size={16} /> Add Server</Button>}
/>
<SectionTitle title="Loading State" />
@@ -887,7 +894,7 @@ export default function StyleGuide() {
icon={GitBranch}
title="No Git Server Installed"
description="Install Gitea to host and manage your Git repositories locally."
- action={<button className="btn btn-primary btn-lg"><Download size={16} /> Install Git Server</button>}
+ action={<Button size="lg"><Download size={16} /> Install Git Server</Button>}
/>
<SectionTitle title='Large — Unavailable (size="lg")' />
@@ -896,7 +903,7 @@ export default function StyleGuide() {
icon={WifiOff}
title="Docker Not Available"
description="Docker is not installed or not running on this system."
- action={<button className="btn btn-primary"><RefreshCw size={16} /> Retry Connection</button>}
+ action={<Button><RefreshCw size={16} /> Retry Connection</Button>}
/>
<SectionTitle title="Large — Loading" />
@@ -906,7 +913,7 @@ export default function StyleGuide() {
<div className="card" style={{ padding: 24 }}>
<div className="card-header">
<h3>Scan History</h3>
- <button className="btn btn-sm btn-secondary">Refresh</button>
+ <Button size="sm" variant="outline">Refresh</Button>
</div>
<div className="card-body">
<EmptyState
@@ -919,10 +926,10 @@ export default function StyleGuide() {
<SectionTitle title="Context Grid" />
<div className="grid grid-cols-2 gap-4">
- <EmptyState icon={Database} title="No databases" description="Create your first database." action={<button className="btn btn-primary btn-sm"><Plus size={14} /> Create</button>} />
- <EmptyState icon={Globe} title="No domains configured" description="Add a domain to get started." action={<button className="btn btn-primary btn-sm"><Plus size={14} /> Add Domain</button>} />
- <EmptyState icon={Key} title="No SSH keys" description="Add an SSH key for secure access." action={<button className="btn btn-primary btn-sm"><Plus size={14} /> Add Key</button>} />
- <EmptyState icon={Shield} title="No scan history" description="Run a scan to check for threats." action={<button className="btn btn-primary btn-sm"><Activity size={14} /> Scan</button>} />
+ <EmptyState icon={Database} title="No databases" description="Create your first database." action={<Button size="sm"><Plus size={14} /> Create</Button>} />
+ <EmptyState icon={Globe} title="No domains configured" description="Add a domain to get started." action={<Button size="sm"><Plus size={14} /> Add Domain</Button>} />
+ <EmptyState icon={Key} title="No SSH keys" description="Add an SSH key for secure access." action={<Button size="sm"><Plus size={14} /> Add Key</Button>} />
+ <EmptyState icon={Shield} title="No scan history" description="Run a scan to check for threats." action={<Button size="sm"><Activity size={14} /> Scan</Button>} />
</div>
</div>
)}
@@ -939,8 +946,8 @@ export default function StyleGuide() {
<p className="subtitle">Description of the page</p>
</div>
<div className="flex gap-2">
- <button className="btn btn-secondary"><RefreshCw size={16} /> Refresh</button>
- <button className="btn btn-primary"><Plus size={16} /> Create</button>
+ <Button variant="outline"><RefreshCw size={16} /> Refresh</Button>
+ <Button><Plus size={16} /> Create</Button>
</div>
</div>
</div>
@@ -952,7 +959,7 @@ export default function StyleGuide() {
<h1>Services</h1>
<p className="subtitle">12 services &middot; 9 live</p>
</div>
- <button className="btn btn-primary"><Plus size={16} /> New Service</button>
+ <Button><Plus size={16} /> New Service</Button>
</div>
</div>
@@ -964,8 +971,8 @@ export default function StyleGuide() {
<p className="subtitle">Self-hosted Git repository management</p>
</div>
<div className="flex gap-2">
- <button className="btn btn-secondary"><ExternalLink size={16} /> Open Gitea</button>
- <button className="btn btn-danger">Stop Server</button>
+ <Button variant="outline"><ExternalLink size={16} /> Open Gitea</Button>
+ <Button variant="destructive">Stop Server</Button>
</div>
</div>
</div>
@@ -976,8 +983,8 @@ export default function StyleGuide() {
<div className="card-header">
<h3>Card Section Title</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-primary">Add</button>
- <button className="btn btn-sm btn-secondary">Refresh</button>
+ <Button size="sm">Add</Button>
+ <Button size="sm" variant="outline">Refresh</Button>
</div>
</div>
<div className="card-body">
@@ -996,8 +1003,8 @@ export default function StyleGuide() {
<div className="card-header">
<h3>Authorized Keys</h3>
<div className="card-actions">
- <button className="btn btn-sm btn-primary"><Plus size={14} /> Add Key</button>
- <button className="btn btn-sm btn-secondary"><RefreshCw size={14} /></button>
+ <Button size="sm"><Plus size={14} /> Add Key</Button>
+ <Button size="sm" variant="outline"><RefreshCw size={14} /></Button>
</div>
</div>
<div className="card-body">
@@ -1010,7 +1017,7 @@ export default function StyleGuide() {
<td><code>ssh-ed25519</code></td>
<td><code>SHA256:abc123...</code></td>
<td>deploy@server</td>
- <td><button className="btn btn-sm btn-danger">Remove</button></td>
+ <td><Button size="sm" variant="destructive">Remove</Button></td>
</tr>
</tbody>
</table>
@@ -1022,7 +1029,7 @@ export default function StyleGuide() {
<div className="card" style={{ padding: 24 }}>
<div className="card-header">
<h3>Scan History</h3>
- <button className="btn btn-sm btn-secondary">Refresh</button>
+ <Button size="sm" variant="outline">Refresh</Button>
</div>
<div className="card-body">
<EmptyState
@@ -1047,7 +1054,7 @@ export default function StyleGuide() {
</div>
<h4 style={{ marginBottom: 4 }}>{item.title}</h4>
<p className="text-sm text-tertiary mb-4">{item.desc}</p>
- <button className="btn btn-primary btn-sm">Start Scan</button>
+ <Button size="sm">Start Scan</Button>
</div>
))}
</div>
@@ -1066,7 +1073,7 @@ export default function StyleGuide() {
<div className="logs-sidebar">
<div className="sidebar-header">
<h3>Log Files</h3>
- <button className="btn btn-secondary btn-sm"><RefreshCw size={14} /></button>
+ <Button size="sm" variant="outline"><RefreshCw size={14} /></Button>
</div>
<div className="log-files-list">
{[
@@ -1105,9 +1112,9 @@ export default function StyleGuide() {
<input type="checkbox" />
<span>Auto-refresh</span>
</label>
- <button className="btn btn-secondary btn-sm">Refresh</button>
- <button className="btn btn-secondary btn-sm">Download</button>
- <button className="btn btn-danger btn-sm">Clear</button>
+ <Button size="sm" variant="outline">Refresh</Button>
+ <Button size="sm" variant="outline">Download</Button>
+ <Button size="sm" variant="destructive">Clear</Button>
</div>
</div>
<div className="log-content">
@@ -1140,7 +1147,7 @@ export default function StyleGuide() {
<label>Priority</label>
<select><option>All</option><option>Error</option><option>Warning</option></select>
</div>
- <button className="btn btn-primary">Load Logs</button>
+ <Button>Load Logs</Button>
</div>
</div>
@@ -1187,11 +1194,11 @@ export default function StyleGuide() {
<span>{p.mem.toFixed(1)}%</span>
</div>
</td>
- <td><span className={`badge badge-${p.status === 'running' ? 'success' : 'warning'}`}>{p.status}</span></td>
+ <td><Badge variant={p.status === 'running' ? 'success' : 'warning'}>{p.status}</Badge></td>
<td>
<div className="action-buttons">
- <button className="btn btn-secondary btn-xs"><XCircle size={12} /></button>
- <button className="btn btn-danger btn-xs"><AlertTriangle size={12} /></button>
+ <Button size="icon" variant="outline"><XCircle size={12} /></Button>
+ <Button size="icon" variant="destructive"><AlertTriangle size={12} /></Button>
</div>
</td>
</tr>
@@ -1205,7 +1212,7 @@ export default function StyleGuide() {
<div className="process-details-panel">
<div className="panel-header">
<h3>Process Details</h3>
- <button className="btn btn-secondary btn-sm">Close</button>
+ <Button size="sm" variant="outline">Close</Button>
</div>
<div className="panel-body">
<div className="details-grid">
@@ -1242,7 +1249,7 @@ export default function StyleGuide() {
<span className={`status-dot ${s.status === 'running' ? 'success' : 'secondary'}`} />
<h4>{s.name}</h4>
</div>
- <span className={`badge badge-${s.status === 'running' ? 'success' : 'default'}`}>{s.status}</span>
+ <Badge variant={s.status === 'running' ? 'success' : 'secondary'}>{s.status}</Badge>
</div>
<p className="service-description">{s.desc}</p>
<div className="service-meta">
@@ -1252,13 +1259,13 @@ export default function StyleGuide() {
<div className="service-actions">
{s.status === 'running' ? (
<>
- <button className="btn btn-secondary btn-sm">Restart</button>
- <button className="btn btn-secondary btn-sm">Stop</button>
+ <Button size="sm" variant="outline">Restart</Button>
+ <Button size="sm" variant="outline">Stop</Button>
</>
) : (
- <button className="btn btn-primary btn-sm">Start</button>
+ <Button size="sm">Start</Button>
)}
- <button className="btn btn-secondary btn-sm">Logs</button>
+ <Button size="sm" variant="outline">Logs</Button>
</div>
</div>
))}
diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsx
index 36e172cf..3293593d 100644
--- a/frontend/src/pages/Templates.jsx
+++ b/frontend/src/pages/Templates.jsx
@@ -9,6 +9,8 @@ import {
} from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
// Featured templates (curated list)
const FEATURED_TEMPLATES = [
@@ -309,16 +311,16 @@ const Templates = () => {
<div className="templates-filters">
<div className="search-box">
<Search size={18} className="search-icon" />
- <input
+ <Input
type="text"
placeholder="Search templates..."
value={searchQuery}
onChange={(e) => setSearchQueryFilter(e.target.value)}
/>
{searchQuery && (
- <button className="search-clear" onClick={() => setSearchQueryFilter('')}>
+ <Button variant="ghost" size="icon" className="search-clear" onClick={() => setSearchQueryFilter('')}>
<X size={16} />
- </button>
+ </Button>
)}
</div>
<div className="category-filters">
@@ -361,9 +363,9 @@ const Templates = () => {
</button>
</span>
)}
- <button className="clear-all-btn" onClick={clearAllFilters}>
+ <Button variant="ghost" size="sm" className="clear-all-btn" onClick={clearAllFilters}>
Clear All
- </button>
+ </Button>
</div>
)}
@@ -390,9 +392,9 @@ const Templates = () => {
<Layers size={48} />
<p>No templates found</p>
{hasActiveFilters && (
- <button className="btn btn-secondary btn-sm" onClick={clearAllFilters}>
+ <Button variant="outline" size="sm" onClick={clearAllFilters}>
Clear Filters
- </button>
+ </Button>
)}
</div>
) : (
@@ -456,13 +458,17 @@ const Templates = () => {
<div className="template-links">
{selectedTemplate.website && (
- <a href={selectedTemplate.website} target="_blank" rel="noopener noreferrer" className="btn btn-secondary btn-sm">
- <ExternalLink size={14} /> Website
+ <a href={selectedTemplate.website} target="_blank" rel="noopener noreferrer">
+ <Button variant="outline" size="sm">
+ <ExternalLink size={14} /> Website
+ </Button>
</a>
)}
{selectedTemplate.documentation && (
- <a href={selectedTemplate.documentation} target="_blank" rel="noopener noreferrer" className="btn btn-secondary btn-sm">
- <BookOpen size={14} /> Documentation
+ <a href={selectedTemplate.documentation} target="_blank" rel="noopener noreferrer">
+ <Button variant="outline" size="sm">
+ <BookOpen size={14} /> Documentation
+ </Button>
</a>
)}
</div>
@@ -546,7 +552,9 @@ const Templates = () => {
<div className="detail-section">
<h4>
<Container size={16} /> Docker Compose
- <button
+ <Button
+ variant="ghost"
+ size="icon"
className="copy-btn"
onClick={() => {
navigator.clipboard.writeText('docker-compose.yml available after install');
@@ -555,7 +563,7 @@ const Templates = () => {
}}
>
{copiedCompose ? <Check size={14} /> : <Copy size={14} />}
- </button>
+ </Button>
</h4>
<div className="compose-preview">
<code>Docker Compose configuration will be generated during installation</code>
@@ -565,17 +573,16 @@ const Templates = () => {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setSelectedTemplate(null)}>
+ <Button variant="outline" onClick={() => setSelectedTemplate(null)}>
Close
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={() => {
setShowInstallModal(true);
}}
>
Install Template
- </button>
+ </Button>
</div>
</div>
</div>
@@ -732,7 +739,7 @@ const InstallModal = ({ template, onClose, onSuccess }) => {
<div className="form-group">
<label>Application Name *</label>
- <input
+ <Input
type="text"
value={appName}
onChange={(e) => setAppName(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g, ''))}
@@ -779,7 +786,7 @@ const InstallModal = ({ template, onClose, onSuccess }) => {
))}
</select>
) : variable.type === 'password' ? (
- <input
+ <Input
type="password"
value={variables[variable.name] || ''}
onChange={(e) => setVariables({...variables, [variable.name]: e.target.value})}
@@ -787,7 +794,7 @@ const InstallModal = ({ template, onClose, onSuccess }) => {
required={variable.required && !variable.default}
/>
) : (
- <input
+ <Input
type={variable.type === 'port' ? 'number' : 'text'}
value={variables[variable.name] || ''}
onChange={(e) => setVariables({...variables, [variable.name]: e.target.value})}
@@ -825,12 +832,12 @@ const InstallModal = ({ template, onClose, onSuccess }) => {
)}
</div>
<div className="modal-footer">
- <button type="button" className="btn btn-secondary" onClick={onClose} disabled={installing}>
+ <Button type="button" variant="outline" onClick={onClose} disabled={installing}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={installing}>
+ </Button>
+ <Button type="submit" disabled={installing}>
{installing ? 'Installing...' : 'Install'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsx
index 68a6a095..94a166db 100644
--- a/frontend/src/pages/Terminal.jsx
+++ b/frontend/src/pages/Terminal.jsx
@@ -4,6 +4,10 @@ import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { useConfirm } from '../hooks/useConfirm';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Badge } from '@/components/ui/badge';
+import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';
const VALID_TABS = ['logs', 'journal', 'processes', 'services'];
@@ -19,60 +23,58 @@ const Terminal = () => {
</div>
</div>
- <div className="tabs">
- <button
- className={`tab ${activeTab === 'logs' ? 'active' : ''}`}
- onClick={() => setActiveTab('logs')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16">
- <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
- <polyline points="14 2 14 8 20 8"/>
- <line x1="16" y1="13" x2="8" y2="13"/>
- <line x1="16" y1="17" x2="8" y2="17"/>
- </svg>
- Log Files
- </button>
- <button
- className={`tab ${activeTab === 'journal' ? 'active' : ''}`}
- onClick={() => setActiveTab('journal')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16">
- <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
- <line x1="9" y1="9" x2="15" y2="9"/>
- <line x1="9" y1="13" x2="15" y2="13"/>
- <line x1="9" y1="17" x2="11" y2="17"/>
- </svg>
- System Journal
- </button>
- <button
- className={`tab ${activeTab === 'processes' ? 'active' : ''}`}
- onClick={() => setActiveTab('processes')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16">
- <rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
- <line x1="8" y1="21" x2="16" y2="21"/>
- <line x1="12" y1="17" x2="12" y2="21"/>
- </svg>
- Processes
- </button>
- <button
- className={`tab ${activeTab === 'services' ? 'active' : ''}`}
- onClick={() => setActiveTab('services')}
- >
- <svg viewBox="0 0 24 24" width="16" height="16">
- <circle cx="12" cy="12" r="3"/>
- <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
- </svg>
- Services
- </button>
- </div>
-
- <div className="tab-content">
- {activeTab === 'logs' && <LogFilesTab />}
- {activeTab === 'journal' && <JournalTab />}
- {activeTab === 'processes' && <ProcessesTab />}
- {activeTab === 'services' && <ServicesTab />}
- </div>
+ <Tabs value={activeTab} onValueChange={setActiveTab}>
+ <TabsList>
+ <TabsTrigger value="logs">
+ <svg viewBox="0 0 24 24" width="16" height="16">
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"/>
+ <polyline points="14 2 14 8 20 8"/>
+ <line x1="16" y1="13" x2="8" y2="13"/>
+ <line x1="16" y1="17" x2="8" y2="17"/>
+ </svg>
+ Log Files
+ </TabsTrigger>
+ <TabsTrigger value="journal">
+ <svg viewBox="0 0 24 24" width="16" height="16">
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
+ <line x1="9" y1="9" x2="15" y2="9"/>
+ <line x1="9" y1="13" x2="15" y2="13"/>
+ <line x1="9" y1="17" x2="11" y2="17"/>
+ </svg>
+ System Journal
+ </TabsTrigger>
+ <TabsTrigger value="processes">
+ <svg viewBox="0 0 24 24" width="16" height="16">
+ <rect x="2" y="3" width="20" height="14" rx="2" ry="2"/>
+ <line x1="8" y1="21" x2="16" y2="21"/>
+ <line x1="12" y1="17" x2="12" y2="21"/>
+ </svg>
+ Processes
+ </TabsTrigger>
+ <TabsTrigger value="services">
+ <svg viewBox="0 0 24 24" width="16" height="16">
+ <circle cx="12" cy="12" r="3"/>
+ <path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"/>
+ </svg>
+ Services
+ </TabsTrigger>
+ </TabsList>
+
+ <div className="tab-content">
+ <TabsContent value="logs">
+ <LogFilesTab />
+ </TabsContent>
+ <TabsContent value="journal">
+ <JournalTab />
+ </TabsContent>
+ <TabsContent value="processes">
+ <ProcessesTab />
+ </TabsContent>
+ <TabsContent value="services">
+ <ServicesTab />
+ </TabsContent>
+ </div>
+ </Tabs>
</div>
);
};
@@ -202,12 +204,12 @@ const LogFilesTab = () => {
<div className="logs-sidebar">
<div className="sidebar-header">
<h3>Log Files</h3>
- <button className="btn btn-secondary btn-sm" onClick={loadLogFiles}>
+ <Button variant="outline" size="sm" onClick={loadLogFiles}>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polyline points="23 4 23 10 17 10"/>
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
- </button>
+ </Button>
</div>
<div className="log-files-list">
{logFiles.length === 0 ? (
@@ -244,7 +246,7 @@ const LogFilesTab = () => {
<circle cx="11" cy="11" r="8"/>
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
- <input
+ <Input
type="text"
value={searchPattern}
onChange={(e) => setSearchPattern(e.target.value)}
@@ -273,27 +275,30 @@ const LogFilesTab = () => {
/>
<span>Auto-refresh</span>
</label>
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => selectedLog && loadLogContent(selectedLog)}
disabled={!selectedLog || loadingContent}
>
Refresh
- </button>
- <button
- className="btn btn-secondary btn-sm"
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={handleDownload}
disabled={!logContent}
>
Download
- </button>
- <button
- className="btn btn-danger btn-sm"
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
onClick={handleClearLog}
disabled={!selectedLog}
>
Clear
- </button>
+ </Button>
</div>
</div>
@@ -398,7 +403,7 @@ const JournalTab = () => {
<div className="control-group">
<label>{isJournalctl ? 'Service/Unit' : 'Filter by service'}</label>
<div className="input-with-suggestions">
- <input
+ <Input
type="text"
value={unit}
onChange={(e) => setUnit(e.target.value)}
@@ -447,9 +452,9 @@ const JournalTab = () => {
</div>
)}
- <button className="btn btn-primary" onClick={loadJournalLogs} disabled={loading}>
+ <Button onClick={loadJournalLogs} disabled={loading}>
{loading ? 'Loading...' : 'Load Logs'}
- </button>
+ </Button>
</div>
{!isJournalctl && source && (
@@ -533,7 +538,7 @@ const ProcessesTab = () => {
<circle cx="11" cy="11" r="8"/>
<line x1="21" y1="21" x2="16.65" y2="16.65"/>
</svg>
- <input
+ <Input
type="text"
value={searchTerm}
onChange={(e) => setSearchTerm(e.target.value)}
@@ -553,9 +558,9 @@ const ProcessesTab = () => {
<option value={50}>50 processes</option>
<option value={100}>100 processes</option>
</select>
- <button className="btn btn-secondary btn-sm" onClick={loadProcesses}>
+ <Button variant="outline" size="sm" onClick={loadProcesses}>
Refresh
- </button>
+ </Button>
</div>
</div>
@@ -607,14 +612,15 @@ const ProcessesTab = () => {
</td>
<td>{formatMemory(process.memory_info?.rss)}</td>
<td>
- <span className={`badge badge-${getStatusClass(process.status)}`}>
+ <Badge variant={getStatusVariant(process.status)}>
{process.status}
- </span>
+ </Badge>
</td>
<td>
<div className="action-buttons">
- <button
- className="btn btn-secondary btn-xs"
+ <Button
+ variant="outline"
+ size="sm"
onClick={(e) => {
e.stopPropagation();
handleKillProcess(process.pid);
@@ -625,9 +631,10 @@ const ProcessesTab = () => {
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
- </button>
- <button
- className="btn btn-danger btn-xs"
+ </Button>
+ <Button
+ variant="destructive"
+ size="sm"
onClick={(e) => {
e.stopPropagation();
handleKillProcess(process.pid, true);
@@ -639,7 +646,7 @@ const ProcessesTab = () => {
<line x1="15" y1="9" x2="9" y2="15"/>
<line x1="9" y1="9" x2="15" y2="15"/>
</svg>
- </button>
+ </Button>
</div>
</td>
</tr>
@@ -652,9 +659,9 @@ const ProcessesTab = () => {
<div className="process-details-panel">
<div className="panel-header">
<h3>Process Details</h3>
- <button className="btn btn-secondary btn-sm" onClick={() => setSelectedProcess(null)}>
+ <Button variant="outline" size="sm" onClick={() => setSelectedProcess(null)}>
Close
- </button>
+ </Button>
</div>
<div className="panel-body">
<div className="details-grid">
@@ -766,10 +773,10 @@ const ServicesTab = () => {
}
}
- function getServiceStatusClass(status) {
+ function getServiceStatusVariant(status) {
if (status === 'running' || status === 'active') return 'success';
if (status === 'stopped' || status === 'inactive') return 'secondary';
- if (status === 'failed') return 'danger';
+ if (status === 'failed') return 'destructive';
return 'warning';
}
@@ -780,13 +787,13 @@ const ServicesTab = () => {
return (
<div className="services-container">
<div className="services-toolbar">
- <button className="btn btn-secondary btn-sm" onClick={loadServices}>
+ <Button variant="outline" size="sm" onClick={loadServices}>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<polyline points="23 4 23 10 17 10"/>
<path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
</svg>
Refresh
- </button>
+ </Button>
</div>
<div className="services-grid">
@@ -799,12 +806,12 @@ const ServicesTab = () => {
<div key={service.name} className="service-card">
<div className="service-header">
<div className="service-info">
- <span className={`status-dot ${getServiceStatusClass(service.status)}`} />
+ <span className={`status-dot ${getServiceStatusVariant(service.status)}`} />
<h4>{service.name}</h4>
</div>
- <span className={`badge badge-${getServiceStatusClass(service.status)}`}>
+ <Badge variant={getServiceStatusVariant(service.status)}>
{service.status}
- </span>
+ </Badge>
</div>
{service.description && (
@@ -827,36 +834,39 @@ const ServicesTab = () => {
<div className="service-actions">
{service.status === 'running' || service.status === 'active' ? (
<>
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleServiceAction(service.name, 'restart')}
disabled={actionLoading === `${service.name}-restart`}
>
{actionLoading === `${service.name}-restart` ? '...' : 'Restart'}
- </button>
- <button
- className="btn btn-secondary btn-sm"
+ </Button>
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => handleServiceAction(service.name, 'stop')}
disabled={actionLoading === `${service.name}-stop`}
>
{actionLoading === `${service.name}-stop` ? '...' : 'Stop'}
- </button>
+ </Button>
</>
) : (
- <button
- className="btn btn-primary btn-sm"
+ <Button
+ size="sm"
onClick={() => handleServiceAction(service.name, 'start')}
disabled={actionLoading === `${service.name}-start`}
>
{actionLoading === `${service.name}-start` ? '...' : 'Start'}
- </button>
+ </Button>
)}
- <button
- className="btn btn-secondary btn-sm"
+ <Button
+ variant="outline"
+ size="sm"
onClick={() => viewServiceLogs(service.name)}
>
Logs
- </button>
+ </Button>
</div>
</div>
))
@@ -877,9 +887,9 @@ const ServicesTab = () => {
</div>
</div>
<div className="modal-footer">
- <button className="btn btn-secondary" onClick={() => setShowLogsModal(false)}>
+ <Button variant="outline" onClick={() => setShowLogsModal(false)}>
Close
- </button>
+ </Button>
</div>
</div>
</div>
@@ -900,14 +910,14 @@ function formatMemory(bytes) {
return `${bytes.toFixed(1)} ${units[i]}`;
}
-function getStatusClass(status) {
+function getStatusVariant(status) {
switch (status?.toLowerCase()) {
case 'running':
case 'sleeping':
return 'success';
case 'stopped':
case 'zombie':
- return 'danger';
+ return 'destructive';
case 'idle':
case 'disk-sleep':
return 'warning';
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index 4049ca96..da1eb2a5 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -5,6 +5,10 @@ import { useToast } from '../contexts/ToastContext';
import { useResourceTier } from '../contexts/ResourceTierContext';
import ResourceGate from '../components/ResourceGate';
import Spinner from '../components/Spinner';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Badge } from '@/components/ui/badge';
function WordPress() {
const [sites, setSites] = useState([]);
@@ -114,10 +118,10 @@ function WordPress() {
<p className="page-description">Manage your WordPress sites</p>
</div>
<div className="page-header-actions">
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>
Create Site
- </button>
+ </Button>
</div>
</div>
@@ -132,9 +136,9 @@ function WordPress() {
</div>
<h2>No WordPress Sites</h2>
<p>Create your first WordPress site powered by Docker. Each site gets its own isolated environment with MySQL.</p>
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
Create Site
- </button>
+ </Button>
</div>
) : (
<div className="wp-sites-grid">
@@ -228,10 +232,10 @@ function WordPress() {
</div>
<div className="form-group">
- <label>
+ <Label>
Site Name <span className="required">*</span>
- </label>
- <input
+ </Label>
+ <Input
type="text"
value={createForm.name}
onChange={e => setCreateForm({ ...createForm, name: e.target.value })}
@@ -242,8 +246,8 @@ function WordPress() {
</div>
<div className="form-group">
- <label>Admin Email</label>
- <input
+ <Label>Admin Email</Label>
+ <Input
type="email"
value={createForm.adminEmail}
onChange={e => setCreateForm({ ...createForm, adminEmail: e.target.value })}
@@ -253,20 +257,19 @@ function WordPress() {
</div>
</div>
<div className="modal-footer">
- <button
- className="btn btn-secondary"
+ <Button
+ variant="outline"
onClick={() => setShowCreateModal(false)}
disabled={createLoading}
>
Cancel
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={handleCreate}
disabled={createLoading || !createForm.name}
>
{createLoading ? <><Spinner size="sm" /> Creating...</> : 'Create Site'}
- </button>
+ </Button>
</div>
</div>
</div>
diff --git a/frontend/src/pages/WordPressDetail.jsx b/frontend/src/pages/WordPressDetail.jsx
index 6b7feb85..adfef93c 100644
--- a/frontend/src/pages/WordPressDetail.jsx
+++ b/frontend/src/pages/WordPressDetail.jsx
@@ -6,6 +6,10 @@ import wordpressApi from '../services/wordpress';
import { useToast } from '../contexts/ToastContext';
import { EnvironmentCard, SnapshotTable, GitConnectForm, CommitList } from '../components/wordpress';
import { ErrorBoundary, ErrorState } from '../components/ErrorBoundary';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
+import { Textarea } from '@/components/ui/textarea';
// Detail Page Skeleton for initial loading
const DetailPageSkeleton = () => (
@@ -94,9 +98,9 @@ const WordPressDetail = () => {
return (
<div className="empty-state">
<h3>Site not found</h3>
- <button className="btn btn-primary" onClick={() => navigate('/wordpress')}>
+ <Button onClick={() => navigate('/wordpress')}>
Back to WordPress Sites
- </button>
+ </Button>
</div>
);
}
@@ -115,24 +119,26 @@ const WordPressDetail = () => {
<div className="app-detail-actions">
{site.url && (
<>
- <a
- href={site.url}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-ghost"
- >
- <ExternalLink size={16} />
- Visit Site
- </a>
- <a
- href={`${site.url}/wp-admin`}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-ghost"
- >
- <Settings size={16} />
- Dashboard
- </a>
+ <Button variant="ghost" asChild>
+ <a
+ href={site.url}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <ExternalLink size={16} />
+ Visit Site
+ </a>
+ </Button>
+ <Button variant="ghost" asChild>
+ <a
+ href={`${site.url}/wp-admin`}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <Settings size={16} />
+ Dashboard
+ </a>
+ </Button>
</>
)}
</div>
@@ -592,9 +598,9 @@ const EnvironmentsTab = ({ siteId, site, onUpdate }) => {
<div className="section-header">
<h3>Environments</h3>
{canCreateMore && (
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
<Plus size={14} /> Create Environment
- </button>
+ </Button>
)}
</div>
@@ -706,7 +712,7 @@ const CreateEnvironmentModal = ({ onClose, onCreate, productionDomain, hasStagin
<form onSubmit={handleSubmit}>
<div className="form-group">
- <label>Environment Type</label>
+ <Label>Environment Type</Label>
<select name="type" value={formData.type} onChange={handleChange}>
{!hasDev && <option value="development">Development</option>}
{!hasStaging && <option value="staging">Staging</option>}
@@ -714,8 +720,8 @@ const CreateEnvironmentModal = ({ onClose, onCreate, productionDomain, hasStagin
</div>
<div className="form-group">
- <label>Environment Name *</label>
- <input
+ <Label>Environment Name *</Label>
+ <Input
type="text"
name="name"
value={formData.name}
@@ -726,8 +732,8 @@ const CreateEnvironmentModal = ({ onClose, onCreate, productionDomain, hasStagin
</div>
<div className="form-group">
- <label>Domain</label>
- <input
+ <Label>Domain</Label>
+ <Input
type="text"
name="domain"
value={formData.domain}
@@ -764,7 +770,7 @@ const CreateEnvironmentModal = ({ onClose, onCreate, productionDomain, hasStagin
</div>
<div className="form-group">
- <label>Sync Schedule (optional)</label>
+ <Label>Sync Schedule (optional)</Label>
<select name="syncSchedule" value={formData.syncSchedule} onChange={handleChange}>
<option value="">No automatic sync</option>
<option value="0 3 * * 0">Weekly (Sunday 3am)</option>
@@ -774,12 +780,12 @@ const CreateEnvironmentModal = ({ onClose, onCreate, productionDomain, hasStagin
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Environment'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -896,9 +902,9 @@ const DatabaseTab = ({ siteId, site }) => {
{/* Snapshots */}
<div className="section-header mt-6">
<h3>Database Snapshots</h3>
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
<Plus size={14} /> Create Snapshot
- </button>
+ </Button>
</div>
<SnapshotTable
@@ -952,8 +958,8 @@ const CreateSnapshotModal = ({ onClose, onCreate }) => {
<form onSubmit={handleSubmit}>
<div className="form-group">
- <label>Snapshot Name *</label>
- <input
+ <Label>Snapshot Name *</Label>
+ <Input
type="text"
name="name"
value={formData.name}
@@ -963,8 +969,8 @@ const CreateSnapshotModal = ({ onClose, onCreate }) => {
</div>
<div className="form-group">
- <label>Description</label>
- <textarea
+ <Label>Description</Label>
+ <Textarea
name="description"
value={formData.description}
onChange={handleChange}
@@ -974,8 +980,8 @@ const CreateSnapshotModal = ({ onClose, onCreate }) => {
</div>
<div className="form-group">
- <label>Tag</label>
- <input
+ <Label>Tag</Label>
+ <Input
type="text"
name="tag"
value={formData.tag}
@@ -985,12 +991,12 @@ const CreateSnapshotModal = ({ onClose, onCreate }) => {
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose}>
+ <Button type="button" variant="outline" onClick={onClose}>
Cancel
- </button>
- <button type="submit" className="btn btn-primary" disabled={loading}>
+ </Button>
+ <Button type="submit" disabled={loading}>
{loading ? 'Creating...' : 'Create Snapshot'}
- </button>
+ </Button>
</div>
</form>
</div>
@@ -1075,15 +1081,15 @@ const PluginsTab = ({ siteId }) => {
</div>
<form className="install-form" onSubmit={handleInstall}>
- <input
+ <Input
type="text"
value={newPlugin}
onChange={(e) => setNewPlugin(e.target.value)}
placeholder="Plugin slug (e.g., akismet, woocommerce)"
/>
- <button type="submit" className="btn btn-primary" disabled={installing}>
+ <Button type="submit" disabled={installing}>
{installing ? 'Installing...' : 'Install Plugin'}
- </button>
+ </Button>
</form>
<div className="plugins-list">
@@ -1184,15 +1190,15 @@ const ThemesTab = ({ siteId }) => {
</div>
<form className="install-form" onSubmit={handleInstall}>
- <input
+ <Input
type="text"
value={newTheme}
onChange={(e) => setNewTheme(e.target.value)}
placeholder="Theme slug (e.g., twentytwentyfour)"
/>
- <button type="submit" className="btn btn-primary" disabled={installing}>
+ <Button type="submit" disabled={installing}>
{installing ? 'Installing...' : 'Install Theme'}
- </button>
+ </Button>
</form>
<div className="themes-list">
@@ -1316,9 +1322,9 @@ const GitTab = ({ siteId, site, onUpdate }) => {
<div className="git-commits-section">
<div className="section-header">
<h3>Recent Commits</h3>
- <button className="btn btn-secondary btn-sm" onClick={loadGitData}>
+ <Button variant="outline" size="sm" onClick={loadGitData}>
<RefreshCw size={14} /> Refresh
- </button>
+ </Button>
</div>
<CommitList
@@ -1392,9 +1398,9 @@ const BackupsTab = ({ siteId }) => {
<div className="backups-tab">
<div className="section-header">
<h3>Backups</h3>
- <button className="btn btn-primary" onClick={handleCreateBackup}>
+ <Button onClick={handleCreateBackup}>
<Plus size={14} /> Create Backup
- </button>
+ </Button>
</div>
<SnapshotTable
diff --git a/frontend/src/pages/WordPressProject.jsx b/frontend/src/pages/WordPressProject.jsx
index 37c22a19..4d495921 100644
--- a/frontend/src/pages/WordPressProject.jsx
+++ b/frontend/src/pages/WordPressProject.jsx
@@ -22,6 +22,9 @@ import {
import { ConfirmDialog } from '../components/ConfirmDialog';
import Spinner from '../components/Spinner';
import { io } from 'socket.io-client';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Label } from '@/components/ui/label';
const SOCKET_URL = import.meta.env.VITE_API_URL?.replace('/api/v1', '') || 'http://localhost:5000';
@@ -381,9 +384,9 @@ const WordPressProject = () => {
return (
<div className="empty-state">
<h3>Project not found</h3>
- <button className="btn btn-primary" onClick={() => navigate('/wordpress/projects')}>
+ <Button onClick={() => navigate('/wordpress/projects')}>
Back to Projects
- </button>
+ </Button>
</div>
);
}
@@ -403,31 +406,31 @@ const WordPressProject = () => {
</div>
<div className="app-detail-actions">
{projectDomain && (
- <a
- href={projectDomain.startsWith('http') ? projectDomain : `https://${projectDomain}`}
- target="_blank"
- rel="noopener noreferrer"
- className="btn btn-ghost"
- >
- <ExternalLink size={16} />
- Visit Site
- </a>
+ <Button variant="ghost" asChild>
+ <a
+ href={projectDomain.startsWith('http') ? projectDomain : `https://${projectDomain}`}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ <ExternalLink size={16} />
+ Visit Site
+ </a>
+ </Button>
)}
- <button
- className="btn btn-ghost"
+ <Button
+ variant="ghost"
onClick={() => setShowSanitizationProfiles(true)}
title="Manage sanitization profiles"
>
<Shield size={16} />
Profiles
- </button>
- <button
- className="btn btn-primary"
+ </Button>
+ <Button
onClick={() => setShowCreateEnvModal(true)}
>
<Plus size={16} />
New Environment
- </button>
+ </Button>
</div>
</div>
@@ -561,12 +564,13 @@ const WordPressProject = () => {
<div className="pipeline-activity-preview">
<div className="section-header">
<h3>Recent Activity</h3>
- <button
- className="btn btn-ghost btn-sm"
+ <Button
+ variant="ghost"
+ size="sm"
onClick={() => setActiveTab('activity')}
>
View All
- </button>
+ </Button>
</div>
<ActivityFeed projectId={id} limit={5} compact />
</div>
@@ -577,9 +581,9 @@ const WordPressProject = () => {
<div className="activity-tab">
<div className="section-header">
<h3>Activity Log</h3>
- <button className="btn btn-ghost btn-sm" onClick={loadPipeline}>
+ <Button variant="ghost" size="sm" onClick={loadPipeline}>
<RefreshCw size={14} /> Refresh
- </button>
+ </Button>
</div>
<ActivityFeed projectId={id} limit={50} />
</div>
@@ -780,7 +784,7 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
<form onSubmit={handleSubmit}>
<div className="form-group">
- <label>Environment Type</label>
+ <Label>Environment Type</Label>
<select name="type" value={formData.type} onChange={handleChange}>
{availableTypes.map(t => (
<option key={t.value} value={t.value} disabled={t.disabled}>
@@ -792,22 +796,23 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
{formData.type === 'multidev' && (
<div className="form-group">
- <label>
+ <Label>
<GitBranch size={14} className="mr-1" style={{ verticalAlign: -2 }} />
Git Branch *
- </label>
+ </Label>
{formData.branch && !useCustomBranch && (
<div className="branch-selected">
<GitBranch size={14} />
<span className="branch-selected-name">{formData.branch}</span>
- <button
+ <Button
type="button"
- className="btn btn-ghost btn-sm"
+ variant="ghost"
+ size="sm"
onClick={() => setFormData(prev => ({ ...prev, branch: '' }))}
>
Change
- </button>
+ </Button>
</div>
)}
@@ -822,7 +827,7 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
<div className="branch-picker">
<div className="branch-picker-search">
<Search size={14} />
- <input
+ <Input
type="text"
value={branchSearch}
onChange={e => setBranchSearch(e.target.value)}
@@ -860,17 +865,19 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
</div>
)}
</div>
- <button
+ <Button
type="button"
- className="btn btn-ghost btn-sm branch-picker-custom"
+ variant="ghost"
+ size="sm"
+ className="branch-picker-custom"
onClick={() => setUseCustomBranch(true)}
>
Enter branch name manually
- </button>
+ </Button>
</div>
) : (
<div>
- <input
+ <Input
type="text"
name="branch"
value={formData.branch}
@@ -886,7 +893,7 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
{useCustomBranch && (
<div>
- <input
+ <Input
type="text"
name="branch"
value={formData.branch}
@@ -896,13 +903,15 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
autoFocus
/>
{branches.length > 0 && (
- <button
+ <Button
type="button"
- className="btn btn-ghost btn-sm mt-1"
+ variant="ghost"
+ size="sm"
+ className="mt-1"
onClick={() => { setUseCustomBranch(false); setFormData(prev => ({ ...prev, branch: '' })); }}
>
Back to branch list
- </button>
+ </Button>
)}
</div>
)}
@@ -910,8 +919,8 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
)}
<div className="form-group">
- <label>Environment Name</label>
- <input
+ <Label>Environment Name</Label>
+ <Input
type="text"
name="name"
value={formData.name}
@@ -935,16 +944,15 @@ const CreatePipelineEnvModal = ({ onClose, onCreate, productionDomain, existingT
</div>
<div className="modal-actions">
- <button type="button" className="btn btn-secondary" onClick={onClose} disabled={loading}>
+ <Button type="button" variant="outline" onClick={onClose} disabled={loading}>
Cancel
- </button>
- <button
+ </Button>
+ <Button
type="submit"
- className="btn btn-primary"
disabled={loading || (formData.type === 'multidev' && !formData.branch)}
>
{loading ? <><Spinner size="sm" /> Creating...</> : 'Create Environment'}
- </button>
+ </Button>
</div>
</form>
</div>
diff --git a/frontend/src/pages/WordPressProjects.jsx b/frontend/src/pages/WordPressProjects.jsx
index 97a658e2..2a3ef3c5 100644
--- a/frontend/src/pages/WordPressProjects.jsx
+++ b/frontend/src/pages/WordPressProjects.jsx
@@ -4,6 +4,7 @@ import { ExternalLink, Plus, GitBranch, Layers } from 'lucide-react';
import wordpressApi from '../services/wordpress';
import { useToast } from '../contexts/ToastContext';
import Spinner from '../components/Spinner';
+import { Badge } from '@/components/ui/badge';
const WordPressProjects = () => {
const [projects, setProjects] = useState([]);
@@ -102,15 +103,15 @@ const ProjectCard = ({ project, onClick }) => {
</div>
{envTypes.length > 0 && (
<div className="wp-project-env-badges">
- <span className="wp-env-badge env-production">PROD</span>
+ <Badge variant="default">PROD</Badge>
{envTypes.includes('staging') && (
- <span className="wp-env-badge env-staging">STG</span>
+ <Badge variant="secondary">STG</Badge>
)}
{envTypes.includes('development') && (
- <span className="wp-env-badge env-development">DEV</span>
+ <Badge variant="outline">DEV</Badge>
)}
{envTypes.includes('multidev') && (
- <span className="wp-env-badge env-multidev">MD</span>
+ <Badge variant="secondary">MD</Badge>
)}
</div>
)}
diff --git a/frontend/src/pages/WorkflowBuilder.jsx b/frontend/src/pages/WorkflowBuilder.jsx
index 09639080..13bb34ef 100644
--- a/frontend/src/pages/WorkflowBuilder.jsx
+++ b/frontend/src/pages/WorkflowBuilder.jsx
@@ -34,6 +34,8 @@ import NotificationConfigPanel from '../components/workflow/panels/NotificationC
import LogicIfConfigPanel from '../components/workflow/panels/LogicIfConfigPanel';
import { isValidConnection as checkValidConnection, getConnectionError, getConnectionType } from '../utils/connectionRules';
import ConnectionEdge from '../components/workflow/ConnectionEdge';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
const initialNodes = [];
const initialEdges = [];
@@ -863,7 +865,7 @@ const WorkflowCanvas = () => {
<div className="workflow-canvas" ref={reactFlowWrapper}>
<div className="workflow-toolbar">
<div className="toolbar-left">
- <input
+ <Input
type="text"
className="workflow-name-input"
value={workflowName}
@@ -875,24 +877,30 @@ const WorkflowCanvas = () => {
)}
</div>
<div className="toolbar-right">
- <button
+ <Button
+ variant="ghost"
+ size="sm"
className="toolbar-btn"
onClick={newWorkflow}
title="New workflow"
>
<Plus size={16} />
<span>New</span>
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
className="toolbar-btn"
onClick={() => setShowLoadModal(true)}
title="Load saved workflow"
>
<FolderOpen size={16} />
<span>Load</span>
- </button>
+ </Button>
<div className="toolbar-divider" />
- <button
+ <Button
+ variant="ghost"
+ size="sm"
className="toolbar-btn toolbar-btn-execute"
onClick={executeWorkflow}
disabled={isExecuting || !currentWorkflow}
@@ -900,8 +908,10 @@ const WorkflowCanvas = () => {
>
<Play size={16} />
<span>{isExecuting ? 'Running...' : 'Execute'}</span>
- </button>
- <button
+ </Button>
+ <Button
+ variant="ghost"
+ size="sm"
className="toolbar-btn"
onClick={() => setShowHistory(true)}
disabled={!currentWorkflow}
@@ -909,9 +919,10 @@ const WorkflowCanvas = () => {
>
<Activity size={16} />
<span>History</span>
- </button>
+ </Button>
<div className="toolbar-divider" />
- <button
+ <Button
+ size="sm"
className="toolbar-btn toolbar-btn-primary"
onClick={saveWorkflow}
disabled={isSaving}
@@ -919,7 +930,7 @@ const WorkflowCanvas = () => {
>
<Save size={16} />
<span>{isSaving ? 'Saving...' : 'Save'}</span>
- </button>
+ </Button>
</div>
{saveMessage && (
<div className="toolbar-message">{saveMessage}</div>
diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsx
index 0a7002f0..3b899d92 100644
--- a/frontend/src/pages/Workspaces.jsx
+++ b/frontend/src/pages/Workspaces.jsx
@@ -4,6 +4,10 @@ import { useToast } from '../contexts/ToastContext';
import { useAuth } from '../contexts/AuthContext';
import Spinner from '../components/Spinner';
import ConfirmDialog from '../components/ConfirmDialog';
+import { Button } from '@/components/ui/button';
+import { Input } from '@/components/ui/input';
+import { Textarea } from '@/components/ui/textarea';
+import { Badge } from '@/components/ui/badge';
const Workspaces = () => {
const toast = useToast();
@@ -107,9 +111,9 @@ const Workspaces = () => {
<p className="page-description">{workspaces.length} workspace{workspaces.length !== 1 ? 's' : ''}</p>
</div>
<div className="page-header-actions">
- <button className="btn btn-primary" onClick={() => setShowCreateModal(true)}>
+ <Button onClick={() => setShowCreateModal(true)}>
Create Workspace
- </button>
+ </Button>
</div>
</div>
@@ -123,9 +127,9 @@ const Workspaces = () => {
)}
<h3>{ws.name}</h3>
</div>
- <span className={`badge badge--${ws.status === 'active' ? 'success' : 'warning'}`}>
+ <Badge variant={ws.status === 'active' ? 'success' : 'warning'}>
{ws.status}
- </span>
+ </Badge>
</div>
{ws.description && <p className="workspace-card__desc">{ws.description}</p>}
<div className="workspace-card__meta">
@@ -139,12 +143,12 @@ const Workspaces = () => {
</div>
)}
<div className="workspace-card__actions">
- <button className="btn btn-sm" onClick={() => loadMembers(ws.id)}>Members</button>
+ <Button size="sm" variant="outline" onClick={() => loadMembers(ws.id)}>Members</Button>
{ws.status === 'active' && (
- <button className="btn btn-sm btn-warning" onClick={() => handleArchive(ws.id)}>Archive</button>
+ <Button size="sm" variant="secondary" onClick={() => handleArchive(ws.id)}>Archive</Button>
)}
{user?.is_admin && (
- <button className="btn btn-sm btn-danger" onClick={() => setDeleteConfirm(ws)}>Delete</button>
+ <Button size="sm" variant="destructive" onClick={() => setDeleteConfirm(ws)}>Delete</Button>
)}
</div>
</div>
@@ -166,26 +170,26 @@ const Workspaces = () => {
<div className="modal-body">
<div className="form-group">
<label>Name</label>
- <input className="form-input" value={form.name} onChange={e => setForm({...form, name: e.target.value})} placeholder="My Team" />
+ <Input value={form.name} onChange={e => setForm({...form, name: e.target.value})} placeholder="My Team" />
</div>
<div className="form-group">
<label>Description</label>
- <textarea className="form-input" value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={2} />
+ <Textarea value={form.description} onChange={e => setForm({...form, description: e.target.value})} rows={2} />
</div>
<div className="form-row">
<div className="form-group">
<label>Max Servers (0 = unlimited)</label>
- <input className="form-input" type="number" value={form.max_servers} onChange={e => setForm({...form, max_servers: parseInt(e.target.value) || 0})} />
+ <Input type="number" value={form.max_servers} onChange={e => setForm({...form, max_servers: parseInt(e.target.value) || 0})} />
</div>
<div className="form-group">
<label>Max Users (0 = unlimited)</label>
- <input className="form-input" type="number" value={form.max_users} onChange={e => setForm({...form, max_users: parseInt(e.target.value) || 0})} />
+ <Input type="number" value={form.max_users} onChange={e => setForm({...form, max_users: parseInt(e.target.value) || 0})} />
</div>
</div>
</div>
<div className="modal-footer">
- <button className="btn" onClick={() => setShowCreateModal(false)}>Cancel</button>
- <button className="btn btn-primary" onClick={handleCreate} disabled={!form.name}>Create</button>
+ <Button variant="outline" onClick={() => setShowCreateModal(false)}>Cancel</Button>
+ <Button onClick={handleCreate} disabled={!form.name}>Create</Button>
</div>
</div>
</div>
@@ -204,10 +208,10 @@ const Workspaces = () => {
<div key={m.id} className="member-row">
<div>
<strong>{m.username || m.email}</strong>
- <span className="badge badge--outline ml-2">{m.role}</span>
+ <Badge variant="outline" className="ml-2">{m.role}</Badge>
</div>
{m.role !== 'owner' && (
- <button className="btn btn-sm btn-danger" onClick={() => handleRemoveMember(m.id)}>Remove</button>
+ <Button size="sm" variant="destructive" onClick={() => handleRemoveMember(m.id)}>Remove</Button>
)}
</div>
))}