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
refactor(list-page): one toolbar placement rule
Juan Deniscb085fafb79c
diff --git a/frontend/src/components/layouts/ResourceListPage.jsx b/frontend/src/components/layouts/ResourceListPage.jsxindex f0a7d419..86b45c07 100644--- a/frontend/src/components/layouts/ResourceListPage.jsx+++ b/frontend/src/components/layouts/ResourceListPage.jsx@@ -1,7 +1,7 @@import { useCallback, useMemo, useState } from 'react';import { Search, Rows3, LayoutGrid, X } from 'lucide-react';import { cn } from '@/lib/utils';-import { SegControl, SortMenu, SortChipBar, ColumnsMenu, DataTableFooter, ViewMenu } from '@/components/ds';+import { SegControl, SortMenu, SortChipBar, ColumnsMenu, DataTableFooter, ViewMenu, ListToolbar } from '@/components/ds';import EmptyState from '../EmptyState';import DataTable from '@/components/ds/DataTable';import { useTableSort } from '@/hooks/useTableSort';@@ -59,6 +59,11 @@ export default function ResourceListPage({searchTerm,onSearchChange,searchPlaceholder = 'Search…',+ // Placement rule: on tab-group pages the search input belongs in the shared+ // topbar (the page publishes a SearchField there itself); set this flag so+ // the in-page search slot stays empty. Extensions outside a tab group leave+ // it off and keep the in-page input.+ searchInTopbar = false,toolbarExtra,// bulk actionsselectedCount = 0,@@ -191,15 +196,51 @@ export default function ResourceListPage({/>) : (<div className="wp-list">- <div className="wp-list__toolbar">- {filters && (+ <ListToolbar+ filters={filters && (<SegControlvalue={activeFilter}onChange={onFilterChange}options={filters}/>)}- {onSearchChange && (+ tools={(+ <>+ {view === 'list' && (+ <>+ {viewPageKey && <ViewMenu views={tableViews} />}+ {sortable && (+ <SortMenu columns={columns} sorts={sorts} onChange={setSorts} />+ )}+ <ColumnsMenu+ columns={columns}+ hiddenKeys={hiddenKeys}+ onToggle={toggleColumn}+ onShowAll={showAllColumns}+ />+ </>+ )}+ {renderCard && (+ <div className="wp-list__viewswitch" role="group" aria-label="Layout">+ {[['list', Rows3, 'List'], ['cards', LayoutGrid, 'Cards']].map(([key, Icon, label]) => (+ <button+ type="button"+ key={key}+ className={view === key ? 'is-active' : ''}+ onClick={() => changeView(key)}+ title={label}+ aria-label={label}+ aria-pressed={view === key}+ >+ <Icon size={15} />+ </button>+ ))}+ </div>+ )}+ </>+ )}+ >+ {onSearchChange && !searchInTopbar && (<div className="wp-list__search"><Search size={15} aria-hidden="true" /><input@@ -212,38 +253,7 @@ export default function ResourceListPage({</div>)}{toolbarExtra}- {view === 'list' && (- <div className="wp-list__tabletools">- {viewPageKey && <ViewMenu views={tableViews} />}- {sortable && (- <SortMenu columns={columns} sorts={sorts} onChange={setSorts} />- )}- <ColumnsMenu- columns={columns}- hiddenKeys={hiddenKeys}- onToggle={toggleColumn}- onShowAll={showAllColumns}- />- </div>- )}- {renderCard && (- <div className="wp-list__viewswitch" role="group" aria-label="Layout">- {[['list', Rows3, 'List'], ['cards', LayoutGrid, 'Cards']].map(([key, Icon, label]) => (- <button- type="button"- key={key}- className={view === key ? 'is-active' : ''}- onClick={() => changeView(key)}- title={label}- aria-label={label}- aria-pressed={view === key}- >- <Icon size={15} />- </button>- ))}- </div>- )}- </div>+ </ListToolbar>{view === 'list' && (<SortChipBar columns={columns} sorts={sorts} onChange={setSorts} />diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsxindex 562d79aa..577b07b2 100644--- a/frontend/src/pages/Workspaces.jsx+++ b/frontend/src/pages/Workspaces.jsx@@ -5,7 +5,7 @@ import { useToast } from '../contexts/ToastContext';import Modal from '@/components/Modal';import ResourceListPage from '../components/layouts/ResourceListPage';import { LayoutGrid, Plus, ChevronRight } from 'lucide-react';-import { Pill, ServiceTile } from '@/components/ds';+import { Pill, ServiceTile, SearchField } from '@/components/ds';import { useTopbarActions } from '@/hooks/useTopbarActions';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';@@ -51,11 +51,18 @@ const Workspaces = () => {useEffect(() => { loadWorkspaces(); }, [loadWorkspaces]);useTopbarActions(() => (- <Button size="sm" onClick={() => setShowCreateModal(true)}>- <Plus size={16} />- New Workspace- </Button>- ), []);+ <>+ <Button size="sm" onClick={() => setShowCreateModal(true)}>+ <Plus size={16} />+ New Workspace+ </Button>+ <SearchField+ value={search}+ onSearch={setSearch}+ placeholder="Search workspaces…"+ />+ </>+ ), [search]);const handleCreate = async () => {try {@@ -195,6 +202,7 @@ const Workspaces = () => {searchTerm={search}onSearchChange={setSearch}searchPlaceholder="Search workspaces…"+ searchInTopbarselectedCount={selectedIds.size}onClearSelection={() => setSelectedIds(new Set())}emptyIcon={LayoutGrid}diff --git a/frontend/src/styles/components/_design-system.scss b/frontend/src/styles/components/_design-system.scssindex 9a65a619..777f3959 100644--- a/frontend/src/styles/components/_design-system.scss+++ b/frontend/src/styles/components/_design-system.scss@@ -862,21 +862,15 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');flex-direction: column;padding: $space-4;- &__toolbar {- display: flex;- align-items: center;- gap: $space-3;- flex-wrap: wrap;- margin-bottom: $space-3;- }+ // The toolbar row is the shared .sk-listhead (ResourceListPage renders+ // ListToolbar); only the search fallback and the layout switch stay here.- // Client-side search (name / status / …): leading icon + borderless field- // on a quiet surface. Claims the free space so trailing controls right-align.+ // In-page search fallback — used when a page does NOT publish its search+ // into the shared topbar (extensions outside a tab group).&__search {display: inline-flex;align-items: center;gap: $space-2;- margin-left: auto;padding: 0 10px;width: 240px;max-width: 100%;@@ -904,18 +898,8 @@ $sk-tones: ('accent', 'green', 'cyan', 'amber', 'red', 'violet');}}- // Sort / Columns menus, ahead of the layout switch.- &__tabletools {- display: inline-flex;- align-items: center;- gap: 8px;- flex-shrink: 0;-- // Pages without a search field still right-align the table tools.- &:first-child { margin-left: auto; }- }-// Table/cards switch — only rendered by pages that pass a card renderer.+ // Lives in the ListToolbar tools slot.&__viewswitch {display: flex;gap: 2px;diff --git a/frontend/src/styles/components/_empty-state.scss b/frontend/src/styles/components/_empty-state.scssindex e45b94b3..c7dfe68a 100644--- a/frontend/src/styles/components/_empty-state.scss+++ b/frontend/src/styles/components/_empty-state.scss@@ -88,13 +88,11 @@// Effective global overrides (moved verbatim from pages/_email.scss, where a// legacy unscoped `.empty-state` block used to win the cascade app-wide).-// Top-level `.empty-state` copies still exist in pages/_security.scss and-// pages/_servers.scss, which import AFTER this partial — at equal specificity-// they would re-widen the padding and restore `<p>` bottom margins. The `html`-// prefix (0,1,1) outranks those (0,1,0)/(0,1,1) blocks, while still losing to-// the intentional higher-specificity rules (`.card .empty-state` padding from-// _cards.scss, `--lg` child overrides, page-scoped copies). Fold this into the-// base block above once the page-partial copies are consolidated here.+// The page-partial copies this used to fight are gone: _security.scss's copy+// was deleted (security tabs now use the <EmptyState> component) and+// _servers.scss's copy is scoped under `.servers-page`. The `html` prefix+// stays as defense-in-depth so no future unscoped copy can re-widen the+// padding or restore `<p>` bottom margins app-wide.html .empty-state {padding: $space-8;color: $text-secondary;