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(palette): create tile grid + recipes; the sidebar + opens the palette

Juan Denis8b7cecb62e60
diff --git a/frontend/src/components/CommandPalette.jsx b/frontend/src/components/CommandPalette.jsx
index 5a7619af..a20bf954 100644
--- a/frontend/src/components/CommandPalette.jsx
+++ b/frontend/src/components/CommandPalette.jsx
@@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next';
import { translateLabel } from '../i18n/labels';
import {
History, SlidersHorizontal, LayoutGrid, Zap, Server, Globe,
- Database, Boxes, Puzzle, BookOpen, KeyRound, Clock, ExternalLink, Star,
+ Database, Boxes, Puzzle, BookOpen, BookOpenCheck, KeyRound, Clock,
+ ExternalLink, Minus, Plus, Star,
} from 'lucide-react';
import api from '../services/api';
import {
@@ -17,8 +18,11 @@ import {
} from '@/components/ui/command';
import { useContributions } from '../plugins/contributions';
import { useAuth } from '../contexts/AuthContext';
+import { useShellDock } from '../contexts/ShellDockContext';
import { useTheme } from '../contexts/ThemeContext';
+import { useWalkthroughs } from '../contexts/walkthroughContextValue';
import usePaletteAuthz from '../hooks/usePaletteAuthz';
+import { CREATE_ITEMS } from '../data/createItems';
import { PALETTE_PAGES } from '../data/palettePages';
import { SETTINGS_INDEX } from '../data/settingsIndex';
import { COMMAND_ACTIONS } from '../data/commandActions';
@@ -30,10 +34,13 @@ import { getFavorites, getRecents } from '../utils/recents';
// Group order in the list, plus a per-category icon and a scoring weight so the
// headline categories (Settings, Pages, Actions) outrank raw entity hits on ties.
const GROUP_ORDER = [
+ 'Create', 'Recipes',
'Favorites', 'Recently used', 'Settings', 'Pages', 'Actions', 'Services', 'Servers',
'Domains', 'Databases', 'Sites', 'Cron Jobs', 'Vaults', 'Extensions', 'Docs',
];
const CATEGORY_ICONS = {
+ Create: Plus,
+ Recipes: BookOpenCheck,
Favorites: Star,
'Recently used': History,
Settings: SlidersHorizontal,
@@ -50,6 +57,7 @@ const CATEGORY_ICONS = {
Docs: BookOpen,
};
const CATEGORY_WEIGHT = {
+ Create: 5, Recipes: 3,
Favorites: 5,
Settings: 6, Pages: 4, Actions: 4, Services: 2, Servers: 2, Domains: 2,
Databases: 2, Sites: 2, 'Cron Jobs': 1, Vaults: 1, Extensions: 1, Docs: 0,
@@ -104,6 +112,9 @@ const CommandPalette = ({ open, onClose }) => {
const { logout } = useAuth();
const { resolvedTheme, setTheme, whiteLabel } = useTheme();
const { allowItem } = usePaletteAuthz();
+ const { walkthroughs, start: startWalkthrough } = useWalkthroughs();
+ const { openTab } = useShellDock();
+ const [showMoreCreates, setShowMoreCreates] = useState(false);
// Prefix modes: `>` = actions only, `?` = docs only, bare = everything.
const { mode, term } = useMemo(() => {
@@ -114,8 +125,10 @@ const CommandPalette = ({ open, onClose }) => {
// Reset transient state each time the palette opens/closes.
useEffect(() => {
- if (open) setQuery('');
- else setEntityItems([]);
+ if (open) {
+ setQuery('');
+ setShowMoreCreates(false);
+ } else setEntityItems([]);
}, [open]);
// --- Sync providers ------------------------------------------------------
@@ -165,6 +178,38 @@ const CommandPalette = ({ open, onClose }) => {
[pluginPaletteItems, t],
);
+ // Create tiles (shared with the sidebar "+") — the palette's empty state
+ // leads with them, prototype-style, so ⌘K is also the "new thing" door.
+ const createItems = useMemo(() => CREATE_ITEMS.map((item) => ({
+ id: `create:${item.kind}`,
+ label: translateLabel(t, item),
+ keywords: `new create add ${item.kind}`,
+ path: item.path,
+ icon: item.icon,
+ more: item.more,
+ category: 'Create',
+ })), [t]);
+
+ // Extension-contributed "New …" commands join the hidden shelf of the
+ // Create grid, so the expander truthfully says "including extensions".
+ const pluginCreateItems = useMemo(
+ () => pluginItems
+ .filter((item) => /^(new|create)\b/i.test(item.label))
+ .map((item) => ({
+ ...item, id: `create-ext:${item.id}`, category: 'Create', icon: Puzzle, more: true, ext: true,
+ })),
+ [pluginItems],
+ );
+
+ const recipeItems = useMemo(() => walkthroughs.map((walkthrough) => ({
+ id: `recipe:${walkthrough.id}`,
+ label: walkthrough.title,
+ keywords: 'recipe walkthrough guide setup steps',
+ meta: t('palette.recipeSteps', '{{count}} steps', { count: walkthrough.steps.length }),
+ recipeId: walkthrough.id,
+ category: 'Recipes',
+ })), [t, walkthroughs]);
+
const docItems = useMemo(() => {
if (whiteLabel?.enabled) return [];
return DOCS_ENTRIES
@@ -241,6 +286,10 @@ const CommandPalette = ({ open, onClose }) => {
if (!t) {
if (mode === 'actions') return capGroups(actionItems);
if (mode === 'docs') return capGroups(docItems);
+ const creates = [
+ ...createItems.filter((item) => !item.more || showMoreCreates),
+ ...(showMoreCreates ? pluginCreateItems : []),
+ ];
const pool = [...settingsItems, ...pageItems, ...actionItems, ...pluginItems, ...docItems];
const byId = new Map(pool.map((i) => [i.id, i]));
const recents = recentIds(8)
@@ -251,19 +300,24 @@ const CommandPalette = ({ open, onClose }) => {
? recents
: pageItems.slice(0, 6).map((i) => ({ ...i, category: 'Recently used' }));
const suggestions = actionItems.filter((a) => a.suggested).slice(0, 4);
- return capGroups([
- ...favoriteItems.slice(0, 4),
- ...visitItems,
- ...base,
- ...suggestions,
- ], 8, OVERALL_CAP);
+ return [
+ ...creates,
+ ...recipeItems,
+ ...capGroups([
+ ...favoriteItems.slice(0, 4),
+ ...visitItems,
+ ...base,
+ ...suggestions,
+ ], 8, OVERALL_CAP),
+ ];
}
const syncPool = mode === 'actions'
? actionItems
: mode === 'docs'
? docItems
- : [...settingsItems, ...pageItems, ...actionItems, ...pluginItems, ...docItems,
+ : [...createItems, ...pluginCreateItems, ...recipeItems,
+ ...settingsItems, ...pageItems, ...actionItems, ...pluginItems, ...docItems,
...favoriteItems, ...visitItems];
const scored = [];
@@ -285,12 +339,18 @@ const CommandPalette = ({ open, onClose }) => {
}
scored.sort((a, b) => b._score - a._score);
return capGroups(scored);
- }, [term, mode, settingsItems, pageItems, actionItems, pluginItems, docItems, entityItems]);
+ }, [term, mode, settingsItems, pageItems, actionItems, pluginItems, docItems, entityItems,
+ createItems, pluginCreateItems, recipeItems, showMoreCreates, favoriteItems, visitItems]);
// --- Selection -----------------------------------------------------------
const handleSelect = useCallback((item) => {
recordUse(item.id);
onClose();
+ if (item.recipeId) {
+ startWalkthrough(item.recipeId);
+ openTab('recipes');
+ return;
+ }
if (typeof item.perform === 'function') {
item.perform({
navigate,
@@ -305,7 +365,7 @@ const CommandPalette = ({ open, onClose }) => {
return;
}
navigate(item.path);
- }, [navigate, onClose, logout, resolvedTheme, setTheme]);
+ }, [navigate, onClose, logout, resolvedTheme, setTheme, startWalkthrough, openTab]);
// Group + order for rendering.
const grouped = useMemo(() => {
@@ -321,10 +381,10 @@ const CommandPalette = ({ open, onClose }) => {
}, [results]);
const placeholder = mode === 'actions'
- ? 'Run an action…'
+ ? t('palette.placeholderActions', 'Run an action…')
: mode === 'docs'
- ? 'Search docs…'
- : 'Search pages, settings, actions, services…';
+ ? t('palette.placeholderDocs', 'Search docs…')
+ : t('palette.placeholderAll', 'Search, or create something new…');
return (
<CommandDialog
@@ -342,26 +402,74 @@ const CommandPalette = ({ open, onClose }) => {
<CommandEmpty>{t('common.state.noResults', 'No results found')}</CommandEmpty>
{grouped.map(([category, items]) => {
const Icon = CATEGORY_ICONS[category] || LayoutGrid;
+
+ // Empty-query Create group renders as the prototype's tile
+ // grid with the "+ n more" shelf toggle underneath.
+ if (category === 'Create' && !term.trim()) {
+ const hiddenCount = createItems.filter((item) => item.more).length
+ + pluginCreateItems.length;
+ return (
+ <CommandGroup key={category} heading={category} className="command-palette__create">
+ {items.map((item) => {
+ const TileIcon = item.icon || Plus;
+ return (
+ <CommandItem
+ key={item.id}
+ value={item.id}
+ className="command-palette__tile"
+ onSelect={() => handleSelect(item)}
+ >
+ {item.ext && <Puzzle className="command-palette__tile-ext" aria-hidden="true" />}
+ <span className="command-palette__tile-icon"><TileIcon aria-hidden="true" /></span>
+ <span className="command-palette__tile-label">{item.label}</span>
+ </CommandItem>
+ );
+ })}
+ {hiddenCount > 0 && (
+ <button
+ type="button"
+ className="command-palette__more"
+ onClick={() => setShowMoreCreates((value) => !value)}
+ >
+ {showMoreCreates ? (
+ <><Minus size={12} aria-hidden="true" /> {t('palette.showFewer', 'Show fewer')}</>
+ ) : (
+ <><Plus size={12} aria-hidden="true" /> {pluginCreateItems.length
+ ? t('palette.moreIncludingExtensions', '{{count}} more · including extensions', { count: hiddenCount })
+ : t('palette.moreCreates', '{{count}} more', { count: hiddenCount })}</>
+ )}
+ </button>
+ )}
+ </CommandGroup>
+ );
+ }
+
return (
<CommandGroup key={category} heading={category}>
- {items.map((item) => (
- <CommandItem
- key={item.id}
- value={item.id}
- onSelect={() => handleSelect(item)}
- >
- <Icon className="command-palette__item-icon" aria-hidden="true" />
- <span className="command-palette__item-body">
- <span className="command-palette__item-label">{item.label}</span>
- {item.sublabel && (
- <span className="command-palette__item-sublabel">{item.sublabel}</span>
+ {items.map((item) => {
+ const ItemIcon = item.icon || Icon;
+ return (
+ <CommandItem
+ key={item.id}
+ value={item.id}
+ onSelect={() => handleSelect(item)}
+ >
+ <ItemIcon className="command-palette__item-icon" aria-hidden="true" />
+ <span className="command-palette__item-body">
+ <span className="command-palette__item-label">{item.label}</span>
+ {item.sublabel && (
+ <span className="command-palette__item-sublabel">{item.sublabel}</span>
+ )}
+ </span>
+ {item.meta && (
+ <span className="command-palette__item-meta mono">{item.meta}</span>
+ )}
+ {item.external && (
+ <ExternalLink className="command-palette__item-ext" aria-hidden="true" />
)}
- </span>
- {item.external && (
- <ExternalLink className="command-palette__item-ext" aria-hidden="true" />
- )}
- </CommandItem>
- ))}
+ </CommandItem>
+ );
+ })}
</CommandGroup>
);
})}
diff --git a/frontend/src/components/QuickCreate.jsx b/frontend/src/components/QuickCreate.jsx
index 2cedf4e6..c15fc952 100644
--- a/frontend/src/components/QuickCreate.jsx
+++ b/frontend/src/components/QuickCreate.jsx
@@ -1,63 +1,27 @@
-import { useNavigate } from 'react-router-dom';
-import {
- Plus, Boxes, Server, Activity, Globe, LayoutGrid, FolderKanban, Clock,
-} from 'lucide-react';
-import {
- DropdownMenu,
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuTrigger,
-} from '@/components/ui/dropdown-menu';
+import { Plus } from 'lucide-react';
import { cn } from '@/lib/utils';
import { useTranslation } from 'react-i18next';
-import { translateLabel } from '../i18n/labels';
-
-// Global quick-create (the CRM "+" button). One entry point for every "new
-// thing" flow, wherever you are. Route-based flows navigate directly; flows
-// that live in a modal/drawer on a list page navigate with a
-// `?focus=create:<kind>` deep link, which the destination page opens via
-// useFocusParam.
-const CREATE_ITEMS = [
- { kind: 'service', labelKey: 'common.labels.service', label: 'Service', icon: Boxes, path: '/services/new' },
- { kind: 'server', labelKey: 'common.labels.server', label: 'Server', icon: Server, path: '/servers?focus=create:server' },
- { kind: 'monitor', labelKey: 'app.quickCreate.monitor', label: 'Monitor', icon: Activity, path: '/monitoring/monitors?focus=create:monitor' },
- { kind: 'domain', labelKey: 'common.labels.domain', label: 'Domain', icon: Globe, path: '/domains?focus=create:domain' },
- { kind: 'cron', labelKey: 'app.quickCreate.cronJob', label: 'Cron job', icon: Clock, path: '/cron?focus=create:cron' },
- { kind: 'workspace', labelKey: 'common.labels.workspace', label: 'Workspace', icon: LayoutGrid, path: '/workspaces?focus=create:workspace' },
- { kind: 'project', labelKey: 'common.labels.project', label: 'Project', icon: FolderKanban, path: '/projects?focus=create:project' },
-];
+// Global quick-create (the "+" button beside the brand). It used to carry its
+// own little dropdown; now it opens the command palette, whose empty state
+// leads with the Create tile grid (see data/createItems.js) plus recipes and
+// search — one door for every "new thing" flow. DashboardLayout listens for
+// the event because the palette's open state lives there.
export function QuickCreate({ className, variant = 'icon' }) {
const { t } = useTranslation();
- const navigate = useNavigate();
// 'icon' — compact square button (mobile top bar). 'header' — the accent
// create button beside the ServerKit mark and GitHub star.
const header = variant === 'header';
return (
- <DropdownMenu>
- <DropdownMenuTrigger asChild>
- <button
- type="button"
- className={cn('quick-create', header && 'quick-create--header', className)}
- title={t('app.quickCreate.createNew', 'Create new…')}
- aria-label={t('app.quickCreate.createNew2', 'Create new')}
- >
- <Plus size={header ? 15 : 16} />
- </button>
- </DropdownMenuTrigger>
- <DropdownMenuContent
- side={header ? 'bottom' : 'top'}
- align="end"
- sideOffset={8}
- >
- {CREATE_ITEMS.map((item) => (
- <DropdownMenuItem key={item.kind} onSelect={() => navigate(item.path)}>
- <item.icon size={14} aria-hidden="true" />
- {t('app.quickCreate.new', 'New')} {translateLabel(t, item)}
- </DropdownMenuItem>
- ))}
- </DropdownMenuContent>
- </DropdownMenu>
+ <button
+ type="button"
+ className={cn('quick-create', header && 'quick-create--header', className)}
+ title={t('app.quickCreate.createOrSearch', 'Create or search — Ctrl K')}
+ aria-label={t('app.quickCreate.createNew2', 'Create new')}
+ onClick={() => window.dispatchEvent(new CustomEvent('serverkit:open-palette'))}
+ >
+ <Plus size={header ? 15 : 16} />
+ </button>
);
}
diff --git a/frontend/src/data/createItems.js b/frontend/src/data/createItems.js
new file mode 100644
index 00000000..a25d1a45
--- /dev/null
+++ b/frontend/src/data/createItems.js
@@ -0,0 +1,28 @@
+// One list behind every "create something new" entry point: the sidebar "+"
+// and the command palette's Create tiles. Route-based flows navigate directly;
+// flows living in a modal/drawer on a list page deep-link with
+// `?focus=create:<kind>`, which the destination opens via useFocusParam.
+//
+// `more: true` marks the second shelf — hidden behind the palette's
+// "+ n more" expander until asked for, like the prototype.
+import {
+ Activity, Archive, Boxes, Clock, Container, Database, FolderKanban,
+ Globe, KeyRound, LayoutGrid, Server, Webhook,
+} from 'lucide-react';
+
+export const CREATE_ITEMS = [
+ { kind: 'service', labelKey: 'common.labels.service', label: 'Service', icon: Boxes, path: '/services/new' },
+ { kind: 'server', labelKey: 'common.labels.server', label: 'Server', icon: Server, path: '/servers?focus=create:server' },
+ { kind: 'domain', labelKey: 'common.labels.domain', label: 'Domain', icon: Globe, path: '/domains?focus=create:domain' },
+ { kind: 'database', labelKey: 'app.quickCreate.database', label: 'Database', icon: Database, path: '/databases' },
+ { kind: 'monitor', labelKey: 'app.quickCreate.monitor', label: 'Monitor', icon: Activity, path: '/monitoring/monitors?focus=create:monitor' },
+ { kind: 'cron', labelKey: 'app.quickCreate.cronJob', label: 'Cron job', icon: Clock, path: '/cron?focus=create:cron' },
+ { kind: 'backup', labelKey: 'app.quickCreate.backup', label: 'Backup', icon: Archive, path: '/backups' },
+ { kind: 'project', labelKey: 'common.labels.project', label: 'Project', icon: FolderKanban, path: '/projects?focus=create:project' },
+ { kind: 'workspace', labelKey: 'common.labels.workspace', label: 'Workspace', icon: LayoutGrid, path: '/workspaces?focus=create:workspace' },
+ { kind: 'vault', labelKey: 'app.quickCreate.vault', label: 'Vault', icon: KeyRound, path: '/vaults', more: true },
+ { kind: 'webhook', labelKey: 'app.quickCreate.webhook', label: 'Webhook', icon: Webhook, path: '/settings/webhooks', more: true },
+ { kind: 'container', labelKey: 'app.quickCreate.container', label: 'Container', icon: Container, path: '/docker', more: true },
+];
+
+export default CREATE_ITEMS;
diff --git a/frontend/src/styles/components/_command-palette.scss b/frontend/src/styles/components/_command-palette.scss
index 6185f3f4..b660e55b 100644
--- a/frontend/src/styles/components/_command-palette.scss
+++ b/frontend/src/styles/components/_command-palette.scss
@@ -207,6 +207,101 @@
color: $text-primary;
}
+// Right-aligned mono annotation (e.g. a recipe's "5 steps").
+.command-palette__item-meta {
+ flex-shrink: 0;
+ margin-inline-start: auto;
+ color: $text-tertiary;
+ font-size: 10.5px;
+}
+
+// --------------------------------------------
+// Create tile grid — the palette's empty state leads with create targets as
+// prototype pal-grid tiles, then the "+ n more" shelf expander.
+// --------------------------------------------
+.command-palette__create {
+ [cmdk-group-items] {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ padding: 2px 4px 8px;
+ }
+}
+
+.ui-command-item.command-palette__tile {
+ position: relative;
+ display: flex;
+ flex: 0 0 118px;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: 9px;
+ padding: 11px 11px 10px;
+ border: 1px solid $border-subtle;
+ border-radius: $radius-md;
+ background: var(--surface);
+ color: $text-secondary;
+ font-size: 11.5px;
+
+ &[data-selected='true'] {
+ @include status-variant(var(--accent-bright), var(--accent-bg), var(--accent-dim));
+ }
+
+ .command-palette__tile-icon {
+ display: grid;
+ place-items: center;
+ color: $text-tertiary;
+
+ svg { width: 18px; height: 18px; }
+ }
+
+ &[data-selected='true'] .command-palette__tile-icon { color: var(--accent-bright); }
+
+ .command-palette__tile-label {
+ max-width: 100%;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .command-palette__tile-ext {
+ position: absolute;
+ top: 8px;
+ right: 8px;
+ width: 11px;
+ height: 11px;
+ color: $text-tertiary;
+ }
+
+ &[data-selected='true'] .command-palette__tile-ext {
+ color: var(--accent-bright);
+ opacity: 0.65;
+ }
+}
+
+.command-palette__more {
+ display: flex;
+ width: calc(100% - 8px);
+ height: 29px;
+ align-items: center;
+ justify-content: center;
+ gap: 7px;
+ margin: 0 4px 6px;
+ border: 1px dashed $border-default;
+ border-radius: $radius-md;
+ background: transparent;
+ color: $text-tertiary;
+ font-size: 11.5px;
+ cursor: pointer;
+ transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
+ @include focus-ring();
+
+ &:hover {
+ border-color: $border-active;
+ background: var(--surface);
+ color: $text-primary;
+ }
+}
+
// --------------------------------------------
// Settings deep-link flash (plan 41, Phase 2): a palette result lands on the
// exact card via ?focus=setting:<id>; useSettingFocus scrolls it into view and