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(frontend): lean default sidebar + split Settings into account/admin

Juan Denisa5455c46551d
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index 3ea88301..a416f565 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -110,7 +110,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
}, []);
const conditions = { wpInstalled, gpuAvailable };
- const currentPreset = user?.sidebar_config?.preset || 'full';
+ const currentPreset = user?.sidebar_config?.preset || 'recommended';
const [manualExpanded, setManualExpanded] = useState({});
const [autoExpanded, setAutoExpanded] = useState(null);
const location = useLocation();
diff --git a/frontend/src/components/settings/SidebarSettings.jsx b/frontend/src/components/settings/SidebarSettings.jsx
index e59b35ad..1b3a2400 100644
--- a/frontend/src/components/settings/SidebarSettings.jsx
+++ b/frontend/src/components/settings/SidebarSettings.jsx
@@ -11,6 +11,7 @@ import {
import { Button } from '@/components/ui/button';
const PRESET_ICONS = {
+ recommended: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/></svg>,
full: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/></svg>,
web: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><circle cx="12" cy="12" r="10"/><line x1="2" y1="12" x2="22" y2="12"/><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"/></svg>,
email: <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor"><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"/><polyline points="22,6 12,13 2,6"/></svg>,
@@ -20,8 +21,8 @@ const PRESET_ICONS = {
const SidebarSettings = () => {
const { user, updateUser } = useAuth();
- const currentConfig = user?.sidebar_config || { preset: 'full', hiddenItems: [] };
- const [preset, setPreset] = useState(currentConfig.preset || 'full');
+ const currentConfig = user?.sidebar_config || { preset: 'recommended', hiddenItems: [] };
+ const [preset, setPreset] = useState(currentConfig.preset || 'recommended');
const [hiddenItems, setHiddenItems] = useState(currentConfig.hiddenItems || []);
const [saving, setSaving] = useState(false);
const [message, setMessage] = useState(null);
@@ -83,11 +84,11 @@ const SidebarSettings = () => {
};
const handleReset = () => {
- setPreset('full');
+ setPreset('recommended');
setHiddenItems([]);
};
- const hasChanges = preset !== (currentConfig.preset || 'full') ||
+ const hasChanges = preset !== (currentConfig.preset || 'recommended') ||
JSON.stringify(hiddenItems) !== JSON.stringify(currentConfig.hiddenItems || []);
return (
@@ -194,7 +195,7 @@ const SidebarSettings = () => {
<Button
variant="ghost"
onClick={handleReset}
- disabled={preset === 'full' && hiddenItems.length === 0}
+ disabled={preset === 'recommended' && hiddenItems.length === 0}
>
<RotateCcw size={14} />
Reset to Default
diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.js
index d2a7f657..aa3f1d27 100644
--- a/frontend/src/components/sidebarItems.js
+++ b/frontend/src/components/sidebarItems.js
@@ -209,8 +209,20 @@ export const SIDEBAR_ITEMS = [
}
];
+// "Advanced" items are powerful but not part of the everyday core for a solo
+// dev / small team: the Marketplace, the internal job-queue console, and the
+// Secrets & Webhooks vault. They're hidden by the default ("Recommended") view
+// and every curated preset, but stay one click away via the "Full" view or
+// Customize Sidebar — and remain fully routable (deep links, command palette).
+export const ADVANCED_ITEM_IDS = ['marketplace', 'queue', 'secrets'];
+
// Preset profiles define which items are hidden (top-level only)
export const SIDEBAR_PRESETS = {
+ recommended: {
+ label: 'Recommended',
+ description: 'Everyday essentials — advanced tools hidden',
+ hiddenItems: [...ADVANCED_ITEM_IDS]
+ },
full: {
label: 'Full',
description: 'All sidebar items visible',
@@ -219,27 +231,40 @@ export const SIDEBAR_PRESETS = {
web: {
label: 'Web Hosting',
description: 'Domains, SSL, databases, and web essentials',
- hiddenItems: ['docker', 'git', 'workflow', 'email', 'workspaces', 'marketplace']
+ hiddenItems: ['docker', 'git', 'workflow', 'email', 'workspaces', ...ADVANCED_ITEM_IDS]
},
email: {
label: 'Email Admin',
description: 'Email server, security, DNS, and monitoring',
- hiddenItems: ['services', 'wordpress', 'workflow', 'databases', 'docker', 'git', 'cron', 'workspaces', 'marketplace']
+ hiddenItems: ['services', 'wordpress', 'workflow', 'databases', 'docker', 'git', 'cron', 'workspaces', ...ADVANCED_ITEM_IDS]
},
devops: {
label: 'Docker / DevOps',
description: 'Docker, Git, monitoring, and CI/CD tools',
- hiddenItems: ['wordpress', 'email', 'marketplace']
+ hiddenItems: ['wordpress', 'email', ...ADVANCED_ITEM_IDS]
},
minimal: {
label: 'Minimal',
description: 'Just the essentials — dashboard, servers, terminal',
- hiddenItems: ['wordpress', 'workflow', 'databases', 'docker', 'git', 'email', 'cron', 'workspaces', 'marketplace']
+ hiddenItems: ['wordpress', 'workflow', 'databases', 'docker', 'git', 'email', 'cron', 'workspaces', ...ADVANCED_ITEM_IDS]
}
};
+// Map the Setup wizard's "use case" selections to an initial sidebar preset, so
+// a fresh install opens tailored instead of showing every item. Only a single,
+// focused intent picks a specialized profile; mixed or general installs get the
+// lean "Recommended" baseline (which still surfaces the common pages).
+export function presetForUseCases(useCases = []) {
+ const set = new Set((useCases || []).filter(Boolean));
+ if (set.size === 1) {
+ if (set.has('wordpress')) return 'web';
+ if (set.has('devops')) return 'devops';
+ }
+ return 'recommended';
+}
+
export function getHiddenItemIds(sidebarConfig) {
- const { preset = 'full', hiddenItems = [] } = sidebarConfig || {};
+ const { preset = 'recommended', hiddenItems = [] } = sidebarConfig || {};
const hidden = preset === 'custom'
? hiddenItems
diff --git a/frontend/src/contexts/AuthContext.jsx b/frontend/src/contexts/AuthContext.jsx
index 4e088a9e..cac554c9 100644
--- a/frontend/src/contexts/AuthContext.jsx
+++ b/frontend/src/contexts/AuthContext.jsx
@@ -1,5 +1,6 @@
import React, { createContext, useContext, useState, useEffect } from 'react';
import api from '../services/api';
+import { presetForUseCases } from '../components/sidebarItems';
const AuthContext = createContext(null);
@@ -106,6 +107,16 @@ export function AuthProvider({ children }) {
async function completeOnboarding(useCases) {
await api.completeOnboarding(useCases);
+ // Tailor the initial sidebar to the use cases picked during setup, so a
+ // fresh install opens focused instead of showing every item. Best-effort:
+ // if it fails, the sidebar just falls back to the "Recommended" default.
+ try {
+ const sidebar_config = { preset: presetForUseCases(useCases), hiddenItems: [] };
+ const res = await api.updateCurrentUser({ sidebar_config });
+ if (res?.user) setUser(res.user);
+ } catch {
+ /* ignore — sidebar preset is a non-critical nicety */
+ }
setSetupStatus(prev => ({
...prev,
needsSetup: false,
diff --git a/frontend/src/pages/Settings.jsx b/frontend/src/pages/Settings.jsx
index e7b73428..96b72bd0 100644
--- a/frontend/src/pages/Settings.jsx
+++ b/frontend/src/pages/Settings.jsx
@@ -26,12 +26,22 @@ import { useNavigate } from 'react-router-dom';
const VALID_TABS = ['profile', 'security', 'connections', 'appearance', 'sidebar', 'whitelabel', 'notifications', 'system', 'users', 'activity', 'site', 'sso', 'api', 'ai', 'migrations', 'developer', 'about'];
+// Tabs that belong to the server-wide "Administration" group (admin-only); the
+// rest are personal "My Account" settings. Drives the two-way section switch so
+// personal prefs aren't interleaved with destructive system controls.
+const ADMIN_TABS = ['users', 'activity', 'site', 'sso', 'api', 'ai', 'migrations', 'system', 'developer'];
+
const Settings = () => {
const [activeTab, setActiveTab] = useTabParam('/settings', VALID_TABS);
const { isAdmin } = useAuth();
const [devMode, setDevMode] = useState(false);
const navigate = useNavigate();
+ // Which top-level settings group is showing. Derived from the active tab so
+ // deep links (e.g. /settings/users) open the right group; non-admins only
+ // ever see "My Account", so any admin tab collapses back to it for them.
+ const activeGroup = isAdmin && ADMIN_TABS.includes(activeTab) ? 'admin' : 'account';
+
useEffect(() => {
if (isAdmin) {
api.getSystemSettings().then(data => {
@@ -46,7 +56,30 @@ const Settings = () => {
<div className="settings-layout">
<nav className="settings-nav">
- <div className="settings-nav-divider">Account</div>
+ {isAdmin && (
+ <div className="settings-nav-groups" role="tablist" aria-label="Settings section">
+ <button
+ type="button"
+ role="tab"
+ aria-selected={activeGroup === 'account'}
+ className={`settings-nav-group ${activeGroup === 'account' ? 'active' : ''}`}
+ onClick={() => setActiveTab('profile')}
+ >
+ My Account
+ </button>
+ <button
+ type="button"
+ role="tab"
+ aria-selected={activeGroup === 'admin'}
+ className={`settings-nav-group ${activeGroup === 'admin' ? 'active' : ''}`}
+ onClick={() => setActiveTab('users')}
+ >
+ Admin
+ </button>
+ </div>
+ )}
+ {activeGroup === 'account' && (
+ <>
<Button
variant="ghost"
className={`settings-nav-item ${activeTab === 'profile' ? 'active' : ''}`}
@@ -126,9 +159,36 @@ const Settings = () => {
<Layers size={18} />
White Label
</Button>
- {isAdmin && (
+ {import.meta.env.DEV && !devMode && !isAdmin && (
+ <>
+ <div className="settings-nav-divider">Local Dev</div>
+ <Button
+ variant="ghost"
+ className="settings-nav-item"
+ onClick={() => navigate('/style-guide')}
+ >
+ <PaintBucket size={18} />
+ Style Guide
+ </Button>
+ </>
+ )}
+ <div className="settings-nav-spacer" />
+ <Button
+ variant="ghost"
+ className={`settings-nav-item ${activeTab === 'about' ? 'active' : ''}`}
+ onClick={() => setActiveTab('about')}
+ >
+ <svg viewBox="0 0 24 24" width="18" height="18">
+ <circle cx="12" cy="12" r="10"/>
+ <line x1="12" y1="16" x2="12" y2="12"/>
+ <line x1="12" y1="8" x2="12.01" y2="8"/>
+ </svg>
+ About
+ </Button>
+ </>
+ )}
+ {activeGroup === 'admin' && isAdmin && (
<>
- <div className="settings-nav-divider">Admin</div>
<Button
variant="ghost"
className={`settings-nav-item ${activeTab === 'users' ? 'active' : ''}`}
@@ -209,54 +269,31 @@ const Settings = () => {
</svg>
System Info
</Button>
+ {(devMode || import.meta.env.DEV) && (
+ <>
+ <div className="settings-nav-divider">{devMode ? 'Developer' : 'Local Dev'}</div>
+ {devMode && (
+ <Button
+ variant="ghost"
+ className={`settings-nav-item ${activeTab === 'developer' ? 'active' : ''}`}
+ onClick={() => setActiveTab('developer')}
+ >
+ <Code size={18} />
+ Icon Reference
+ </Button>
+ )}
+ <Button
+ variant="ghost"
+ className="settings-nav-item"
+ onClick={() => navigate('/style-guide')}
+ >
+ <PaintBucket size={18} />
+ Style Guide
+ </Button>
+ </>
+ )}
</>
)}
- {devMode && isAdmin && (
- <>
- <div className="settings-nav-divider">Developer</div>
- <Button
- variant="ghost"
- className={`settings-nav-item ${activeTab === 'developer' ? 'active' : ''}`}
- onClick={() => setActiveTab('developer')}
- >
- <Code size={18} />
- Icon Reference
- </Button>
- <Button
- variant="ghost"
- className="settings-nav-item"
- onClick={() => navigate('/style-guide')}
- >
- <PaintBucket size={18} />
- Style Guide
- </Button>
- </>
- )}
- {import.meta.env.DEV && !devMode && (
- <>
- <div className="settings-nav-divider">Local Dev</div>
- <Button
- variant="ghost"
- className="settings-nav-item"
- onClick={() => navigate('/style-guide')}
- >
- <PaintBucket size={18} />
- Style Guide
- </Button>
- </>
- )}
- <Button
- variant="ghost"
- className={`settings-nav-item ${activeTab === 'about' ? 'active' : ''}`}
- onClick={() => setActiveTab('about')}
- >
- <svg viewBox="0 0 24 24" width="18" height="18">
- <circle cx="12" cy="12" r="10"/>
- <line x1="12" y1="16" x2="12" y2="12"/>
- <line x1="12" y1="8" x2="12.01" y2="8"/>
- </svg>
- About
- </Button>
</nav>
<div className="settings-content">
diff --git a/frontend/src/styles/pages/_settings.scss b/frontend/src/styles/pages/_settings.scss
index 42f9858c..4c2b2ba6 100644
--- a/frontend/src/styles/pages/_settings.scss
+++ b/frontend/src/styles/pages/_settings.scss
@@ -49,6 +49,47 @@
}
}
+// Two-way section switch (My Account / Admin) at the top of the settings rail
+.settings-nav-groups {
+ display: grid;
+ grid-template-columns: 1fr 1fr;
+ gap: $space-1;
+ padding: $space-1;
+ margin-bottom: $space-3;
+ background: $bg-card;
+ border: 1px solid $border-color;
+ border-radius: $radius-md;
+
+ @media (max-width: $breakpoint-lg) {
+ flex-basis: 100%;
+ width: 100%;
+ }
+}
+
+.settings-nav-group {
+ appearance: none;
+ border: none;
+ background: transparent;
+ padding: $space-2 $space-3;
+ border-radius: $radius-sm;
+ color: $text-secondary;
+ font-size: $font-size-sm;
+ font-weight: $font-weight-semibold;
+ cursor: pointer;
+ transition: all $transition-fast;
+ white-space: nowrap;
+
+ &:hover {
+ color: $text-primary;
+ background: $bg-hover;
+ }
+
+ &.active {
+ background: var(--accent-bg);
+ color: var(--accent-bright);
+ }
+}
+
.settings-nav-item,
.settings-nav-item.settings-nav-item {
display: flex;