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(chrome): global quick-create button + favorite star

Juan Denis364aa592d597
diff --git a/frontend/src/components/FavoriteStar.jsx b/frontend/src/components/FavoriteStar.jsx
new file mode 100644
index 00000000..15f934ed
--- /dev/null
+++ b/frontend/src/components/FavoriteStar.jsx
@@ -0,0 +1,31 @@
+import { useState } from 'react';
+import { Star } from 'lucide-react';
+import { cn } from '@/lib/utils';
+import { isFavorite, toggleFavorite } from '@/utils/recents';
+
+// Pin/unpin an entity as a favorite (surfaced in the command palette's
+// Favorites section). Sits in detail-page title areas.
+//
+// <FavoriteStar type="service" id={service.id} path={`/services/${service.id}`} label={service.name} />
+export function FavoriteStar({ type, id, path, label, className }) {
+ const [fav, setFav] = useState(() => isFavorite(type, id));
+
+ const toggle = () => {
+ setFav(toggleFavorite({ type, id, path, label }));
+ };
+
+ return (
+ <button
+ type="button"
+ className={cn('fav-star', fav && 'is-on', className)}
+ onClick={toggle}
+ title={fav ? 'Remove from favorites' : 'Add to favorites'}
+ aria-label={fav ? 'Remove from favorites' : 'Add to favorites'}
+ aria-pressed={fav}
+ >
+ <Star size={15} fill={fav ? 'currentColor' : 'none'} />
+ </button>
+ );
+}
+
+export default FavoriteStar;
diff --git a/frontend/src/components/MobileTopBar.jsx b/frontend/src/components/MobileTopBar.jsx
index e2a05f46..3332644c 100644
--- a/frontend/src/components/MobileTopBar.jsx
+++ b/frontend/src/components/MobileTopBar.jsx
@@ -2,6 +2,7 @@ import { Menu, X } from 'lucide-react';
import { useTheme } from '../contexts/ThemeContext';
import ServerKitLogo from './ServerKitLogo';
import NotificationBell from './NotificationBell';
+import QuickCreate from './QuickCreate';
// Fixed header shown only on narrow viewports (< 768px). Houses the
// hamburger toggle that opens the sidebar as an off-canvas drawer, since
@@ -38,6 +39,7 @@ const MobileTopBar = ({ navOpen, onToggle }) => {
<span className="mobile-topbar__name">{brandName}</span>
</div>
<div className="mobile-topbar__actions">
+ <QuickCreate />
<NotificationBell />
</div>
</header>
diff --git a/frontend/src/components/QuickCreate.jsx b/frontend/src/components/QuickCreate.jsx
new file mode 100644
index 00000000..d0fc4880
--- /dev/null
+++ b/frontend/src/components/QuickCreate.jsx
@@ -0,0 +1,54 @@
+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 { cn } from '@/lib/utils';
+
+// 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', label: 'Service', icon: Boxes, path: '/services/new' },
+ { kind: 'server', label: 'Server', icon: Server, path: '/servers?focus=create:server' },
+ { kind: 'monitor', label: 'Monitor', icon: Activity, path: '/monitoring/monitors?focus=create:monitor' },
+ { kind: 'domain', label: 'Domain', icon: Globe, path: '/domains?focus=create:domain' },
+ { kind: 'cron', label: 'Cron job', icon: Clock, path: '/cron?focus=create:cron' },
+ { kind: 'workspace', label: 'Workspace', icon: LayoutGrid, path: '/workspaces?focus=create:workspace' },
+ { kind: 'project', label: 'Project', icon: FolderKanban, path: '/projects?focus=create:project' },
+];
+
+export function QuickCreate({ className }) {
+ const navigate = useNavigate();
+ return (
+ <DropdownMenu>
+ <DropdownMenuTrigger asChild>
+ <button
+ type="button"
+ className={cn('quick-create', className)}
+ title="Create new…"
+ aria-label="Create new"
+ >
+ <Plus size={16} />
+ </button>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent side="top" align="end" sideOffset={8}>
+ {CREATE_ITEMS.map((item) => (
+ <DropdownMenuItem key={item.kind} onSelect={() => navigate(item.path)}>
+ <item.icon size={14} aria-hidden="true" />
+ New {item.label}
+ </DropdownMenuItem>
+ ))}
+ </DropdownMenuContent>
+ </DropdownMenu>
+ );
+}
+
+export default QuickCreate;
diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsx
index bc2448a4..313fb126 100644
--- a/frontend/src/components/Sidebar.jsx
+++ b/frontend/src/components/Sidebar.jsx
@@ -12,6 +12,7 @@ import { useContributions } from '../plugins/contributions';
import { sanitizeSvgInner } from '../utils/sanitizeSvg';
import useModules from '../hooks/useModules';
import useDevMode from '../hooks/useDevMode';
+import QuickCreate from './QuickCreate';
const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {} }) => {
const { user, logout, updateUser, hasPermission } = useAuth();
@@ -550,6 +551,7 @@ const Sidebar = ({ mobileOpen = false, isMobile = false, onMobileClose = () => {
</span>
<ChevronUp size={14} className={`user-menu-arrow ${menuOpen ? 'open' : ''}`} aria-hidden="true" />
</button>
+ <QuickCreate />
<NotificationBell />
</div>
</div>
diff --git a/frontend/src/styles/components/_notification-center.scss b/frontend/src/styles/components/_notification-center.scss
index 799cd67e..6b1a8205 100644
--- a/frontend/src/styles/components/_notification-center.scss
+++ b/frontend/src/styles/components/_notification-center.scss
@@ -226,6 +226,58 @@
}
}
+// Global quick-create ("+") — matches the notification bell's chrome so the
+// sidebar footer / mobile top bar read as one control strip.
+.quick-create {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 34px;
+ height: 34px;
+ border: 1px solid $border-subtle;
+ border-radius: 9px;
+ background: $bg-card;
+ color: $text-secondary;
+ cursor: pointer;
+ transition: background 0.15s, color 0.15s, border-color 0.15s;
+
+ &:hover {
+ background: $bg-hover;
+ color: $text-primary;
+ border-color: $border-default;
+ }
+
+ .sidebar-footer__row & {
+ width: 38px;
+ height: auto;
+ min-height: 34px;
+ align-self: stretch;
+ }
+}
+
+// Favorite pin on detail pages — quiet ghost star, amber when pinned.
+.fav-star {
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 28px;
+ height: 28px;
+ border: none;
+ border-radius: 7px;
+ background: transparent;
+ color: var(--text-faint);
+ cursor: pointer;
+ transition: background 0.14s, color 0.14s;
+
+ &:hover { background: var(--surface-2); color: var(--text); }
+
+ &.is-on {
+ color: var(--amber);
+
+ &:hover { color: var(--amber); }
+ }
+}
+
// In the mobile top bar the bell sits at the top, so the panel opens downward.
.mobile-topbar__actions {
margin-left: auto;