import { createMemo, createSignal, For, onMount, Show } from 'solid-js'; import AdminShell from '~/components/AdminShell'; const API = '/api/gateway'; // ---------- Types ---------- type SidebarItem = { key: string; label: string; visible: boolean; order: number }; type Field = { id: string; label: string; type: 'text' | 'number' | 'select' | 'date'; required: boolean; placeholder?: string }; type Tab = { id: string; title: string; fields: Field[] }; type Widget = { id: string; title: string; metric: string; description?: string }; type Section = { id: string; title: string; tabs: Tab[]; widgets: Widget[] }; type Dashboard = { id: string; roleId: string; roleName: string; title: string; description?: string; status: string; version: number; sidebar: SidebarItem[]; sections: Section[] }; type InternalRole = { id: string; name: string }; const FIELD_TYPES: Field['type'][] = ['text', 'number', 'select', 'date']; const makeId = (prefix: string) => `${prefix}_${Math.random().toString(36).slice(2, 10)}`; // ---------- Preview ---------- function PreviewSection(props: { section: Section }) { const [activeTabId, setActiveTabId] = createSignal(props.section.tabs[0]?.id || ''); const activeTab = createMemo(() => props.section.tabs.find((t) => t.id === activeTabId()) || props.section.tabs[0] || null); return (
Preview tabs, fields, and widgets.
{props.dashboard.roleName}
Dashboard Preview
{props.dashboard.description || 'Preview of the internal dashboard layout.'}
Build and manage internal role dashboards — sidebar, sections, tabs, fields, and widgets.
Manage sidebar, sections, tabs, fields, and widgets from one place.
Linked Role
{selected()!.roleName || 'No role selected yet'}
{selected()!.roleId || 'Select an internal role to bind this dashboard.'}
No sidebar items yet. Add the first item.
No fields in this tab yet.
No tabs yet. Add a tab above.
No widgets yet.
Preview uses the actual internal dashboard layout so you can navigate the sidebar, tabs, fields, and widgets before saving.