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.

EmptyState loading/size + theme SCSS refactor

Juan Denis099c7a3081c9
diff --git a/frontend/src/components/EmptyState.jsx b/frontend/src/components/EmptyState.jsx
index 8edeadf8..d255e92b 100644
--- a/frontend/src/components/EmptyState.jsx
+++ b/frontend/src/components/EmptyState.jsx
@@ -1,16 +1,28 @@
import React from 'react';
import { Inbox } from 'lucide-react';
+import { Spinner } from './Spinner';
export default function EmptyState({
icon: Icon = Inbox,
title = 'No items found',
description = '',
- action = null
+ action = null,
+ size = 'default',
+ loading = false
}) {
+ if (loading) {
+ return (
+ <div className={`empty-state empty-state--${size}`}>
+ <Spinner size={size === 'lg' ? 'lg' : 'md'} />
+ {title && <h3 className="empty-state__title">{title}</h3>}
+ </div>
+ );
+ }
+
return (
- <div className="empty-state">
+ <div className={`empty-state empty-state--${size}`}>
<div className="empty-state__icon">
- <Icon size={48} />
+ <Icon size={size === 'lg' ? 64 : 48} />
</div>
<h3 className="empty-state__title">{title}</h3>
{description && (
diff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsx
index cd7445b2..6bdb620a 100644
--- a/frontend/src/pages/StyleGuide.jsx
+++ b/frontend/src/pages/StyleGuide.jsx
@@ -38,7 +38,7 @@ export default function StyleGuide() {
{ id: 'tabs', label: 'Tabs', icon: ChevronRight },
{ id: 'lists', label: 'Lists & Info', icon: Database },
{ id: 'feedback', label: 'Feedback & Loading', icon: Activity },
- { id: 'empty', label: 'Empty States', icon: Inbox },
+ { id: 'empty', label: 'States', icon: Inbox },
{ id: 'pageheaders', label: 'Page Headers', icon: FileText },
{ id: 'patterns', label: 'Page Patterns', icon: Monitor },
{ id: 'utilities', label: 'Utilities', icon: Zap },
@@ -848,19 +848,17 @@ export default function StyleGuide() {
</div>
</div>
- <SectionTitle title="Loading States" />
- <div className="card" style={{ padding: 24 }}>
- <p className="text-sm text-tertiary mb-2">Standard: .loading class</p>
- <div className="loading" style={{ position: 'relative', minHeight: 60 }}>Loading services...</div>
- </div>
+ <SectionTitle title="Spinner Sizes (standalone)" />
+ <p className="text-sm text-tertiary mb-2">Use Spinner directly only inside buttons or inline indicators.</p>
</div>
)}
- {/* ── EMPTY STATES ── */}
+ {/* ── EMPTY, LOADING & UNAVAILABLE STATES ── */}
{activeSection === 'empty' && (
<div className="space-y-6">
- <SectionTitle title="EmptyState Component (Standard)" />
- <p className="text-secondary text-sm mb-2">Use this for all empty states. Import from components/EmptyState.</p>
+ <p className="text-secondary text-sm">One component for everything: empty, loading, not-installed, unavailable. Import EmptyState from components/EmptyState.</p>
+
+ <SectionTitle title="Default (No Data)" />
<EmptyState />
<SectionTitle title="With Icon, Title, Description, Action" />
@@ -871,6 +869,10 @@ export default function StyleGuide() {
action={<button className="btn btn-primary"><Plus size={16} /> Add Server</button>}
/>
+ <SectionTitle title="Loading State" />
+ <p className="text-sm text-tertiary mb-2">Pass loading=true. Same component, spinner instead of icon.</p>
+ <EmptyState loading title="Loading services..." />
+
<SectionTitle title="Search Empty" />
<EmptyState
icon={Search}
@@ -878,14 +880,49 @@ export default function StyleGuide() {
description="Try adjusting your search or filter criteria."
/>
- <SectionTitle title="Different Contexts" />
+ <SectionTitle title='Large — Not Installed (size="lg")' />
+ <p className="text-sm text-tertiary mb-2">Full-page state for Git, Docker, FTP when not installed.</p>
+ <EmptyState
+ size="lg"
+ 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>}
+ />
+
+ <SectionTitle title='Large — Unavailable (size="lg")' />
+ <EmptyState
+ size="lg"
+ 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>}
+ />
+
+ <SectionTitle title="Large — Loading" />
+ <EmptyState size="lg" loading title="Loading services..." />
+
+ <SectionTitle title="Inside a Card (e.g. empty table)" />
+ <div className="card" style={{ padding: 24 }}>
+ <div className="card-header">
+ <h3>Scan History</h3>
+ <button className="btn btn-sm btn-secondary">Refresh</button>
+ </div>
+ <div className="card-body">
+ <EmptyState
+ icon={Search}
+ title="No scans yet"
+ description="Start a scan above to check for threats."
+ />
+ </div>
+ </div>
+
+ <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={GitBranch} title="No Git server installed" description="Install Gitea to host repositories." action={<button className="btn btn-primary btn-sm"><Download size={14} /> Install</button>} />
- <EmptyState icon={Package} title="No Docker containers" description="Docker is not installed on this system." action={<button className="btn btn-primary btn-sm"><RefreshCw size={14} /> Retry</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} /> Quick Scan</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>} />
</div>
</div>
)}
@@ -953,24 +990,6 @@ export default function StyleGuide() {
{/* ── PAGE PATTERNS ── */}
{activeSection === 'patterns' && (
<div className="space-y-6">
- <SectionTitle title="Not-Installed Page Pattern" />
- <p className="text-sm text-secondary mb-2">When a service is not installed (Git, Docker, FTP, etc.), show a centered empty state with install action.</p>
- <EmptyState
- 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>}
- />
-
- <SectionTitle title="Service Unavailable Pattern" />
- <p className="text-sm text-secondary mb-2">When a service exists but can't connect.</p>
- <EmptyState
- 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>}
- />
-
<SectionTitle title="Card + Table Pattern" />
<p className="text-sm text-secondary mb-2">Standard layout for tabular data inside a card.</p>
<div className="card" style={{ padding: 24 }}>
@@ -1033,15 +1052,6 @@ export default function StyleGuide() {
))}
</div>
- <SectionTitle title="Page Loading State" />
- <p className="text-sm text-secondary mb-2">Full-page loading with centered spinner.</p>
- <div className="card" style={{ padding: 48 }}>
- <div className="flex flex-col items-center gap-3">
- <Spinner size="lg" />
- <span className="text-tertiary">Loading services...</span>
- </div>
- </div>
-
<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' }}>
diff --git a/frontend/src/styles/components/_empty-state.scss b/frontend/src/styles/components/_empty-state.scss
index 0f34186a..789ef2f4 100644
--- a/frontend/src/styles/components/_empty-state.scss
+++ b/frontend/src/styles/components/_empty-state.scss
@@ -30,4 +30,34 @@
&__action {
margin-top: $spacing-sm;
}
+
+ // Large variant — for full-page "not installed" / "unavailable" states
+ &--lg {
+ padding: $space-16 $space-8;
+ min-height: 400px;
+
+ .empty-state__icon {
+ opacity: 0.4;
+ margin-bottom: $space-6;
+ }
+
+ .empty-state__title {
+ font-size: $font-size-2xl;
+ }
+
+ .empty-state__description {
+ font-size: $font-size-base;
+ max-width: 480px;
+ margin-bottom: $space-6;
+ }
+
+ .empty-state__action {
+ margin-top: $space-4;
+ }
+ }
+
+ // Spinner inside empty state (loading variant)
+ .spinner {
+ margin-bottom: $spacing-md;
+ }
}
diff --git a/frontend/src/styles/pages/_ftp-server.scss b/frontend/src/styles/pages/_ftp-server.scss
index cec59d21..884bb721 100644
--- a/frontend/src/styles/pages/_ftp-server.scss
+++ b/frontend/src/styles/pages/_ftp-server.scss
@@ -17,7 +17,7 @@
}
.page-description {
- color: var(--text-secondary);
+ color: $text-secondary;
margin: 0;
}
}
@@ -47,7 +47,7 @@
.icon {
font-size: 64px;
- color: var(--text-tertiary);
+ color: $text-tertiary;
margin-bottom: 24px;
}
@@ -59,7 +59,7 @@
p {
margin: 0 0 24px 0;
- color: var(--text-secondary);
+ color: $text-secondary;
max-width: 400px;
}
}
@@ -78,7 +78,7 @@
padding: 20px;
background: var(--card-bg);
border-radius: 12px;
- border-left: 4px solid var(--border-color);
+ border-left: 4px solid $border-subtle;
&.success {
border-left-color: var(--success);
@@ -109,7 +109,7 @@
.status-label {
font-size: 13px;
- color: var(--text-secondary);
+ color: $text-secondary;
}
.status-value {
@@ -123,7 +123,7 @@
display: flex;
gap: 4px;
margin-bottom: 24px;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
.tab {
padding: 12px 20px;
@@ -131,17 +131,17 @@
border: none;
font-size: 14px;
font-weight: 500;
- color: var(--text-secondary);
+ color: $text-secondary;
cursor: pointer;
position: relative;
transition: color 0.2s;
&:hover {
- color: var(--text-primary);
+ color: $text-primary;
}
&.active {
- color: var(--primary);
+ color: $accent-primary;
&::after {
content: '';
@@ -150,7 +150,7 @@
left: 0;
right: 0;
height: 2px;
- background: var(--primary);
+ background: $accent-primary;
}
}
}
@@ -178,7 +178,7 @@
padding: 48px;
background: var(--card-bg);
border-radius: 8px;
- color: var(--text-tertiary);
+ color: $text-tertiary;
.icon {
font-size: 48px;
@@ -225,7 +225,7 @@
justify-content: space-between;
align-items: center;
padding: 8px 0;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
&:last-child {
border-bottom: none;
@@ -234,7 +234,7 @@
.config-label,
.info-label {
font-size: 13px;
- color: var(--text-secondary);
+ color: $text-secondary;
}
.config-value {
@@ -253,7 +253,7 @@
code {
font-family: var(--font-mono);
font-size: 13px;
- background: var(--bg-tertiary);
+ background: $bg-hover;
padding: 4px 8px;
border-radius: 4px;
}
@@ -279,15 +279,15 @@
}
th {
- background: var(--bg-tertiary);
+ background: $bg-hover;
font-size: 12px;
font-weight: 600;
text-transform: uppercase;
- color: var(--text-tertiary);
+ color: $text-tertiary;
}
td {
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
font-size: 13px;
&:last-child {
@@ -297,7 +297,7 @@
code {
font-family: var(--font-mono);
font-size: 12px;
- background: var(--bg-tertiary);
+ background: $bg-hover;
padding: 2px 6px;
border-radius: 4px;
}
@@ -322,7 +322,7 @@
&.badge-info {
background: rgba(var(--primary-rgb), 0.1);
- color: var(--primary);
+ color: $accent-primary;
}
&.badge-warning {
@@ -345,7 +345,7 @@
&.inactive {
background: rgba(156, 163, 175, 0.1);
- color: var(--text-tertiary);
+ color: $text-tertiary;
}
}
@@ -371,14 +371,14 @@
line-height: 1.6;
white-space: pre-wrap;
word-break: break-all;
- color: var(--text-secondary);
+ color: $text-secondary;
}
}
}
.install-info {
padding: 16px;
- background: var(--bg-tertiary);
+ background: $bg-hover;
border-radius: 8px;
margin-top: 16px;
@@ -388,7 +388,7 @@
line-height: 1.6;
strong {
- color: var(--primary);
+ color: $accent-primary;
}
}
}
diff --git a/frontend/src/styles/pages/_terminal.scss b/frontend/src/styles/pages/_terminal.scss
index 22583363..0230cde8 100644
--- a/frontend/src/styles/pages/_terminal.scss
+++ b/frontend/src/styles/pages/_terminal.scss
@@ -38,8 +38,8 @@
}
.logs-sidebar {
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-lg;
display: flex;
flex-direction: column;
@@ -50,7 +50,7 @@
align-items: center;
justify-content: space-between;
padding: $space-4;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
h3 {
font-size: $font-size-sm;
@@ -68,7 +68,7 @@
.empty-hint {
padding: $space-6;
text-align: center;
- color: var(--text-tertiary);
+ color: $text-tertiary;
font-size: $font-size-sm;
}
}
@@ -83,11 +83,11 @@
transition: all 0.15s ease;
&:hover {
- background: var(--bg-tertiary);
+ background: $bg-hover;
}
&.active {
- background: var(--primary);
+ background: $accent-primary;
color: white;
.log-file-path,
@@ -109,7 +109,7 @@
align-items: center;
justify-content: center;
flex-shrink: 0;
- background: var(--bg-tertiary);
+ background: $bg-hover;
svg {
stroke: currentColor;
@@ -152,7 +152,7 @@
.log-file-path {
font-size: $font-size-xs;
- color: var(--text-tertiary);
+ color: $text-tertiary;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -160,14 +160,14 @@
.log-file-size {
font-size: $font-size-xs;
- color: var(--text-tertiary);
+ color: $text-tertiary;
flex-shrink: 0;
}
}
.logs-viewer {
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-lg;
display: flex;
flex-direction: column;
@@ -180,7 +180,7 @@
justify-content: space-between;
gap: $space-4;
padding: $space-2 $space-4;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
flex-wrap: wrap;
.toolbar-left,
@@ -196,12 +196,12 @@
align-items: center;
gap: $space-2;
padding: $space-1 $space-2;
- background: var(--bg-tertiary);
- border: 1px solid var(--border-color);
+ background: $bg-hover;
+ border: 1px solid $border-subtle;
border-radius: $radius-md;
svg {
- stroke: var(--text-tertiary);
+ stroke: $text-tertiary;
fill: none;
stroke-width: 2;
flex-shrink: 0;
@@ -222,10 +222,10 @@
.lines-select {
padding: $space-1 $space-2;
- border: 1px solid var(--border-color);
+ border: 1px solid $border-subtle;
border-radius: $radius-sm;
- background: var(--bg-tertiary);
- color: var(--text-primary);
+ background: $bg-hover;
+ color: $text-primary;
font-size: $font-size-sm;
}
@@ -235,7 +235,7 @@
gap: $space-1;
cursor: pointer;
font-size: $font-size-sm;
- color: var(--text-secondary);
+ color: $text-secondary;
input {
cursor: pointer;
@@ -265,7 +265,7 @@
align-items: center;
justify-content: center;
height: 100%;
- color: var(--text-tertiary);
+ color: $text-tertiary;
svg {
stroke: currentColor;
@@ -307,15 +307,15 @@
label {
font-size: $font-size-xs;
font-weight: 500;
- color: var(--text-secondary);
+ color: $text-secondary;
}
input,
select {
padding: $space-1 $space-2;
- border: 1px solid var(--border-color);
+ border: 1px solid $border-subtle;
border-radius: $radius-sm;
- background: var(--bg-secondary);
+ background: $bg-card;
font-size: $font-size-sm;
}
@@ -339,21 +339,21 @@
.unit-chip {
padding: 2px $space-2;
- border: 1px solid var(--border-color);
+ border: 1px solid $border-subtle;
border-radius: $radius-full;
- background: var(--bg-secondary);
+ background: $bg-card;
font-size: $font-size-xs;
cursor: pointer;
transition: all 0.15s ease;
&:hover {
- border-color: var(--primary);
- color: var(--primary);
+ border-color: $accent-primary;
+ color: $accent-primary;
}
&.active {
- background: var(--primary);
- border-color: var(--primary);
+ background: $accent-primary;
+ border-color: $accent-primary;
color: white;
}
}
@@ -363,15 +363,15 @@
align-items: center;
gap: $space-2;
padding: $space-2 $space-4;
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-md;
font-size: $font-size-xs;
- color: var(--text-secondary);
+ color: $text-secondary;
margin-top: -$space-4;
svg { stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
- strong { color: var(--text-primary); }
+ strong { color: $text-primary; }
}
.journal-viewer {
@@ -419,17 +419,17 @@
select {
padding: $space-1 $space-2;
- border: 1px solid var(--border-color);
+ border: 1px solid $border-subtle;
border-radius: $radius-sm;
- background: var(--bg-secondary);
+ background: $bg-card;
font-size: $font-size-sm;
}
}
.processes-table-wrapper {
overflow-x: auto;
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-lg;
}
@@ -450,14 +450,14 @@
th {
position: sticky;
top: 0;
- background: var(--bg-secondary);
+ background: $bg-card;
z-index: 1;
font-weight: $font-weight-semibold;
color: $text-secondary;
font-size: $font-size-xs;
text-transform: uppercase;
letter-spacing: 0.03em;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
}
// Explicit column widths for alignment
@@ -475,7 +475,7 @@
transition: background 0.15s ease;
&:hover {
- background: var(--bg-tertiary);
+ background: $bg-hover;
}
&.selected {
@@ -484,7 +484,7 @@
}
tbody tr {
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
}
.mono {
@@ -543,8 +543,8 @@
}
.process-details-panel {
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-lg;
overflow: hidden;
@@ -553,7 +553,7 @@
align-items: center;
justify-content: space-between;
padding: $space-4;
- border-bottom: 1px solid var(--border-color);
+ border-bottom: 1px solid $border-subtle;
h3 {
font-size: $font-size-md;
@@ -579,7 +579,7 @@
.detail-label {
font-size: $font-size-xs;
- color: var(--text-tertiary);
+ color: $text-tertiary;
}
.detail-value {
@@ -595,19 +595,19 @@
.command-line {
margin-top: $space-4;
padding-top: $space-4;
- border-top: 1px solid var(--border-color);
+ border-top: 1px solid $border-subtle;
.detail-label {
display: block;
font-size: $font-size-xs;
- color: var(--text-tertiary);
+ color: $text-tertiary;
margin-bottom: $space-1;
}
code {
display: block;
padding: $space-2;
- background: var(--bg-tertiary);
+ background: $bg-hover;
border-radius: $radius-sm;
font-family: $font-mono;
font-size: $font-size-xs;
@@ -645,8 +645,8 @@
}
.service-card {
- background: var(--bg-secondary);
- border: 1px solid var(--border-color);
+ background: $bg-card;
+ border: 1px solid $border-subtle;
border-radius: $radius-lg;
padding: $space-4;
display: flex;
@@ -683,7 +683,7 @@
}
&.secondary {
- background: var(--text-tertiary);
+ background: $text-tertiary;
}
}
@@ -697,7 +697,7 @@
.service-description {
font-size: $font-size-xs;
- color: var(--text-secondary);
+ color: $text-secondary;
margin: 0;
}
@@ -705,10 +705,10 @@
display: flex;
gap: $space-4;
font-size: $font-size-xs;
- color: var(--text-tertiary);
+ color: $text-tertiary;
.meta-label {
- color: var(--text-secondary);
+ color: $text-secondary;
}
}
@@ -717,7 +717,7 @@
gap: $space-1;
margin-top: $space-2;
padding-top: $space-2;
- border-top: 1px solid var(--border-color);
+ border-top: 1px solid $border-subtle;
}
}