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.

refactor(domains,git): ListToolbar + shared EmptyState

Juan Denis106a83778d94
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index 5558acfc..a4bc0572 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -16,7 +16,7 @@ import { Checkbox } from '@/components/ui/checkbox';
import {
Select, SelectTrigger, SelectContent, SelectItem, SelectValue,
} from '@/components/ui/select';
-import { SegControl, SearchField, Pill, Drawer, DataTable, SortMenu, ColumnsMenu, DataTableFooter, ViewMenu } from '@/components/ds';
+import { SegControl, SearchField, Pill, Drawer, DataTable, SortMenu, ColumnsMenu, DataTableFooter, ViewMenu, ListToolbar } from '@/components/ds';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
import { useTableViews } from '@/hooks/useTableViews';
@@ -464,23 +464,27 @@ const Domains = () => {
<div className="domains-body">
{/* No KPI strip: every number it carried is already on the
segment you would click to act on it. */}
- <div className="dom-listhead">
- <SegControl
- value={filter}
- onChange={setFilter}
- options={filterOptions}
- />
- <div className="dom-listhead__tools">
- <ViewMenu views={tableViews} />
- <SortMenu columns={domainColumns} sorts={sorts} onChange={setSorts} />
- <ColumnsMenu
- columns={domainColumns}
- hiddenKeys={hiddenKeys}
- onToggle={toggleColumn}
- onShowAll={showAllColumns}
+ <ListToolbar
+ filters={(
+ <SegControl
+ value={filter}
+ onChange={setFilter}
+ options={filterOptions}
/>
- </div>
- </div>
+ )}
+ tools={(
+ <>
+ <ViewMenu views={tableViews} />
+ <SortMenu columns={domainColumns} sorts={sorts} onChange={setSorts} />
+ <ColumnsMenu
+ columns={domainColumns}
+ hiddenKeys={hiddenKeys}
+ onToggle={toggleColumn}
+ onShowAll={showAllColumns}
+ />
+ </>
+ )}
+ />
{portfolioErrors.length > 0 && (
<div className="dom-portfolio-note">
@@ -495,9 +499,10 @@ const Domains = () => {
)}
{shown.length === 0 ? (
- <div className="dom-empty">
- {query ? `No domains match “${search.trim()}”.` : 'No domains match this filter.'}
- </div>
+ <EmptyState
+ icon={Globe}
+ title={query ? `No domains match “${search.trim()}”.` : 'No domains match this filter.'}
+ />
) : (
<div className="dom-card">
<DataTable
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index a92b1a05..e876fd0e 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -8,6 +8,7 @@ import EmptyState from '../components/EmptyState';
import Modal from '@/components/Modal';
import {
Pill, MetricCard, SegControl, Drawer, DataTable, SortMenu, ColumnsMenu, DataTableFooter,
+ ListToolbar,
} from '../components/ds';
import { useTableSort } from '@/hooks/useTableSort';
import { useColumnVisibility } from '@/hooks/useColumnVisibility';
@@ -802,9 +803,7 @@ function Git({ basePath = '/git' }) {
// ── Tab content ───────────────────────────────────────────
const renderOverview = () => (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">Server overview</h2>
- </div>
+ <ListToolbar title="Server overview" />
<div className="dom-specs">
<div className="sk-spec-card">
<div className="sk-spec-card__label">HTTP URL</div>
@@ -854,29 +853,33 @@ function Git({ basePath = '/git' }) {
}
return (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">Repositories</h2>
- <SegControl
- value={repoFilter}
- onChange={setRepoFilter}
- options={[
- { value: 'all', label: 'All', count: repositories.length },
- { value: 'private', label: 'Private', count: repoPrivateCount },
- { value: 'forks', label: 'Forks', count: repoForkCount },
- ]}
- />
- <div className="dom-listhead__tools">
- <SortMenu columns={REPO_COLUMNS} sorts={repoSorts} onChange={setRepoSorts} />
- <ColumnsMenu
- columns={REPO_COLUMNS}
- hiddenKeys={repoHiddenKeys}
- onToggle={toggleRepoColumn}
- onShowAll={showAllRepoColumns}
+ <ListToolbar
+ title="Repositories"
+ filters={(
+ <SegControl
+ value={repoFilter}
+ onChange={setRepoFilter}
+ options={[
+ { value: 'all', label: 'All', count: repositories.length },
+ { value: 'private', label: 'Private', count: repoPrivateCount },
+ { value: 'forks', label: 'Forks', count: repoForkCount },
+ ]}
/>
- </div>
- </div>
+ )}
+ tools={(
+ <>
+ <SortMenu columns={REPO_COLUMNS} sorts={repoSorts} onChange={setRepoSorts} />
+ <ColumnsMenu
+ columns={REPO_COLUMNS}
+ hiddenKeys={repoHiddenKeys}
+ onToggle={toggleRepoColumn}
+ onShowAll={showAllRepoColumns}
+ />
+ </>
+ )}
+ />
{filteredRepos.length === 0 ? (
- <div className="dom-empty">No repositories match this filter.</div>
+ <EmptyState icon={FolderGit2} title="No repositories match this filter." />
) : (
<div className="dom-card">
<DataTable
@@ -904,9 +907,7 @@ function Git({ basePath = '/git' }) {
const renderAccess = () => (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">Access information</h2>
- </div>
+ <ListToolbar title="Access information" />
<div className="dom-specs">
<div className="sk-spec-card">
<div className="sk-spec-card__label">HTTP Access</div>
@@ -948,29 +949,33 @@ function Git({ basePath = '/git' }) {
}
return (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">External repository webhooks</h2>
- <SegControl
- value={webhookFilter}
- onChange={setWebhookFilter}
- options={[
- { value: 'all', label: 'All', count: webhooks.length },
- { value: 'active', label: 'Active', count: webhookActiveCount },
- { value: 'inactive', label: 'Inactive', count: webhookInactiveCount },
- ]}
- />
- <div className="dom-listhead__tools">
- <SortMenu columns={WEBHOOK_COLUMNS} sorts={webhookSorts} onChange={setWebhookSorts} />
- <ColumnsMenu
- columns={WEBHOOK_COLUMNS}
- hiddenKeys={webhookHiddenKeys}
- onToggle={toggleWebhookColumn}
- onShowAll={showAllWebhookColumns}
+ <ListToolbar
+ title="External repository webhooks"
+ filters={(
+ <SegControl
+ value={webhookFilter}
+ onChange={setWebhookFilter}
+ options={[
+ { value: 'all', label: 'All', count: webhooks.length },
+ { value: 'active', label: 'Active', count: webhookActiveCount },
+ { value: 'inactive', label: 'Inactive', count: webhookInactiveCount },
+ ]}
/>
- </div>
- </div>
+ )}
+ tools={(
+ <>
+ <SortMenu columns={WEBHOOK_COLUMNS} sorts={webhookSorts} onChange={setWebhookSorts} />
+ <ColumnsMenu
+ columns={WEBHOOK_COLUMNS}
+ hiddenKeys={webhookHiddenKeys}
+ onToggle={toggleWebhookColumn}
+ onShowAll={showAllWebhookColumns}
+ />
+ </>
+ )}
+ />
{filteredWebhooks.length === 0 ? (
- <div className="dom-empty">No webhooks match this filter.</div>
+ <EmptyState icon={Webhook} title="No webhooks match this filter." />
) : (
<div className="dom-card">
<DataTable
@@ -1011,21 +1016,23 @@ function Git({ basePath = '/git' }) {
}
return (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">Deployment history</h2>
- <SegControl
- value={deploymentFilter}
- onChange={setDeploymentFilter}
- options={[
- { value: 'all', label: 'All', count: deployments.length },
- { value: 'success', label: 'Success', count: deploymentSuccessCount },
- { value: 'failed', label: 'Failed', count: deploymentFailedCount },
- { value: 'running', label: 'Running', count: deploymentRunningCount },
- ]}
- />
- </div>
+ <ListToolbar
+ title="Deployment history"
+ filters={(
+ <SegControl
+ value={deploymentFilter}
+ onChange={setDeploymentFilter}
+ options={[
+ { value: 'all', label: 'All', count: deployments.length },
+ { value: 'success', label: 'Success', count: deploymentSuccessCount },
+ { value: 'failed', label: 'Failed', count: deploymentFailedCount },
+ { value: 'running', label: 'Running', count: deploymentRunningCount },
+ ]}
+ />
+ )}
+ />
{filteredDeployments.length === 0 ? (
- <div className="dom-empty">No deployments match this filter.</div>
+ <EmptyState icon={Rocket} title="No deployments match this filter." />
) : (
<div className="dom-card">
{filteredDeployments.map(deployment => (
@@ -1061,9 +1068,7 @@ function Git({ basePath = '/git' }) {
const renderSettings = () => (
<>
- <div className="dom-listhead">
- <h2 className="dom-listhead__title">Server settings</h2>
- </div>
+ <ListToolbar title="Server settings" />
<div className="dom-specs">
<div className="sk-spec-card">
<div className="sk-spec-card__label">Server power</div>
diff --git a/frontend/src/styles/pages/_domains.scss b/frontend/src/styles/pages/_domains.scss
index 5e0ba3e2..eda00ba9 100644
--- a/frontend/src/styles/pages/_domains.scss
+++ b/frontend/src/styles/pages/_domains.scss
@@ -14,22 +14,6 @@
padding-top: $space-5;
}
-// Segmented filter above the table. The counts it carries replaced the KPI
-// strip that used to sit here — same numbers, on the control you'd click.
-.dom-listhead {
- display: flex;
- align-items: center;
- gap: $space-4;
- margin-bottom: $space-3;
-
- &__tools {
- display: flex;
- align-items: center;
- gap: $space-2;
- margin-left: auto;
- }
-}
-
// Table card
.dom-card {
background: var(--surface);
@@ -38,16 +22,6 @@
overflow: hidden;
}
-.dom-empty {
- padding: $space-10;
- text-align: center;
- color: $text-tertiary;
- font-size: $font-size-sm;
- background: var(--surface);
- border: 1px solid var(--border-soft);
- border-radius: var(--radius);
-}
-
// Domain cell bits
.dom-fav {
width: 30px;