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.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
feat(setup): let the wizard pick the sidebar view, not just infer it
Juan Denisedf3177a6ca8
diff --git a/frontend/src/components/setup/SetupStepSummary.jsx b/frontend/src/components/setup/SetupStepSummary.jsxindex f86c2a56..586dfa89 100644--- a/frontend/src/components/setup/SetupStepSummary.jsx+++ b/frontend/src/components/setup/SetupStepSummary.jsx@@ -3,6 +3,12 @@ import { useResourceTier } from '../../contexts/ResourceTierContext';import { Sparkles, Check, Loader, AlertTriangle } from 'lucide-react';import { Badge } from '@/components/ui/badge';import api from '../../services/api';+import {+ SIDEBAR_ITEMS,+ SIDEBAR_PRESETS,+ presetForUseCases,+ visibleCountForPreset,+} from '../sidebarItems';const USE_CASE_LABELS = {wordpress: 'WordPress Sites',@@ -14,6 +20,14 @@ const USE_CASE_LABELS = {const SetupStepSummary = ({ accountInfo, useCases, onFinish }) => {const { tier, specs, loading } = useResourceTier();+ // Sidebar profile. Pre-selected from the use cases already picked, so the+ // default path is zero extra clicks — "Change" reveals the full set for+ // anyone who wants to tune it before landing on the dashboard. Seeded once:+ // this step unmounts when the user steps back, so returning here re-derives+ // the suggestion from any edited use cases without clobbering a live choice.+ const [sidebarPreset, setSidebarPreset] = useState(() => presetForUseCases(useCases));+ const [presetOpen, setPresetOpen] = useState(false);+// Recommended extensions (real slugs from the backend), the checked set, and// per-slug install status shown while finishing.const [recommendations, setRecommendations] = useState([]);@@ -82,7 +96,7 @@ const SetupStepSummary = ({ accountInfo, useCases, onFinish }) => {}}- await onFinish(installedSlugs);+ await onFinish(installedSlugs, sidebarPreset);}function formatSpecs() {@@ -167,6 +181,57 @@ const SetupStepSummary = ({ accountInfo, useCases, onFinish }) => {</div></div>+ <div className="summary-section">+ <div className="summary-section-title">Sidebar</div>+ <div className="summary-row">+ <span className="summary-label">View</span>+ <span className="summary-value summary-value--action">+ {SIDEBAR_PRESETS[sidebarPreset]?.label || 'Recommended'}+ <span className="summary-value-note">+ {visibleCountForPreset(sidebarPreset)} of {SIDEBAR_ITEMS.length} items+ </span>+ <button+ type="button"+ className="summary-change-btn"+ onClick={() => setPresetOpen((open) => !open)}+ aria-expanded={presetOpen}+ >+ {presetOpen ? 'Done' : 'Change'}+ </button>+ </span>+ </div>++ {presetOpen && (+ <div className="summary-preset-picker">+ <p className="recommendation-hint">+ Hidden pages stay reachable by URL and from search — this+ only trims the sidebar. Change it any time in Settings.+ </p>+ <div className="summary-preset-list">+ {Object.entries(SIDEBAR_PRESETS).map(([key, profile]) => (+ <button+ type="button"+ key={key}+ className={`summary-preset-card${sidebarPreset === key ? ' active' : ''}`}+ onClick={() => setSidebarPreset(key)}+ aria-pressed={sidebarPreset === key}+ >+ <span className="summary-preset-card__head">+ <span className="summary-preset-card__label">+ {profile.label}+ </span>+ {sidebarPreset === key && <Check size={14} />}+ </span>+ <span className="summary-preset-card__desc">+ {profile.description}+ </span>+ </button>+ ))}+ </div>+ </div>+ )}+ </div>+{(recsLoading || recommendations.length > 0) && (<div className="summary-section"><div className="summary-section-title">diff --git a/frontend/src/components/sidebarItems.js b/frontend/src/components/sidebarItems.jsindex 650c9e9d..24cbd598 100644--- a/frontend/src/components/sidebarItems.js+++ b/frontend/src/components/sidebarItems.js@@ -254,24 +254,47 @@ export const SIDEBAR_PRESETS = {},minimal: {label: 'Minimal',- description: 'Just the essentials — dashboard, servers, terminal',+ description: 'Core only — no databases, containers, or scheduling',hiddenItems: ['wordpress', 'workflow', 'databases', 'docker', 'git', 'email', 'cron', ...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).+// a fresh install opens tailored instead of showing every item. This is only the+// *suggestion* the Summary step pre-selects — the user can override it there (or+// later in Settings), so this deliberately stays coarse rather than trying to+// reach all six profiles from four intent checkboxes.+//+// The rule is "does one family of work dominate?": a purely WordPress install+// gets the web-hosting view, an install that is only container/CI work gets the+// DevOps view, and anything mixed falls back to 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';- }+ if (set.size === 0) return 'recommended';++ // Only WordPress → web hosting (Docker/Git/email hidden).+ if (set.size === 1 && set.has('wordpress')) return 'web';++ // Container/CI work with no WordPress in the mix → DevOps.+ const devopsIntents = ['web-apps', 'devops'];+ const everyIntentIsDevops = [...set].every((id) => devopsIntents.includes(id));+ if (everyIntentIsDevops) return 'devops';+return 'recommended';}+// Number of core sidebar items a preset leaves visible. Used by the Setup+// wizard to describe a profile ("14 of 18 items") before the user commits.+// Counts core items only — extension-contributed nav (WordPress, Git, Email)+// isn't resolvable until those extensions are installed.+export function visibleCountForPreset(presetKey) {+ const hidden = new Set(SIDEBAR_PRESETS[presetKey]?.hiddenItems || []);+ return SIDEBAR_ITEMS.filter(+ (item) => item.alwaysVisible || !hidden.has(item.id)+ ).length;+}+export function getHiddenItemIds(sidebarConfig) {const { preset = 'recommended', hiddenItems = [] } = sidebarConfig || {};diff --git a/frontend/src/contexts/AuthContext.jsx b/frontend/src/contexts/AuthContext.jsxindex 99a24dd2..fd49025a 100644--- a/frontend/src/contexts/AuthContext.jsx+++ b/frontend/src/contexts/AuthContext.jsx@@ -116,13 +116,16 @@ export function AuthProvider({ children }) {return data;}- async function completeOnboarding(useCases, installedExtensions = []) {+ async function completeOnboarding(useCases, installedExtensions = [], sidebarPreset = null) {await api.completeOnboarding(useCases, installedExtensions);- // 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.+ // Tailor the initial sidebar so a fresh install opens focused instead of+ // showing every item. The Summary step passes an explicit profile (which+ // it pre-selects from the use cases and the user may override); fall back+ // to deriving it here for any caller that doesn't. Best-effort: if it+ // fails, the sidebar just falls back to the "Recommended" default.try {- const sidebar_config = { preset: presetForUseCases(useCases), hiddenItems: [] };+ const preset = sidebarPreset || presetForUseCases(useCases);+ const sidebar_config = { preset, hiddenItems: [] };const res = await api.updateCurrentUser({ sidebar_config });if (res?.user) setUser(res.user);} catch {diff --git a/frontend/src/pages/Setup.jsx b/frontend/src/pages/Setup.jsxindex 24e41c0e..0699450f 100644--- a/frontend/src/pages/Setup.jsx+++ b/frontend/src/pages/Setup.jsx@@ -47,8 +47,8 @@ const Setup = () => {setCurrentStep(4);}- async function handleFinish(installedExtensions = []) {- await completeOnboarding(useCases, installedExtensions);+ async function handleFinish(installedExtensions = [], sidebarPreset = null) {+ await completeOnboarding(useCases, installedExtensions, sidebarPreset);navigate('/');}diff --git a/frontend/src/styles/pages/_setup-wizard.scss b/frontend/src/styles/pages/_setup-wizard.scssindex d0e9523a..14a66ba2 100644--- a/frontend/src/styles/pages/_setup-wizard.scss+++ b/frontend/src/styles/pages/_setup-wizard.scss@@ -348,6 +348,82 @@font-weight: $font-weight-medium;font-size: $font-size-sm;}++ // Sidebar-profile row: label, item count, and the "Change" toggle that+ // expands the preset picker inline.+ .summary-value--action {+ display: flex;+ align-items: center;+ gap: $space-3;+ }++ .summary-value-note {+ color: $text-tertiary;+ font-weight: $font-weight-normal;+ }+}++.summary-change-btn {+ background: none;+ border: none;+ padding: 0;+ cursor: pointer;+ color: $primary-color;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;++ &:hover {+ text-decoration: underline;+ }+}++.summary-preset-picker {+ margin-top: $space-3;+}++.summary-preset-list {+ display: grid;+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));+ gap: $space-2;+ margin-top: $space-3;+}++.summary-preset-card {+ display: flex;+ flex-direction: column;+ gap: $space-1;+ text-align: left;+ padding: $space-3;+ border: 1px solid $border-default;+ border-radius: $radius-md;+ background: $bg-card;+ cursor: pointer;+ transition: border-color 0.15s ease, background-color 0.15s ease;++ &:hover {+ border-color: $primary-color;+ }++ &.active {+ border-color: $primary-color;+ background: fade($accent-primary-raw, 8%);+ }++ &__head {+ display: flex;+ align-items: center;+ justify-content: space-between;+ gap: $space-2;+ color: $text-primary;+ font-size: $font-size-sm;+ font-weight: $font-weight-medium;+ }++ &__desc {+ color: $text-tertiary;+ font-size: $font-size-xs;+ line-height: 1.4;+ }}.summary-tags {