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 GUI capture SDK; refactor UI components

Juan Denis3963321e9212
diff --git a/agent/internal/agent/agent.go b/agent/internal/agent/agent.go
index 2266aaa2..c267ae66 100644
--- a/agent/internal/agent/agent.go
+++ b/agent/internal/agent/agent.go
@@ -22,6 +22,7 @@ import (
"github.com/serverkit/agent/internal/config"
"github.com/serverkit/agent/internal/docker"
"github.com/serverkit/agent/internal/events"
+ "github.com/serverkit/agent/internal/gui"
"github.com/serverkit/agent/internal/ipc"
"github.com/serverkit/agent/internal/logger"
"github.com/serverkit/agent/internal/metrics"
@@ -48,6 +49,7 @@ type Agent struct {
ipc *ipc.Server
sampler *metricSampler
events *events.Store
+ gui *gui.SDK
// Active subscriptions
subscriptions map[string]context.CancelFunc
@@ -127,6 +129,7 @@ func New(cfg *config.Config, log *logger.Logger) (*Agent, error) {
terminal: termManager,
sampler: newMetricSampler(300), // 5 min @ 1 Hz
events: eventStore,
+ gui: gui.New(log),
subscriptions: make(map[string]context.CancelFunc),
handlers: make(map[string]CommandHandler),
startTime: time.Now(),
@@ -217,6 +220,13 @@ func (a *Agent) registerHandlers() {
// Agent commands
a.handlers[protocol.ActionAgentUpdate] = a.handleAgentUpdate
+
+ // GUI SDK — primitives that panel extensions (serverkit-gui, etc.)
+ // compose into desktop-streaming or synthetic-UI features. Always
+ // registered; the SDK reports "none" capability on hosts that can't
+ // capture, so plugins can probe instead of failing.
+ a.handlers[protocol.ActionGUICapabilities] = a.gui.HandleCapabilities
+ a.handlers[protocol.ActionGUIScreenshot] = a.gui.HandleScreenshot
}
// Run starts the agent
diff --git a/agent/internal/gui/gui.go b/agent/internal/gui/gui.go
new file mode 100644
index 00000000..f8ea4ea0
--- /dev/null
+++ b/agent/internal/gui/gui.go
@@ -0,0 +1,123 @@
+// Package gui implements the agent's GUI/desktop capability bridge.
+//
+// This is a deliberately small SDK that any panel-side extension can lean on
+// without forcing the agent to fork: the agent owns *how* a screenshot is
+// captured on each platform, and exposes a stable JSON contract through the
+// gui:screenshot and gui:capabilities actions. Plugins (e.g. serverkit-gui)
+// only deal with the contract — they never ship binaries to the agent.
+//
+// Implementation note: the platform paths shell out to OS-built-in tools
+// (PowerShell's System.Drawing on Windows, scrot/grim/import on Linux). This
+// keeps the agent dep-free and dodges cgo, at the cost of ~200ms per frame on
+// Windows. A native fast path (kbinani/screenshot) is a future optimization;
+// at the 1–2 fps the streaming UI runs at, shell-out is comfortably fast
+// enough.
+package gui
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+
+ "github.com/serverkit/agent/internal/logger"
+)
+
+// Capabilities describes what the host can do for desktop capture.
+type Capabilities struct {
+ // Capability is one of: "windows-gdi", "linux-x11", "linux-wayland",
+ // "macos-quartz", "none". Plugins gate behavior on this string.
+ Capability string `json:"capability"`
+
+ // Resolution is "WxH" of the primary display, when known.
+ Resolution string `json:"resolution,omitempty"`
+
+ // MaxFPS is what the agent recommends as a sane upper bound. The
+ // panel may run slower; it should not run faster.
+ MaxFPS int `json:"max_fps"`
+
+ // SyntheticFallback hints to the panel that no real capture is
+ // possible and it should render its synthetic UI mode.
+ SyntheticFallback bool `json:"synthetic_fallback"`
+
+ // Reason explains why Capability is "none", when applicable.
+ Reason string `json:"reason,omitempty"`
+}
+
+// ScreenshotParams are the per-frame knobs the panel can dial.
+type ScreenshotParams struct {
+ // Scale 0 < s <= 1 — server-side downscale before encoding.
+ Scale float64 `json:"scale"`
+ // Quality 10..95 for JPEG; ignored for PNG.
+ Quality int `json:"quality"`
+ // Format "jpeg" or "png". JPEG is smaller; PNG preserves text.
+ Format string `json:"format"`
+}
+
+// Frame is what we hand back. ImageBase64 is the encoded image; the rest is
+// metadata so the UI can size and timestamp the frame without decoding.
+type Frame struct {
+ ImageBase64 string `json:"image_base64"`
+ Format string `json:"format"`
+ Width int `json:"width"`
+ Height int `json:"height"`
+ CapturedAt string `json:"captured_at"`
+}
+
+// SDK is the agent-side capability bridge. One instance per agent process.
+type SDK struct {
+ log *logger.Logger
+}
+
+// New returns an initialized SDK.
+func New(log *logger.Logger) *SDK {
+ return &SDK{log: log}
+}
+
+// HandleCapabilities — wired to protocol.ActionGUICapabilities.
+func (s *SDK) HandleCapabilities(_ context.Context, _ json.RawMessage) (interface{}, error) {
+ c, err := detectCapabilities()
+ if err != nil {
+ // Capability detection isn't supposed to fail loudly; downgrade
+ // to a synthetic-fallback response so the UI degrades gracefully.
+ return Capabilities{
+ Capability: "none",
+ SyntheticFallback: true,
+ Reason: err.Error(),
+ }, nil
+ }
+ return c, nil
+}
+
+// HandleScreenshot — wired to protocol.ActionGUIScreenshot.
+func (s *SDK) HandleScreenshot(ctx context.Context, raw json.RawMessage) (interface{}, error) {
+ params := ScreenshotParams{Scale: 0.75, Quality: 70, Format: "jpeg"}
+ if len(raw) > 0 {
+ if err := json.Unmarshal(raw, &params); err != nil {
+ return nil, fmt.Errorf("invalid params: %w", err)
+ }
+ }
+ if params.Scale <= 0 || params.Scale > 1 {
+ params.Scale = 0.75
+ }
+ if params.Quality < 10 || params.Quality > 95 {
+ params.Quality = 70
+ }
+ if params.Format != "png" && params.Format != "jpeg" {
+ params.Format = "jpeg"
+ }
+
+ frame, err := captureFrame(ctx, params)
+ if err != nil {
+ return nil, fmt.Errorf("capture: %w", err)
+ }
+
+ if s.log != nil {
+ s.log.Info("gui:screenshot",
+ "format", frame.Format,
+ "width", frame.Width,
+ "height", frame.Height,
+ "bytes_b64", len(frame.ImageBase64),
+ )
+ }
+ return frame, nil
+}
diff --git a/agent/internal/gui/gui_linux.go b/agent/internal/gui/gui_linux.go
new file mode 100644
index 00000000..14427021
--- /dev/null
+++ b/agent/internal/gui/gui_linux.go
@@ -0,0 +1,191 @@
+//go:build linux
+
+package gui
+
+import (
+ "bytes"
+ "context"
+ "encoding/base64"
+ "errors"
+ "fmt"
+ "image"
+ "image/jpeg"
+ "image/png"
+ "os"
+ "os/exec"
+ "strconv"
+ "strings"
+ "time"
+)
+
+func detectCapabilities() (Capabilities, error) {
+ if os.Getenv("WAYLAND_DISPLAY") != "" {
+ if hasOnPath("grim") {
+ return Capabilities{
+ Capability: "linux-wayland",
+ MaxFPS: 3,
+ SyntheticFallback: false,
+ }, nil
+ }
+ }
+ if os.Getenv("DISPLAY") != "" {
+ for _, bin := range []string{"scrot", "import", "gnome-screenshot"} {
+ if hasOnPath(bin) {
+ return Capabilities{
+ Capability: "linux-x11",
+ MaxFPS: 3,
+ SyntheticFallback: false,
+ }, nil
+ }
+ }
+ return Capabilities{
+ Capability: "none",
+ SyntheticFallback: true,
+ Reason: "X11 detected but no scrot/import/gnome-screenshot installed",
+ }, nil
+ }
+ return Capabilities{
+ Capability: "none",
+ SyntheticFallback: true,
+ Reason: "no display server (headless)",
+ }, nil
+}
+
+func captureFrame(ctx context.Context, p ScreenshotParams) (*Frame, error) {
+ raw, capturedFormat, err := captureRawPNG(ctx)
+ if err != nil {
+ return nil, err
+ }
+
+ // Decode → optionally downscale → re-encode to requested format.
+ // We pay the decode cost so we can guarantee Scale + Quality work
+ // regardless of which capture tool we used.
+ src, _, err := image.Decode(bytes.NewReader(raw))
+ if err != nil {
+ // Some tools occasionally emit non-PNG; if the panel asked for
+ // the same format we already have, pass it through verbatim.
+ if capturedFormat == p.Format {
+ return &Frame{
+ ImageBase64: base64.StdEncoding.EncodeToString(raw),
+ Format: capturedFormat,
+ CapturedAt: time.Now().UTC().Format(time.RFC3339),
+ }, nil
+ }
+ return nil, fmt.Errorf("decode capture: %w", err)
+ }
+
+ if p.Scale > 0 && p.Scale < 1.0 {
+ src = nearestScale(src, p.Scale)
+ }
+
+ var buf bytes.Buffer
+ switch p.Format {
+ case "png":
+ if err := png.Encode(&buf, src); err != nil {
+ return nil, fmt.Errorf("png encode: %w", err)
+ }
+ default:
+ if err := jpeg.Encode(&buf, src, &jpeg.Options{Quality: p.Quality}); err != nil {
+ return nil, fmt.Errorf("jpeg encode: %w", err)
+ }
+ }
+
+ b := src.Bounds()
+ return &Frame{
+ ImageBase64: base64.StdEncoding.EncodeToString(buf.Bytes()),
+ Format: p.Format,
+ Width: b.Dx(),
+ Height: b.Dy(),
+ CapturedAt: time.Now().UTC().Format(time.RFC3339),
+ }, nil
+}
+
+// captureRawPNG returns raw bytes from whichever capture tool is available.
+// Format is always "png" today, but returned explicitly to leave room for
+// JPEG-native captures in the future.
+func captureRawPNG(ctx context.Context) ([]byte, string, error) {
+ switch {
+ case os.Getenv("WAYLAND_DISPLAY") != "" && hasOnPath("grim"):
+ out, err := run(ctx, "grim", "-")
+ return out, "png", err
+
+ case hasOnPath("scrot"):
+ // scrot can write PNG to a file; it can't write to stdout in
+ // every version, so we take the file route via /dev/stdout
+ // where supported.
+ out, err := run(ctx, "scrot", "-o", "/dev/stdout")
+ if err != nil {
+ // Older scrot — fall back to a temp file.
+ return scrotViaTemp(ctx)
+ }
+ return out, "png", nil
+
+ case hasOnPath("import"):
+ out, err := run(ctx, "import", "-window", "root", "png:-")
+ return out, "png", err
+ }
+ return nil, "", errors.New("no screenshot tool on PATH (install scrot, grim, or imagemagick)")
+}
+
+func scrotViaTemp(ctx context.Context) ([]byte, string, error) {
+ f, err := os.CreateTemp("", "sk-scrot-*.png")
+ if err != nil {
+ return nil, "", err
+ }
+ path := f.Name()
+ f.Close()
+ defer os.Remove(path)
+
+ if _, err := run(ctx, "scrot", "-o", path); err != nil {
+ return nil, "", err
+ }
+ data, err := os.ReadFile(path)
+ if err != nil {
+ return nil, "", err
+ }
+ return data, "png", nil
+}
+
+func run(ctx context.Context, name string, args ...string) ([]byte, error) {
+ cctx, cancel := context.WithTimeout(ctx, 10*time.Second)
+ defer cancel()
+ cmd := exec.CommandContext(cctx, name, args...)
+ var stdout, stderr bytes.Buffer
+ cmd.Stdout = &stdout
+ cmd.Stderr = &stderr
+ if err := cmd.Run(); err != nil {
+ return nil, fmt.Errorf("%s: %w (%s)", name, err, strings.TrimSpace(stderr.String()))
+ }
+ return stdout.Bytes(), nil
+}
+
+func hasOnPath(name string) bool {
+ _, err := exec.LookPath(name)
+ return err == nil
+}
+
+// nearestScale is a stdlib-only scaler. Quality is fine for streaming
+// previews at 50–75%; we don't need bilinear/bicubic here.
+func nearestScale(src image.Image, scale float64) image.Image {
+ b := src.Bounds()
+ dstW := int(float64(b.Dx()) * scale)
+ dstH := int(float64(b.Dy()) * scale)
+ if dstW < 1 {
+ dstW = 1
+ }
+ if dstH < 1 {
+ dstH = 1
+ }
+ dst := image.NewRGBA(image.Rect(0, 0, dstW, dstH))
+ for y := 0; y < dstH; y++ {
+ sy := b.Min.Y + int(float64(y)/scale)
+ for x := 0; x < dstW; x++ {
+ sx := b.Min.X + int(float64(x)/scale)
+ dst.Set(x, y, src.At(sx, sy))
+ }
+ }
+ return dst
+}
+
+// Avoid an unused-import warning when strconv isn't used in a build variant.
+var _ = strconv.Itoa
diff --git a/agent/internal/gui/gui_other.go b/agent/internal/gui/gui_other.go
new file mode 100644
index 00000000..26e3116e
--- /dev/null
+++ b/agent/internal/gui/gui_other.go
@@ -0,0 +1,23 @@
+//go:build !windows && !linux
+
+package gui
+
+import "context"
+
+func detectCapabilities() (Capabilities, error) {
+ return Capabilities{
+ Capability: "none",
+ SyntheticFallback: true,
+ Reason: "platform not yet supported by gui SDK",
+ }, nil
+}
+
+func captureFrame(_ context.Context, _ ScreenshotParams) (*Frame, error) {
+ return nil, errNotImplemented
+}
+
+var errNotImplemented = &platformErr{"gui capture not implemented on this platform"}
+
+type platformErr struct{ msg string }
+
+func (e *platformErr) Error() string { return e.msg }
diff --git a/agent/internal/gui/gui_windows.go b/agent/internal/gui/gui_windows.go
new file mode 100644
index 00000000..e4509555
--- /dev/null
+++ b/agent/internal/gui/gui_windows.go
@@ -0,0 +1,174 @@
+//go:build windows
+
+package gui
+
+import (
+ "bytes"
+ "context"
+ "encoding/base64"
+ "errors"
+ "fmt"
+ "os/exec"
+ "strconv"
+ "strings"
+ "time"
+)
+
+// PowerShell snippet: capture the primary screen with System.Drawing,
+// optionally downscale, encode to JPEG/PNG, base64-emit to stdout. We
+// pass scale and quality as args; format is selected by name.
+//
+// Why PowerShell instead of a Go-native call: System.Drawing ships in every
+// Windows install since the dawn of time, and shelling out keeps the agent
+// free of GDI cgo wrappers. Slow, but at 1–2 fps it's invisible.
+const psCaptureScript = `
+param(
+ [double]$Scale = 0.75,
+ [int]$Quality = 70,
+ [string]$Format = "jpeg"
+)
+$ErrorActionPreference = "Stop"
+Add-Type -AssemblyName System.Drawing
+Add-Type -AssemblyName System.Windows.Forms
+
+$bounds = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds
+$srcW = $bounds.Width
+$srcH = $bounds.Height
+
+$bmp = New-Object System.Drawing.Bitmap $srcW, $srcH
+$g = [System.Drawing.Graphics]::FromImage($bmp)
+$g.CopyFromScreen($bounds.X, $bounds.Y, 0, 0, $bounds.Size)
+
+if ($Scale -lt 1.0 -and $Scale -gt 0) {
+ $dstW = [int]([Math]::Round($srcW * $Scale))
+ $dstH = [int]([Math]::Round($srcH * $Scale))
+ $resized = New-Object System.Drawing.Bitmap $dstW, $dstH
+ $rg = [System.Drawing.Graphics]::FromImage($resized)
+ $rg.InterpolationMode = "HighQualityBicubic"
+ $rg.DrawImage($bmp, 0, 0, $dstW, $dstH)
+ $rg.Dispose()
+ $bmp.Dispose()
+ $bmp = $resized
+}
+
+$ms = New-Object System.IO.MemoryStream
+if ($Format -eq "png") {
+ $bmp.Save($ms, [System.Drawing.Imaging.ImageFormat]::Png)
+} else {
+ $codecs = [System.Drawing.Imaging.ImageCodecInfo]::GetImageEncoders()
+ $jpegCodec = $codecs | Where-Object { $_.MimeType -eq "image/jpeg" } | Select-Object -First 1
+ $params = New-Object System.Drawing.Imaging.EncoderParameters 1
+ $params.Param[0] = New-Object System.Drawing.Imaging.EncoderParameter ([System.Drawing.Imaging.Encoder]::Quality), [long]$Quality
+ $bmp.Save($ms, $jpegCodec, $params)
+}
+
+$bytes = $ms.ToArray()
+$ms.Dispose()
+$bmp.Dispose()
+
+# Emit a single line: WIDTH HEIGHT BASE64
+[Console]::Out.Write("$($bmp.Width) $($bmp.Height) ")
+[Console]::Out.WriteLine([Convert]::ToBase64String($bytes))
+`
+
+func detectCapabilities() (Capabilities, error) {
+ res, err := runPowerShell(context.Background(), `
+$b = [System.Windows.Forms.Screen]::PrimaryScreen.Bounds 2>$null
+if ($b) { Write-Output ("{0}x{1}" -f $b.Width, $b.Height) }
+`, 5*time.Second)
+ if err != nil || strings.TrimSpace(res) == "" {
+ // Most common cause: agent running as a Windows service in
+ // session 0 with no logged-in user. The bitmap will exist but
+ // we won't capture anything visible.
+ return Capabilities{
+ Capability: "none",
+ SyntheticFallback: true,
+ Reason: "no active user session",
+ }, nil
+ }
+ return Capabilities{
+ Capability: "windows-gdi",
+ Resolution: strings.TrimSpace(res),
+ MaxFPS: 5,
+ SyntheticFallback: false,
+ }, nil
+}
+
+func captureFrame(ctx context.Context, p ScreenshotParams) (*Frame, error) {
+ args := []string{
+ "-Scale", strconv.FormatFloat(p.Scale, 'f', 3, 64),
+ "-Quality", strconv.Itoa(p.Quality),
+ "-Format", p.Format,
+ }
+ out, err := runPowerShellWithArgs(ctx, psCaptureScript, args, 15*time.Second)
+ if err != nil {
+ return nil, err
+ }
+ // stdout is "WIDTH HEIGHT BASE64\n"
+ line := strings.TrimSpace(out)
+ parts := strings.SplitN(line, " ", 3)
+ if len(parts) != 3 {
+ return nil, fmt.Errorf("malformed capture output: %q", truncate(line, 120))
+ }
+ w, err1 := strconv.Atoi(parts[0])
+ h, err2 := strconv.Atoi(parts[1])
+ if err1 != nil || err2 != nil {
+ return nil, errors.New("malformed dimensions")
+ }
+ // Sanity-check the base64 payload but don't decode it; the panel does that.
+ if _, err := base64.StdEncoding.DecodeString(parts[2][:min(64, len(parts[2]))]); err != nil {
+ return nil, fmt.Errorf("invalid base64 prefix: %w", err)
+ }
+ return &Frame{
+ ImageBase64: parts[2],
+ Format: p.Format,
+ Width: w,
+ Height: h,
+ CapturedAt: time.Now().UTC().Format(time.RFC3339),
+ }, nil
+}
+
+func runPowerShell(ctx context.Context, script string, timeout time.Duration) (string, error) {
+ return runPowerShellWithArgs(ctx, script, nil, timeout)
+}
+
+func runPowerShellWithArgs(ctx context.Context, script string, args []string, timeout time.Duration) (string, error) {
+ cctx, cancel := context.WithTimeout(ctx, timeout)
+ defer cancel()
+
+ bin := "powershell"
+ if p, err := exec.LookPath("pwsh"); err == nil {
+ bin = p
+ }
+
+ all := []string{
+ "-NoProfile", "-NonInteractive",
+ "-ExecutionPolicy", "Bypass",
+ "-Command", script,
+ }
+ all = append(all, args...)
+
+ cmd := exec.CommandContext(cctx, bin, all...)
+ var stdout, stderr bytes.Buffer
+ cmd.Stdout = &stdout
+ cmd.Stderr = &stderr
+
+ if err := cmd.Run(); err != nil {
+ return "", fmt.Errorf("%w: %s", err, strings.TrimSpace(stderr.String()))
+ }
+ return stdout.String(), nil
+}
+
+func truncate(s string, n int) string {
+ if len(s) <= n {
+ return s
+ }
+ return s[:n] + "…"
+}
+
+func min(a, b int) int {
+ if a < b {
+ return a
+ }
+ return b
+}
diff --git a/agent/pkg/protocol/messages.go b/agent/pkg/protocol/messages.go
index 5941f1e8..7fca2958 100644
--- a/agent/pkg/protocol/messages.go
+++ b/agent/pkg/protocol/messages.go
@@ -241,6 +241,14 @@ const (
// Agent actions
ActionAgentUpdate = "agent:update"
+
+ // GUI / desktop capture actions. These are the agent-side primitives
+ // that panel extensions (e.g. serverkit-gui) call into. Implementation
+ // lives in agent/internal/gui — kept minimal so plugins composing
+ // remote-desktop / synthetic-UI features don't have to fork the
+ // agent.
+ ActionGUICapabilities = "gui:capabilities"
+ ActionGUIScreenshot = "gui:screenshot"
)
// Stream channels
diff --git a/agent/ui/src/pages/Overview.jsx b/agent/ui/src/pages/Overview.jsx
index da9f2315..21a2379e 100644
--- a/agent/ui/src/pages/Overview.jsx
+++ b/agent/ui/src/pages/Overview.jsx
@@ -97,16 +97,6 @@ export default function Overview() {
</div>
)}
- {status?.transport === 'poll' && (
- <div className="banner banner--info" style={{ background: '#1e1b4b', borderColor: '#4338ca', color: '#c7d2fe' }}>
- <strong>Limited mode (polling fallback).</strong> The WebSocket link to your panel
- couldn't be established cleanly, so the agent fell back to a REST polling transport.
- Heartbeats and commands continue to work; live logs, real-time metrics streaming, and
- terminal sessions are unavailable in this mode. This usually points at the network
- path between agent and panel mangling WebSocket frames.
- </div>
- )}
-
<section className="card">
<h2 className="card__title">Connection</h2>
<div className="info-row">
diff --git a/frontend/src/components/ConfirmDialog.jsx b/frontend/src/components/ConfirmDialog.jsx
index 2d35b22c..6cb1f3e1 100644
--- a/frontend/src/components/ConfirmDialog.jsx
+++ b/frontend/src/components/ConfirmDialog.jsx
@@ -41,28 +41,30 @@ export function ConfirmDialog({
<AlertDialog open={isOpen} onOpenChange={(v) => !v && onCancel()}>
<AlertDialogContent>
<AlertDialogHeader>
- <div className="flex flex-col items-center gap-3 text-center">
- <div className={cn('mb-1', iconColor[variant] || 'text-destructive')}>
- <Icon size={32} />
+ <div className="flex items-start gap-3">
+ <div className={cn('flex-shrink-0 mt-0.5', iconColor[variant] || 'text-destructive')}>
+ <Icon size={22} />
+ </div>
+ <div className="flex-1 min-w-0">
+ <AlertDialogTitle>{title}</AlertDialogTitle>
+ {message && <AlertDialogDescription className="mt-1.5">{message}</AlertDialogDescription>}
+ {details && <p className="text-sm text-muted-foreground mt-1.5">{details}</p>}
</div>
- <AlertDialogTitle>{title}</AlertDialogTitle>
- {message && <AlertDialogDescription>{message}</AlertDialogDescription>}
- {details && <p className="text-sm text-muted-foreground">{details}</p>}
- {requireConfirmation && (
- <div className="w-full text-left mt-2 space-y-1.5">
- <Label className="text-muted-foreground">
- Type <strong className="text-foreground">{requireConfirmation}</strong> to confirm:
- </Label>
- <Input
- value={inputValue}
- onChange={(e) => setInputValue(e.target.value)}
- onKeyDown={(e) => e.key === 'Enter' && !isConfirmDisabled && onConfirm()}
- placeholder={confirmationPlaceholder || requireConfirmation}
- autoFocus
- />
- </div>
- )}
</div>
+ {requireConfirmation && (
+ <div className="space-y-1.5 mt-2">
+ <Label className="text-muted-foreground">
+ Type <strong className="text-foreground">{requireConfirmation}</strong> to confirm:
+ </Label>
+ <Input
+ value={inputValue}
+ onChange={(e) => setInputValue(e.target.value)}
+ onKeyDown={(e) => e.key === 'Enter' && !isConfirmDisabled && onConfirm()}
+ placeholder={confirmationPlaceholder || requireConfirmation}
+ autoFocus
+ />
+ </div>
+ )}
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel onClick={onCancel}>{cancelText}</AlertDialogCancel>
diff --git a/frontend/src/components/Modal.jsx b/frontend/src/components/Modal.jsx
index a46cee11..ce27d351 100644
--- a/frontend/src/components/Modal.jsx
+++ b/frontend/src/components/Modal.jsx
@@ -1,24 +1,57 @@
import {
- Dialog,
- DialogContent,
- DialogHeader,
- DialogTitle,
- DialogFooter,
-} from '@/components/ui/dialog';
+ Sheet,
+ SheetContent,
+ SheetHeader,
+ SheetTitle,
+ SheetFooter,
+} from '@/components/ui/sheet';
import { cn } from '@/lib/utils';
-export default function Modal({ open, onClose, title, children, footer, className = '', size = '' }) {
+// Size → Tailwind max-width on >=sm screens. Mobile is always full-width.
+const SIZE_CLASS = {
+ sm: 'sm:max-w-sm', // 384px
+ md: 'sm:max-w-md', // 448px (default)
+ lg: 'sm:max-w-2xl', // 672px
+ xl: 'sm:max-w-4xl', // 896px
+ '2xl': 'sm:max-w-6xl', // 1152px — large workspaces (QueryRunner, CompareView)
+};
+
+export default function Modal({
+ open,
+ onClose,
+ title,
+ children,
+ footer,
+ className = '',
+ size = 'md',
+}) {
+ const sizeClass = SIZE_CLASS[size] || SIZE_CLASS.md;
+
return (
- <Dialog open={open} onOpenChange={(v) => !v && onClose()}>
- <DialogContent className={cn(size === 'lg' && 'max-w-3xl', className)}>
+ <Sheet open={open} onOpenChange={(v) => !v && onClose()}>
+ <SheetContent
+ side="right"
+ className={cn(
+ // Override Sheet's default sm:max-w-md with our explicit size token.
+ 'p-0 flex flex-col gap-0',
+ sizeClass,
+ className
+ )}
+ >
{title && (
- <DialogHeader>
- <DialogTitle>{title}</DialogTitle>
- </DialogHeader>
+ <SheetHeader className="px-6 py-4 border-b border-border space-y-0">
+ <SheetTitle>{title}</SheetTitle>
+ </SheetHeader>
+ )}
+
+ <div className="flex-1 overflow-y-auto px-6 py-4">{children}</div>
+
+ {footer && (
+ <SheetFooter className="px-6 py-3 border-t border-border bg-card sm:justify-end">
+ {footer}
+ </SheetFooter>
)}
- {children}
- {footer && <DialogFooter>{footer}</DialogFooter>}
- </DialogContent>
- </Dialog>
+ </SheetContent>
+ </Sheet>
);
}
diff --git a/frontend/src/components/QueryRunner.jsx b/frontend/src/components/QueryRunner.jsx
index 4ead687c..9490f507 100644
--- a/frontend/src/components/QueryRunner.jsx
+++ b/frontend/src/components/QueryRunner.jsx
@@ -351,7 +351,7 @@ const QueryRunner = ({ database, dbType, onClose }) => {
</div>
{error && (
- <div className="query-error">
+ <div className="alert alert-danger">
<svg viewBox="0 0 24 24" width="16" height="16" stroke="currentColor" fill="none" strokeWidth="2">
<circle cx="12" cy="12" r="10"/>
<line x1="15" y1="9" x2="9" y2="15"/>
diff --git a/frontend/src/components/RemoteTerminal.jsx b/frontend/src/components/RemoteTerminal.jsx
index e219bc89..9351cd5a 100644
--- a/frontend/src/components/RemoteTerminal.jsx
+++ b/frontend/src/components/RemoteTerminal.jsx
@@ -237,7 +237,7 @@ export default function RemoteTerminal({ serverId, onClose }) {
onClick={handleClick}
/>
{error && (
- <div className="terminal-error">
+ <div className="alert alert-danger">
{error}
</div>
)}
diff --git a/frontend/src/components/StatCard.jsx b/frontend/src/components/StatCard.jsx
index 07ee375a..69b26195 100644
--- a/frontend/src/components/StatCard.jsx
+++ b/frontend/src/components/StatCard.jsx
@@ -11,12 +11,21 @@ export function StatCard({
label,
value,
suffix,
+ detail,
valueClassName = '',
+ onClick,
+ active = false,
children,
}) {
const iconClass = ['stat-icon', iconVariant].filter(Boolean).join(' ');
+ const cardClass = ['stat-card', active && 'active', onClick && 'stat-card--clickable']
+ .filter(Boolean).join(' ');
+ const Tag = onClick ? 'button' : 'div';
return (
- <div className="stat-card">
+ <Tag
+ className={cardClass}
+ {...(onClick && { type: 'button', onClick, 'aria-pressed': active })}
+ >
<div className={iconClass}>
{iconNode ?? (Icon ? <Icon size={20} /> : null)}
</div>
@@ -28,8 +37,9 @@ export function StatCard({
{suffix && <span className="stat-suffix">{suffix}</span>}
</span>
)}
+ {detail && <span className="stat-detail">{detail}</span>}
</div>
- </div>
+ </Tag>
);
}
diff --git a/frontend/src/components/setup/SetupStepAccount.jsx b/frontend/src/components/setup/SetupStepAccount.jsx
index df5945db..4e84bf04 100644
--- a/frontend/src/components/setup/SetupStepAccount.jsx
+++ b/frontend/src/components/setup/SetupStepAccount.jsx
@@ -66,10 +66,8 @@ const SetupStepAccount = ({ onComplete }) => {
An admin account already exists. Sign in to continue setup.
</p>
- <div className="wizard-info-banner">
- <div className="wizard-info-icon">
- <Info size={20} />
- </div>
+ <div className="alert alert-info">
+ <Info size={20} />
<p>
It looks like an admin account was created via the CLI.
Sign in with those credentials to finish setting up your server.
@@ -124,10 +122,8 @@ const SetupStepAccount = ({ onComplete }) => {
Set up the administrator account for your server.
</p>
- <div className="wizard-info-banner">
- <div className="wizard-info-icon">
- <Info size={20} />
- </div>
+ <div className="alert alert-info">
+ <Info size={20} />
<p>
This is your first time using ServerKit. Create an administrator
account to get started. This account will have full access to
diff --git a/frontend/src/components/setup/SetupStepTier.jsx b/frontend/src/components/setup/SetupStepTier.jsx
index bdb62748..85a9ce47 100644
--- a/frontend/src/components/setup/SetupStepTier.jsx
+++ b/frontend/src/components/setup/SetupStepTier.jsx
@@ -71,11 +71,9 @@ const SetupStepTier = ({ useCases, onComplete }) => {
</p>
{showWarning && (
- <div className="tier-warning">
- <div className="tier-warning-icon">
- <AlertTriangle size={20} />
- </div>
- <div className="tier-warning-text">
+ <div className="alert alert-warning">
+ <AlertTriangle size={20} />
+ <div>
Your server is in the <strong>Lite</strong> tier. WordPress site
creation requires at least the Standard tier (2+ cores, 2+ GB RAM).
You can still manage existing WordPress sites.
diff --git a/frontend/src/components/ui/alert-dialog.jsx b/frontend/src/components/ui/alert-dialog.jsx
index e55a1b00..332189e6 100644
--- a/frontend/src/components/ui/alert-dialog.jsx
+++ b/frontend/src/components/ui/alert-dialog.jsx
@@ -59,7 +59,7 @@ AlertDialogFooter.displayName = 'AlertDialogFooter';
const AlertDialogTitle = React.forwardRef(({ className, ...props }, ref) => (
<AlertDialogPrimitive.Title
ref={ref}
- className={cn('text-lg font-semibold text-foreground', className)}
+ className={cn('text-base font-semibold text-foreground leading-tight', className)}
{...props}
/>
));
diff --git a/frontend/src/components/ui/badge.jsx b/frontend/src/components/ui/badge.jsx
index c7808e3d..7641d026 100644
--- a/frontend/src/components/ui/badge.jsx
+++ b/frontend/src/components/ui/badge.jsx
@@ -3,7 +3,7 @@ import { cva } from 'class-variance-authority';
import { cn } from '@/lib/utils';
const badgeVariants = cva(
- 'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors',
+ 'inline-flex items-center rounded-md border px-2.5 py-1 text-xs font-semibold transition-colors leading-none',
{
variants: {
variant: {
diff --git a/frontend/src/components/ui/sheet.jsx b/frontend/src/components/ui/sheet.jsx
index b6c0a5d3..b8d0e8de 100644
--- a/frontend/src/components/ui/sheet.jsx
+++ b/frontend/src/components/ui/sheet.jsx
@@ -30,8 +30,8 @@ const sheetVariants = cva(
side: {
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
- left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
- right: 'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
+ left: 'inset-y-0 left-0 h-full w-full border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-md',
+ right: 'inset-y-0 right-0 h-full w-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-md',
},
},
defaultVariants: { side: 'right' },
diff --git a/frontend/src/components/wordpress/BasicAuthModal.jsx b/frontend/src/components/wordpress/BasicAuthModal.jsx
index 61e34af0..a014652b 100644
--- a/frontend/src/components/wordpress/BasicAuthModal.jsx
+++ b/frontend/src/components/wordpress/BasicAuthModal.jsx
@@ -108,7 +108,7 @@ const BasicAuthModal = ({ environment, prodId, onClose, api }) => {
{credentials && (
<div className="basic-auth-credentials">
- <div className="basic-auth-credential-warning">
+ <div className="alert alert-warning">
<AlertTriangle size={14} />
<span>Save these credentials now. The password will not be shown again.</span>
</div>
diff --git a/frontend/src/components/wordpress/CompareView.jsx b/frontend/src/components/wordpress/CompareView.jsx
index e6afec4c..7aabebed 100644
--- a/frontend/src/components/wordpress/CompareView.jsx
+++ b/frontend/src/components/wordpress/CompareView.jsx
@@ -58,7 +58,7 @@ const CompareView = ({ projectId, envA, envB, onClose }) => {
)}
{error && (
- <div className="compare-error">
+ <div className="alert alert-danger">
<p>{error}</p>
<Button size="sm" onClick={loadComparison}>
Retry
diff --git a/frontend/src/components/wordpress/PipelineView.jsx b/frontend/src/components/wordpress/PipelineView.jsx
index 48f62ba5..9eb6b34b 100644
--- a/frontend/src/components/wordpress/PipelineView.jsx
+++ b/frontend/src/components/wordpress/PipelineView.jsx
@@ -428,7 +428,7 @@ const PipelineCard = ({
</div>
{env.is_locked && env.locked_reason && (
- <div className="pipeline-card-lock-banner">
+ <div className="alert alert-warning">
<Lock size={10} />
<span>{env.locked_reason}</span>
</div>
@@ -603,7 +603,7 @@ const MultidevCard = ({
</Button>
</div>
{env.is_locked && env.locked_reason && (
- <div className="pipeline-card-lock-banner">
+ <div className="alert alert-warning">
<Lock size={10} />
<span>{env.locked_reason}</span>
</div>
diff --git a/frontend/src/components/wordpress/PromoteModal.jsx b/frontend/src/components/wordpress/PromoteModal.jsx
index 92dae20a..229975af 100644
--- a/frontend/src/components/wordpress/PromoteModal.jsx
+++ b/frontend/src/components/wordpress/PromoteModal.jsx
@@ -219,7 +219,7 @@ const PromoteModal = ({ sourceEnv, targetEnv, onClose, onPromote }) => {
</div>
{targetType === 'production' && (
- <div className="promote-warning">
+ <div className="alert alert-warning">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
<line x1="12" y1="9" x2="12" y2="13" />
diff --git a/frontend/src/components/wordpress/ResourceLimitsModal.jsx b/frontend/src/components/wordpress/ResourceLimitsModal.jsx
index 80dbeed3..8fb3c8e1 100644
--- a/frontend/src/components/wordpress/ResourceLimitsModal.jsx
+++ b/frontend/src/components/wordpress/ResourceLimitsModal.jsx
@@ -131,7 +131,7 @@ const ResourceLimitsModal = ({ environment, currentLimits, onClose, onApply }) =
</div>
</div>
- <div className="resource-limits-warning">
+ <div className="alert alert-warning">
<AlertTriangle size={14} />
<span>Applying resource limits will restart the environment containers.</span>
</div>
diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsx
index 68e9b0d7..33277fde 100644
--- a/frontend/src/pages/Servers.jsx
+++ b/frontend/src/pages/Servers.jsx
@@ -1,8 +1,11 @@
import { useState, useEffect, useCallback, useRef } from 'react';
import { Link } from 'react-router-dom';
+import { Server as ServerLucideIcon } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { ConfirmDialog } from '../components/ConfirmDialog';
+import EmptyState from '../components/EmptyState';
+import { StatCard, StatsGrid } from '../components/StatCard';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Badge } from '@/components/ui/badge';
@@ -210,24 +213,20 @@ const Servers = () => {
</div>
</header>
- <div className="servers-stats">
+ <StatsGrid>
{statCards.map(stat => (
- <button
+ <StatCard
key={stat.key}
- type="button"
- className={`stat-card stat-card--${stat.key} ${selectedStatus === stat.key ? 'active' : ''}`}
+ iconNode={stat.icon}
+ iconVariant={stat.key}
+ label={stat.label}
+ value={stat.value}
+ detail={stat.detail}
+ active={selectedStatus === stat.key}
onClick={() => setSelectedStatus(stat.key)}
- aria-pressed={selectedStatus === stat.key}
- >
- <span className={`stat-icon ${stat.key}`}>{stat.icon}</span>
- <span className="stat-content">
- <span className="stat-label">{stat.label}</span>
- <span className="stat-value">{stat.value}</span>
- <span className="stat-detail">{stat.detail}</span>
- </span>
- </button>
+ />
))}
- </div>
+ </StatsGrid>
<div className="servers-command-bar">
<div className="servers-toolbar">
@@ -289,17 +288,14 @@ const Servers = () => {
)}
{filteredServers.length === 0 ? (
- <div className="empty-state servers-empty-state">
- <div className="servers-empty-state__icon">
- <ServerIcon className="empty-icon" />
- </div>
- <h3>{servers.length === 0 ? 'No servers yet' : 'No servers match these filters'}</h3>
- <p>
- {servers.length === 0
- ? 'Install a ServerKit agent on a machine to start monitoring health and managing Docker remotely.'
- : 'Try a different status, group, or search term to bring machines back into view.'}
- </p>
- {servers.length === 0 ? (
+ <EmptyState
+ size="lg"
+ icon={ServerLucideIcon}
+ title={servers.length === 0 ? 'No servers yet' : 'No servers match these filters'}
+ description={servers.length === 0
+ ? 'Install a ServerKit agent on a machine to start monitoring health and managing Docker remotely.'
+ : 'Try a different status, group, or search term to bring machines back into view.'}
+ action={servers.length === 0 ? (
<Button onClick={() => setShowAddModal(true)}>
<PlusIcon /> Add your first server
</Button>
@@ -316,7 +312,7 @@ const Servers = () => {
Clear filters
</Button>
)}
- </div>
+ />
) : (
<div className="servers-table-wrap">
<table className="servers-table">
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index 16667083..e6184285 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -1,8 +1,10 @@
import React, { useState, useEffect, useMemo } from 'react';
import { useNavigate, Link } from 'react-router-dom';
+import { Layers } from 'lucide-react';
import api from '../services/api';
import { useToast } from '../contexts/ToastContext';
import { getServiceType, getStatusConfig, formatRelativeTime } from '../utils/serviceTypes';
+import EmptyState from '../components/EmptyState';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Checkbox } from '@/components/ui/checkbox';
@@ -281,22 +283,19 @@ const Services = () => {
)}
{filteredApps.length === 0 ? (
- <div className="services-page__empty">
- <div className="services-page__empty-icon">
- <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5">
- <path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"/>
- </svg>
- </div>
- <h3>No services found</h3>
- <p>{searchTerm || typeFilter !== 'all' || statusFilter !== 'all'
+ <EmptyState
+ size="lg"
+ icon={Layers}
+ title="No services found"
+ description={searchTerm || typeFilter !== 'all' || statusFilter !== 'all'
? 'Try adjusting your filters'
- : 'Deploy your first service to get started'}</p>
- {!searchTerm && typeFilter === 'all' && statusFilter === 'all' && (
+ : 'Deploy your first service to get started'}
+ action={!searchTerm && typeFilter === 'all' && statusFilter === 'all' && (
<Button asChild>
<Link to="/templates">Create Service</Link>
</Button>
)}
- </div>
+ />
) : (
<div className="services-page__list">
{/* List Header */}
diff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsx
index 6b5598ab..859deffa 100644
--- a/frontend/src/pages/StyleGuide.jsx
+++ b/frontend/src/pages/StyleGuide.jsx
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
import useTabParam from '../hooks/useTabParam';
+import { useLogsDrawer } from '../contexts/LogsDrawerContext';
import {
Palette, Type, Box, Layout, Square, ToggleLeft, AlertTriangle,
Info, CheckCircle, XCircle, Bell, Search, Plus, Trash2, Edit3,
@@ -53,6 +54,7 @@ const SECTION_IDS = SECTIONS.map(s => s.id);
export default function StyleGuide() {
const [activeSection, setActiveSection] = useTabParam('/style-guide', SECTION_IDS, 'colors');
+ const { openDrawer } = useLogsDrawer();
const [modalOpen, setModalOpen] = useState(false);
const [confirmOpen, setConfirmOpen] = useState(false);
const [confirmVariant, setConfirmVariant] = useState('danger');
@@ -298,11 +300,11 @@ export default function StyleGuide() {
<Button className="w-full mb-4">Full Width Button</Button>
<div className="flex flex-wrap gap-3">
<Button disabled>
- <span className="spinner spinner-sm"><span className="spinner-ring"></span></span>
+ <Spinner size="sm" />
Saving...
</Button>
<Button variant="outline" disabled>
- <span className="spinner spinner-sm"><span className="spinner-ring"></span></span>
+ <Spinner size="sm" />
Loading...
</Button>
</div>
@@ -667,7 +669,7 @@ export default function StyleGuide() {
<SectionTitle title="Alert with Close Button" />
<div className="space-y-2">
- <div className="alert alert-danger" style={{ position: 'relative' }}>
+ <div className="alert alert-danger">
Something went wrong while saving.
<button className="alert-close">&times;</button>
</div>
@@ -714,6 +716,14 @@ export default function StyleGuide() {
</Modal>
</div>
+ <SectionTitle title="Logs Drawer (LogsDrawer)" />
+ <p className="text-sm text-secondary mb-2">Global bottom-pinned drawer for streaming logs. Opens via the LogsDrawer context.</p>
+ <div className="card" style={{ padding: 24 }}>
+ <Button onClick={() => openDrawer({ name: 'sample-service', logPath: '/var/log/syslog', appType: 'logfile' })}>
+ <FileText size={16} /> Open Logs Drawer
+ </Button>
+ </div>
+
<SectionTitle title="Confirm Dialogs" />
<div className="card" style={{ padding: 24 }}>
<div className="flex flex-wrap gap-3">
@@ -1026,7 +1036,7 @@ export default function StyleGuide() {
<SectionTitle title="Error Banner at Page Level" />
<p className="text-sm text-secondary mb-2">Shown below page header when an API call fails.</p>
- <div className="alert alert-danger" style={{ position: 'relative' }}>
+ <div className="alert alert-danger">
Failed to load services. Please try again.
<button className="alert-close">&times;</button>
</div>
diff --git a/frontend/src/pages/WordPress.jsx b/frontend/src/pages/WordPress.jsx
index 9dc5c5af..b3988a02 100644
--- a/frontend/src/pages/WordPress.jsx
+++ b/frontend/src/pages/WordPress.jsx
@@ -5,6 +5,8 @@ import { useToast } from '../contexts/ToastContext';
import { useResourceTier } from '../contexts/ResourceTierContext';
import ResourceGate from '../components/ResourceGate';
import Spinner from '../components/Spinner';
+import EmptyState from '../components/EmptyState';
+import { Globe } from 'lucide-react';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
@@ -126,20 +128,17 @@ function WordPress() {
</div>
{sites.length === 0 ? (
- <div className="empty-state-large">
- <div className="empty-icon">
- <svg viewBox="0 0 24 24" width="64" height="64" fill="none" stroke="currentColor" strokeWidth="1.5">
- <circle cx="12" cy="12" r="10"/>
- <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"/>
- <path d="M2 12h20"/>
- </svg>
- </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 onClick={() => setShowCreateModal(true)}>
- Create Site
- </Button>
- </div>
+ <EmptyState
+ size="lg"
+ icon={Globe}
+ title="No WordPress Sites"
+ description="Create your first WordPress site powered by Docker. Each site gets its own isolated environment with MySQL."
+ action={
+ <Button onClick={() => setShowCreateModal(true)}>
+ Create Site
+ </Button>
+ }
+ />
) : (
<div className="wp-sites-grid">
{sites.map(site => (
diff --git a/frontend/src/styles/_theme-variables.scss b/frontend/src/styles/_theme-variables.scss
index bf0a331b..2bc97250 100644
--- a/frontend/src/styles/_theme-variables.scss
+++ b/frontend/src/styles/_theme-variables.scss
@@ -19,10 +19,10 @@
--bg-tertiary: #3f3f46;
// Border colors
- --border-default: #27272a;
+ --border-default: #3f3f46;
--border-subtle: #27272a;
- --border-active: #3f3f46;
- --border-hover: #3f3f46;
+ --border-active: #52525b;
+ --border-hover: #52525b;
// Text colors
--text-primary: #f4f4f5;
diff --git a/frontend/src/styles/components/_alerts.scss b/frontend/src/styles/components/_alerts.scss
index b02ef1fb..8c11fa62 100644
--- a/frontend/src/styles/components/_alerts.scss
+++ b/frontend/src/styles/components/_alerts.scss
@@ -3,15 +3,20 @@
// ============================================
.alert {
- position: relative;
display: flex;
- align-items: center;
+ align-items: flex-start;
gap: $space-2;
padding: $space-3 $space-4;
border-radius: $radius-md;
font-size: $font-size-sm;
+ line-height: 1.5;
margin-bottom: $space-4;
+ > svg {
+ flex-shrink: 0;
+ margin-top: 2px;
+ }
+
&.alert-success,
&.alert--success {
background: $success-bg;
@@ -43,16 +48,16 @@
}
.alert-close {
- position: absolute;
- top: $space-2;
- right: $space-3;
+ margin-left: auto;
background: none;
border: none;
font-size: $font-size-lg;
color: inherit;
opacity: 0.6;
cursor: pointer;
- padding: 0;
+ padding: 0 $space-1;
+ line-height: 1;
+ flex-shrink: 0;
&:hover {
opacity: 1;
diff --git a/frontend/src/styles/components/_cards.scss b/frontend/src/styles/components/_cards.scss
index 6e4a39b9..212732c8 100644
--- a/frontend/src/styles/components/_cards.scss
+++ b/frontend/src/styles/components/_cards.scss
@@ -168,6 +168,32 @@
font-weight: $font-weight-normal;
}
+.stat-detail {
+ font-size: $font-size-xs;
+ color: $text-tertiary;
+ margin-top: 2px;
+}
+
+// Clickable stat-card variant: behaves as a filter button
+.stat-card--clickable {
+ appearance: none;
+ width: 100%;
+ text-align: left;
+ cursor: pointer;
+ color: inherit;
+ transition: transform $transition-base, border-color $transition-base, box-shadow $transition-base;
+
+ &:hover,
+ &.active {
+ transform: translateY(-1px);
+ border-color: $border-active;
+ }
+
+ &.active {
+ border-color: $accent-primary;
+ }
+}
+
// Progress bar
.progress-bar {
height: 4px;
@@ -207,6 +233,15 @@
color: $text-secondary;
margin-bottom: $space-6;
}
+
+ // When nested inside a card, drop the card-in-card double background.
+ .card &,
+ .card-body & {
+ background: transparent;
+ border: none;
+ border-radius: 0;
+ padding: $space-10 $space-5;
+ }
}
// Card body (content area below card-header)
diff --git a/frontend/src/styles/pages/_servers.scss b/frontend/src/styles/pages/_servers.scss
index a0c6aa23..349ef44c 100644
--- a/frontend/src/styles/pages/_servers.scss
+++ b/frontend/src/styles/pages/_servers.scss
@@ -214,135 +214,27 @@
flex: 1;
}
-.servers-stats {
- display: grid;
- grid-template-columns: repeat(4, 1fr);
- gap: $space-3;
- margin-bottom: $space-6;
-
- @media (max-width: $breakpoint-lg) {
- grid-template-columns: repeat(2, 1fr);
- }
-
- @media (max-width: $breakpoint-sm) {
- grid-template-columns: 1fr;
- }
-}
-
-.stat-card {
- position: relative;
- isolation: isolate;
- appearance: none;
- width: 100%;
- text-align: left;
- cursor: pointer;
- background:
- linear-gradient(135deg, $accent-glow, transparent 46%),
- $bg-card;
- border: 1px solid $border-subtle;
- border-radius: $radius-xl;
- padding: $space-4;
- display: flex;
- align-items: center;
- gap: $space-3;
- color: inherit;
- transition: transform $transition-base, border-color $transition-base, box-shadow $transition-base, background $transition-base;
-
- &::after {
- content: '';
- position: absolute;
- inset: auto $space-4 0 $space-4;
- height: 3px;
- border-radius: $radius-full $radius-full 0 0;
- background: transparent;
- transition: background $transition-base;
- }
-
- &:hover,
- &.active {
- transform: translateY(-2px);
- border-color: $border-active;
- box-shadow: $shadow-md;
- }
-
- &.active::after {
- background: $accent-primary;
- }
-
- &--online.active::after {
- background: $success;
- }
-
- &--offline.active::after {
- background: $danger;
- }
-
- &--connecting.active::after {
- background: $warning;
- }
-}
-
-.stat-icon {
- width: 44px;
- height: 44px;
- border-radius: $radius-xl;
- display: flex;
- align-items: center;
- justify-content: center;
-
- svg {
- width: 24px;
- height: 24px;
- }
-
- &.all {
- background: $accent-glow;
- color: $accent-primary;
- }
-
- &.online {
- background: $success-bg;
- color: $success;
- }
-
- &.offline {
- background: $danger-bg;
- color: $danger;
- }
-
- &.connecting {
- background: $warning-bg;
- color: $warning;
- }
-}
-
-.stat-content {
- display: grid;
- gap: 2px;
+.servers-page {
+ .stat-icon {
+ &.all {
+ background: $accent-glow;
+ color: $accent-primary;
+ }
- .stat-value {
- grid-column: 2;
- grid-row: 1 / span 2;
- justify-self: end;
- font-family: $font-mono;
- font-size: $font-size-2xl;
- font-weight: $font-weight-bold;
- color: $text-primary;
- line-height: 1;
- }
+ &.online {
+ background: $success-bg;
+ color: $success;
+ }
- .stat-label {
- grid-column: 1;
- grid-row: 1;
- font-size: $font-size-sm;
- color: $text-primary;
- font-weight: $font-weight-semibold;
- }
+ &.offline {
+ background: $danger-bg;
+ color: $danger;
+ }
- .stat-detail {
- grid-column: 1 / -1;
- font-size: $font-size-xs;
- color: $text-tertiary;
+ &.connecting {
+ background: $warning-bg;
+ color: $warning;
+ }
}
}
diff --git a/frontend/src/styles/pages/_terminal.scss b/frontend/src/styles/pages/_terminal.scss
index 0230cde8..7fc3f2ac 100644
--- a/frontend/src/styles/pages/_terminal.scss
+++ b/frontend/src/styles/pages/_terminal.scss
@@ -468,7 +468,7 @@
th:nth-child(5), td:nth-child(5) { width: 110px; } // Memory %
th:nth-child(6), td:nth-child(6) { width: 90px; } // Memory
th:nth-child(7), td:nth-child(7) { width: 80px; } // Status
- th:nth-child(8), td:nth-child(8) { width: 80px; } // Actions
+ th:nth-child(8), td:nth-child(8) { width: 110px; } // Actions
tr {
cursor: pointer;