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(ui): make top-bar chrome consistent across sections

Juan Denis1ae447f0fdff
diff --git a/frontend/src/components/ds/FilterDrawer.jsx b/frontend/src/components/ds/FilterDrawer.jsx
index abcdf102..e19752bb 100644
--- a/frontend/src/components/ds/FilterDrawer.jsx
+++ b/frontend/src/components/ds/FilterDrawer.jsx
@@ -61,6 +61,16 @@ export function FilterDrawer({
onChange,
title = 'Filters',
width = 380,
+ // Optional: how many rows the current selection yields. Given one, the
+ // confirm button reports it ("Show 45 templates") instead of a bare "Done",
+ // so the effect of a selection is visible before closing the drawer.
+ resultCount,
+ resultNoun = 'result',
+ // Optional: the host's own active-filter count. Pass the same number the
+ // FilterButton badge shows, so the two can never disagree — a host may
+ // legitimately not count a group whose value is just its default (a sort
+ // order sitting on "featured" is not a filter the user applied).
+ activeCount,
}) {
const isOn = (group, optValue) => (
group.type === 'multi'
@@ -81,7 +91,7 @@ export function FilterDrawer({
}
};
- const active = countActiveFilters(value);
+ const active = activeCount ?? countActiveFilters(value);
const clearAll = () => onChange(emptyFilterValue(groups));
return (
@@ -107,6 +117,12 @@ export function FilterDrawer({
aria-pressed={isOn(group, option.value)}
>
{option.label}
+ {/* An option may carry how many rows it would
+ match, so a dead-end filter is visible
+ before you spend a click on it. */}
+ {option.count != null && (
+ <span className="sk-filter__chip-count">{option.count}</span>
+ )}
</button>
))}
</div>
@@ -116,7 +132,11 @@ export function FilterDrawer({
<Button variant="ghost" size="sm" onClick={clearAll} disabled={!active}>
Clear all
</Button>
- <Button size="sm" onClick={() => onOpenChange(false)}>Done</Button>
+ <Button size="sm" onClick={() => onOpenChange(false)}>
+ {resultCount == null
+ ? 'Done'
+ : `Show ${resultCount} ${resultNoun}${resultCount === 1 ? '' : 's'}`}
+ </Button>
</div>
</div>
</Drawer>
diff --git a/frontend/src/components/ds/PageTopbar.jsx b/frontend/src/components/ds/PageTopbar.jsx
index 70a66f19..ceba04f3 100644
--- a/frontend/src/components/ds/PageTopbar.jsx
+++ b/frontend/src/components/ds/PageTopbar.jsx
@@ -12,21 +12,36 @@ import { useOverflowItems } from '@/hooks/useOverflowItems';
// <PageTopbar icon={<Globe/>} title="Domains"
// tabs={[{ to:'/domains', label:'Domains', end:true }, { to:'/dns', label:'DNS Zones' }]}
// actions={<Button>Add domain</Button>} />
-export function PageTopbar({ icon, title, meta, tabs, actions, className }) {
+//
+// Omitting `title` (what TabGroupLayout does) drops the title block entirely and
+// runs the tabs flush-left as the bar's primary navigation — the section is
+// already named by the lit sidebar item and the active tab, so repeating it as a
+// heading only pushed the tabs off the left edge. Entity pages that DO pass a
+// title (ServiceDetail, WordPressDetail, …) keep it: there the title names
+// *which* entity you are on, which nothing else in the bar says. Pass
+// `navLabel` to name the nav for assistive tech when there is no title.
+export function PageTopbar({ icon, title, meta, tabs, actions, className, navLabel }) {
const hasTabs = tabs && tabs.length > 0;
+ const hasTitle = !!title;
return (
- <header className={cn('sk-topbar', className)}>
- {icon && <span className="sk-topbar__ico">{icon}</span>}
- <div className="sk-topbar__titles">
- <h1 className="sk-topbar__title">{title}</h1>
- {meta && <span className="sk-topbar__meta">{meta}</span>}
- </div>
+ <header className={cn('sk-topbar', !hasTitle && 'sk-topbar--titleless', className)}>
+ {hasTitle && (
+ <>
+ {icon && <span className="sk-topbar__ico">{icon}</span>}
+ <div className="sk-topbar__titles">
+ <h1 className="sk-topbar__title">{title}</h1>
+ {meta && <span className="sk-topbar__meta">{meta}</span>}
+ </div>
+ </>
+ )}
{/* The tab nav grows to fill the bar; when there are more tabs than
fit, the overflow collapses into a "More" menu (so groups with
many sections — e.g. Security — stay on one row). Pages without
tabs keep the plain spacer that pushes actions to the right. */}
- {hasTabs ? <TopbarTabs tabs={tabs} label={title} /> : <div className="sk-topbar__spacer" />}
+ {hasTabs
+ ? <TopbarTabs tabs={tabs} label={navLabel || title || 'Page'} />
+ : <div className="sk-topbar__spacer" />}
{actions && <div className="sk-topbar__actions">{actions}</div>}
</header>
diff --git a/frontend/src/layouts/TabGroupLayout.jsx b/frontend/src/layouts/TabGroupLayout.jsx
index 5f07f99e..01627b3c 100644
--- a/frontend/src/layouts/TabGroupLayout.jsx
+++ b/frontend/src/layouts/TabGroupLayout.jsx
@@ -81,8 +81,10 @@ export default function TabGroupLayout({ tabs, groupId }) {
return merged;
}, [tabs, groupId, contributedTabs]);
- // Title + icon mirror the active tab so the header always matches the lit
- // sub-nav item.
+ // The group renders no page title: the tab strip IS the heading, so it runs
+ // flush-left in the bar (the active tab already names the section, as does
+ // the lit sidebar item). The active tab is still resolved to label the nav
+ // for assistive tech.
const active = useMemo(
() => mergedTabs.find((t) => matchTab(t, location.pathname)) || mergedTabs[0],
[mergedTabs, location.pathname]
@@ -91,8 +93,7 @@ export default function TabGroupLayout({ tabs, groupId }) {
return (
<div className="page-container page-container--full-bleed sk-tabgroup">
<PageTopbar
- icon={active.icon}
- title={active.label}
+ navLabel={active.label}
tabs={mergedTabs}
actions={actions}
/>
diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsx
index f81e6d99..9a337e0b 100644
--- a/frontend/src/pages/Email.jsx
+++ b/frontend/src/pages/Email.jsx
@@ -9,7 +9,7 @@
// outbound relay (smarthost), SpamAssassin, webmail, and the mail queue.
import { useState, useEffect, useCallback, useMemo } from 'react';
import {
- Mail, RefreshCw, Plus, Trash2, ShieldCheck, Server, Globe, Users,
+ RefreshCw, Plus, Trash2, ShieldCheck, Server, Globe, Users,
Send, Filter, Inbox, ExternalLink, CheckCircle2, XCircle, HelpCircle, Search,
} from 'lucide-react';
import api from '../services/api';
@@ -111,9 +111,7 @@ export default function Email() {
return (
<>
<PageTopbar
- icon={<Mail size={18} />}
- title="Email Server"
- meta="Postfix / Dovecot, domains, accounts, DKIM/SPF/DMARC"
+ navLabel="Email Server"
tabs={tabs}
actions={(
<Button variant="outline" size="sm" onClick={() => { loadStatus(); loadDomains(); }}>
diff --git a/frontend/src/pages/Git.jsx b/frontend/src/pages/Git.jsx
index b59f7100..10eff357 100644
--- a/frontend/src/pages/Git.jsx
+++ b/frontend/src/pages/Git.jsx
@@ -1030,7 +1030,7 @@ function Git({ basePath = '/git' }) {
return (
<div className="page-container--full-bleed sk-tabgroup git-page domains-page">
- <PageTopbar icon={activeGit.icon} title={activeGit.label} tabs={GIT_TABS} actions={topbarActions()} />
+ <PageTopbar navLabel={activeGit.label} tabs={GIT_TABS} actions={topbarActions()} />
<div className="sk-tabgroup__content">
<div className="sk-tabgroup__inner">
diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsx
index 73832df3..c8378d51 100644
--- a/frontend/src/pages/Terminal.jsx
+++ b/frontend/src/pages/Terminal.jsx
@@ -39,11 +39,7 @@ const Terminal = () => {
return (
<div className="page-container page-container--full-bleed terminal-page">
- <PageTopbar
- icon={<TerminalIcon size={18} />}
- title="Logs"
- tabs={TERMINAL_TABS}
- />
+ <PageTopbar navLabel="Logs" tabs={TERMINAL_TABS} />
<div className="tab-content">
{activeTab === 'shell' && <TerminalShellTab />}
diff --git a/frontend/src/styles/components/_ai-assistant.scss b/frontend/src/styles/components/_ai-assistant.scss
index a74a0d03..58e380f7 100644
--- a/frontend/src/styles/components/_ai-assistant.scss
+++ b/frontend/src/styles/components/_ai-assistant.scss
@@ -49,6 +49,19 @@ $sk-ai-z: 1100;
&:focus-visible { outline: 2px solid var(--sk-ai-accent); outline-offset: 3px; }
&.is-raised { bottom: 92px; } // lift above the serverkit-gui launcher on /servers/:id
&.is-busy { animation: sk-ai-pulse 1.6s ease-in-out infinite; }
+}
+
+// While any modal surface is open, the bubble steps aside. It is fixed at
+// bottom-right with a z-index far above Radix's dialog layer, so it floated over
+// every drawer and dialog in the app — and drawer footers put their primary
+// action in exactly that corner, so it was covering the "Deploy <template>"
+// button. Radix locks body scroll for the duration of a modal, which is the
+// app-wide signal; the :has() rule is a fallback in case that implementation
+// detail changes. Hiding (not nudging) is right: the modal's overlay owns the
+// interaction, so a floating assistant on top of it is only ever in the way.
+body[data-scroll-locked] .sk-ai-bubble,
+body:has([role='dialog'][data-state='open']) .sk-ai-bubble {
+ display: none;
@media (max-width: 768px) {
bottom: 88px;
diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scss
index 168411d5..29dae046 100644
--- a/frontend/src/styles/components/_design-system.scss
+++ b/frontend/src/styles/components/_design-system.scss
@@ -378,6 +378,13 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
min-height: 60px;
padding: 10px 4px;
margin-bottom: 4px;
+ // Its own surface, so the bar reads as chrome rather than as the first row
+ // of the content — and the same surface as the sidebar, so the two frame
+ // the page together. Solid rather than the design mock's translucent fill:
+ // the content scrolls in its own box below this bar, never under it, so
+ // alpha + backdrop-blur would cost a compositing layer to composite against
+ // a backdrop that never moves.
+ background: var(--bg-sidebar);
border-bottom: 1px solid var(--border-soft);
&__ico { color: var(--accent-bright); display: inline-flex; flex-shrink: 0; }
@@ -385,7 +392,19 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
&__title { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
&__meta { font-family: var(--mono); font-size: 11.5px; color: var(--text-faint); }
&__spacer { flex: 1; }
- &__actions { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
+ &__actions {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ flex-shrink: 0;
+
+ // House rule: the search box is ALWAYS the right-most control in the
+ // top bar, whatever order a page happens to publish its actions in.
+ // Enforced here rather than by convention at each call site, so it
+ // cannot drift and new pages get it for free. (Flex order defaults to
+ // 0, so lifting only the search field is enough.)
+ > .sk-searchfield { order: 1; }
+ }
// Routed sub-nav (the ex-sidebar sub-items). The nav is the flex-fill
// measurement region for PageTopbar's overflow logic; it is right-aligned so
@@ -414,6 +433,31 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
border: 1px solid var(--border);
border-radius: 10px;
}
+
+ // Title-less group header: the tabs lead the bar from the left edge and
+ // carry no enclosing segmented box — they read as the page's own heading
+ // row rather than a control parked beside a heading.
+ &--titleless {
+ .sk-topbar__tabs {
+ justify-content: flex-start;
+ margin-left: 0;
+ }
+ .sk-topbar__tabs-inner {
+ gap: 4px;
+ padding: 0;
+ background: none;
+ border: none;
+ border-radius: 0;
+ }
+ .sk-topbar__tab {
+ padding: 7px 13px;
+ border-radius: 9px;
+ color: var(--text-faint);
+ &:hover { background: var(--surface-2); color: var(--text); }
+ &.is-active { background: var(--accent-bg); color: var(--text); font-weight: 550; }
+ &.is-active svg { color: var(--accent-bright); }
+ }
+ }
&__tab {
display: inline-flex;
align-items: center;
@@ -575,6 +619,9 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
&__chips { display: flex; flex-wrap: wrap; gap: 7px; }
&__chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
padding: 6px 13px;
border-radius: 999px;
border: 1px solid var(--border);
@@ -594,6 +641,15 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');
}
}
+ // Optional per-option match count; quieter than the label it trails.
+ &__chip-count {
+ font-family: var(--mono);
+ font-size: 10px;
+ color: var(--text-ghost);
+ }
+
+ &__chip.is-on &__chip-count { color: inherit; opacity: 0.7; }
+
&__footer {
display: flex;
justify-content: space-between;