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.

feat(ui): add topbar layout variant to the layout switcher

Juan Denise738f3d50923
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index fcb329ed..8f3539b8 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -3,7 +3,7 @@ import { NavLink, useNavigate, useLocation } from 'react-router-dom';
import { useAuth } from '../contexts/AuthContext';
import { useTheme } from '../contexts/ThemeContext';
import { useLayout } from '../contexts/LayoutContext';
-import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronDown, ChevronUp, Layers, Palette, PanelLeft, PanelLeftClose, Check, X, Server } from 'lucide-react';
+import { Star, Settings, LogOut, Sun, Moon, Monitor, ChevronRight, ChevronDown, ChevronUp, Layers, Palette, PanelLeft, PanelLeftClose, PanelTop, Check, X, Server } from 'lucide-react';
import { api } from '../services/api';
import WorkspaceSwitcher from './WorkspaceSwitcher';
import { SIDEBAR_CATEGORIES, CATEGORY_LABELS, SIDEBAR_PRESETS, getHiddenItemIds, getVisibleItems } from './sidebarItems';
@@ -403,6 +403,16 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
>
<PanelLeftClose size={14} aria-hidden="true" />
</button>
+ <button
+ type="button"
+ className={`theme-btn ${layout === 'topbar' ? 'active' : ''}`}
+ onClick={() => setLayout('topbar')}
+ aria-label="Top bar layout"
+ aria-pressed={layout === 'topbar'}
+ title="Top bar"
+ >
+ <PanelTop size={14} aria-hidden="true" />
+ </button>
</div>
</div>
<div className="context-menu-section">
diff --git a/frontend/src/contexts/LayoutContext.jsx b/frontend/src/contexts/LayoutContext.jsx
index 8777275f..92047be9 100644
--- a/frontend/src/contexts/LayoutContext.jsx
+++ b/frontend/src/contexts/LayoutContext.jsx
@@ -5,7 +5,7 @@ const LayoutContext = createContext(null);
// Shell geometry options, kept in sync with the switcher in Sidebar and the
// [data-layout="..."] rules in styles/layout/_sidebar.scss. 'topbar' is reserved
// for a later phase; any unknown or stale stored value falls back to 'sidebar'.
-const LAYOUTS = ['sidebar', 'rail'];
+const LAYOUTS = ['sidebar', 'rail', 'topbar'];
const DEFAULT_LAYOUT = 'sidebar';
const normalize = (value) => (LAYOUTS.includes(value) ? value : DEFAULT_LAYOUT);
diff --git a/frontend/src/styles/layout/_sidebar.scss b/frontend/src/styles/layout/_sidebar.scss
index 9a1cbc11..50801f97 100644
--- a/frontend/src/styles/layout/_sidebar.scss
+++ b/frontend/src/styles/layout/_sidebar.scss
@@ -758,3 +758,108 @@
}
}
}
+
+// ============================================
+// TOP BAR LAYOUT — [data-layout="topbar"]
+// The sidebar becomes a horizontal bar pinned to the top. Top-level items lay
+// out in a horizontally-scrollable row; sub-items are reached from each page's
+// own in-page navigation. Desktop only: below $breakpoint-md the off-canvas
+// drawer is unchanged.
+// ============================================
+@media (min-width: ($breakpoint-md + 1)) {
+ [data-layout="topbar"] {
+ .main-content {
+ margin-left: 0;
+ margin-top: $header-height;
+ }
+
+ // Full-page tools size themselves to the viewport — subtract the bar.
+ .main-content--full-page,
+ .main-content:has(.workflow-page.fullscreen),
+ .main-content:has(.page-container--full-bleed) {
+ height: calc(100vh - #{$header-height});
+ }
+
+ .sidebar {
+ top: 0;
+ left: 0;
+ right: 0;
+ width: 100%;
+ height: $header-height;
+ flex-direction: row;
+ align-items: center;
+ gap: $space-3;
+ padding: 0 $space-4;
+ border-right: none;
+ border-bottom: 1px solid $border-subtle;
+ background: var(--bg-sidebar);
+ }
+
+ .brand-section {
+ height: auto;
+ margin-bottom: 0;
+ padding: 0;
+ flex-shrink: 0;
+ }
+
+ .workspace-switcher {
+ margin: 0;
+ flex-shrink: 0;
+ max-width: 170px;
+ }
+
+ // Nav fills the middle of the bar and scrolls horizontally if it runs long.
+ .nav-scroll {
+ flex: 1;
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ gap: $space-1;
+ overflow-x: auto;
+ overflow-y: hidden;
+ }
+
+ .nav {
+ flex-direction: row;
+ align-items: center;
+ gap: $space-1;
+ }
+
+ // No category headers, expand chevrons, or inline sub-items in the bar.
+ .nav-category,
+ .nav-expand-btn,
+ .nav-sub-item {
+ display: none;
+ }
+
+ .nav-item {
+ white-space: nowrap;
+ margin-bottom: 0;
+
+ // Active state reads as an underline rather than a left accent bar.
+ &.active::before {
+ inset: auto 0 -2px 0;
+ width: auto;
+ height: 2px;
+ transform: none;
+ border-radius: 2px 2px 0 0;
+ }
+ }
+
+ // User menu sits at the far right; its popover opens downward.
+ .sidebar-footer {
+ margin: 0 0 0 auto;
+ padding: 0;
+ border-top: none;
+ flex-shrink: 0;
+ }
+
+ .user-context-menu {
+ top: calc(100% + 4px);
+ bottom: auto;
+ left: auto;
+ right: 0;
+ min-width: 240px;
+ }
+ }
+}