diff --git a/frontend/src/components/PageSkeleton.jsx b/frontend/src/components/PageSkeleton.jsx index d886e8de..15e4cb5a 100644 --- a/frontend/src/components/PageSkeleton.jsx +++ b/frontend/src/components/PageSkeleton.jsx @@ -332,6 +332,4 @@ export function PageSkeleton({ variant = 'panel', rows, className = '' }) { ); } -export const PAGE_SKELETON_VARIANTS = Object.keys(VARIANTS); - export default PageSkeleton; diff --git a/frontend/src/components/dashboard/grid/WidgetEditor.jsx b/frontend/src/components/dashboard/grid/WidgetEditor.jsx index 63097682..a75a7bb0 100644 --- a/frontend/src/components/dashboard/grid/WidgetEditor.jsx +++ b/frontend/src/components/dashboard/grid/WidgetEditor.jsx @@ -15,7 +15,8 @@ import { // Single source of truth for shortcut targets: what a user can pick here is // exactly what the renderer can draw. WidgetBody is what the board itself // draws with, so the preview cannot drift from the real thing. -import { QUICK_ACTION_OPTIONS, WidgetBody } from '../widgets/renderers'; +import { WidgetBody } from '../widgets/renderers'; +import { QUICK_ACTION_OPTIONS } from '../widgets/quickActions'; import { deriveWidgetTitle } from '../widgets/registry'; import { GRID_COLS, GRID_GAP, GRID_ROW } from './layout'; import { useTranslation } from 'react-i18next'; diff --git a/frontend/src/components/dashboard/widgets/quickActions.js b/frontend/src/components/dashboard/widgets/quickActions.js new file mode 100644 index 00000000..21660ed8 --- /dev/null +++ b/frontend/src/components/dashboard/widgets/quickActions.js @@ -0,0 +1,24 @@ +import { Archive, Boxes, Container, Database, FolderOpen, Globe, ListChecks, Activity, Rocket, Server, ShieldCheck, Terminal } from 'lucide-react'; + +// Every destination is a real route registered in App.jsx. +export const ACTIONS = { + servers: ['Manage servers', Server, '/servers'], + services: ['Services', Boxes, '/services'], + docker: ['Docker containers', Container, '/docker'], + terminal: ['Open terminal', Terminal, '/terminal'], + deploys: ['Deploy activity', Rocket, '/deployments'], + databases: ['Databases', Database, '/databases'], + backups: ['Backups', Archive, '/backups'], + monitoring: ['Monitoring', Activity, '/monitoring'], + domains: ['Domains', Globe, '/domains'], + files: ['File manager', FolderOpen, '/files'], + security: ['Security', ShieldCheck, '/security'], + jobs: ['Jobs', ListChecks, '/monitoring/jobs'], +}; + +export const QUICK_ACTION_KEYS = Object.keys(ACTIONS); + +// [key, label] pairs for the inspector's shortcut picker. Derived from ACTIONS +// so the list of shortcuts a user can *choose* can never drift from the list +// this widget can actually *render* — they did drift once already. +export const QUICK_ACTION_OPTIONS = Object.entries(ACTIONS).map(([key, [label]]) => [key, label]); diff --git a/frontend/src/components/dashboard/widgets/renderers.jsx b/frontend/src/components/dashboard/widgets/renderers.jsx index d7902f25..f83249e0 100644 --- a/frontend/src/components/dashboard/widgets/renderers.jsx +++ b/frontend/src/components/dashboard/widgets/renderers.jsx @@ -11,23 +11,12 @@ import { formatRelativeTime } from '@/utils/time'; */ import { Component, useEffect, useId, useMemo, useRef, useState } from 'react'; import { - Activity, - Archive, ArrowDown, ArrowUp, - Boxes, - Container, - Database, - FolderOpen, - Globe, - ListChecks, - Rocket, - Server, - ShieldCheck, - Terminal, } from 'lucide-react'; import { Gauge, Pill, serviceStatusKind, statusKind, alertStatusKind } from '@/components/ds'; import { getWidgetType } from './registry'; +import { ACTIONS } from './quickActions'; import { useTranslation } from 'react-i18next'; import { t } from '../../../i18n/t'; import { formatTime } from '@/utils/intl'; @@ -753,29 +742,6 @@ function WFeed({ cfg, ctx }) { /* ----------------------------------------------------------------- actions */ -// Every destination is a real route registered in App.jsx. -const ACTIONS = { - servers: ['Manage servers', Server, '/servers'], - services: ['Services', Boxes, '/services'], - docker: ['Docker containers', Container, '/docker'], - terminal: ['Open terminal', Terminal, '/terminal'], - deploys: ['Deploy activity', Rocket, '/deployments'], - databases: ['Databases', Database, '/databases'], - backups: ['Backups', Archive, '/backups'], - monitoring: ['Monitoring', Activity, '/monitoring'], - domains: ['Domains', Globe, '/domains'], - files: ['File manager', FolderOpen, '/files'], - security: ['Security', ShieldCheck, '/security'], - jobs: ['Jobs', ListChecks, '/monitoring/jobs'], -}; - -export const QUICK_ACTION_KEYS = Object.keys(ACTIONS); - -// [key, label] pairs for the inspector's shortcut picker. Derived from ACTIONS -// so the list of shortcuts a user can *choose* can never drift from the list -// this widget can actually *render* — they did drift once already. -export const QUICK_ACTION_OPTIONS = Object.entries(ACTIONS).map(([key, [label]]) => [key, label]); - function WActions({ cfg, ctx }) { const { t } = useTranslation(); const items = (Array.isArray(cfg.items) ? cfg.items : []).filter((key) => ACTIONS[key]); diff --git a/frontend/src/components/pageSkeletonVariants.js b/frontend/src/components/pageSkeletonVariants.js new file mode 100644 index 00000000..2cd068a4 --- /dev/null +++ b/frontend/src/components/pageSkeletonVariants.js @@ -0,0 +1,2 @@ +// Keep in sync with VARIANTS in PageSkeleton.jsx. +export const PAGE_SKELETON_VARIANTS = ['panel', 'table', 'feed', 'cards', 'detail', 'console', 'form', 'chart', 'tree', 'split']; diff --git a/frontend/src/pages/StyleGuide.jsx b/frontend/src/pages/StyleGuide.jsx index 2270f2a8..73f6d156 100644 --- a/frontend/src/pages/StyleGuide.jsx +++ b/frontend/src/pages/StyleGuide.jsx @@ -20,7 +20,8 @@ import Modal from '../components/Modal'; import { ConfirmDialog } from '../components/ConfirmDialog'; import StatusBadge from '../components/StatusBadge'; import EmptyState from '../components/EmptyState'; -import { PageSkeleton, PAGE_SKELETON_VARIANTS } from '../components/PageSkeleton'; +import { PageSkeleton } from '../components/PageSkeleton'; +import { PAGE_SKELETON_VARIANTS } from '../components/pageSkeletonVariants'; import { Spinner } from '../components/Spinner'; import { StatCard, StatsGrid } from '../components/StatCard'; import { DangerZone } from '../components/DangerZone';