'use client' import { usePathname } from 'next/navigation' import { Skeleton } from '@/components/ui/skeleton' /** * Shared loading fallback for the dashboard segment. It is the Suspense * fallback for Hem (app/(dashboard)/page.tsx) and for every child route that * has no loading.tsx of its own, so it deliberately mirrors Hem's silhouette: * a greeting hero (H1 + date line) followed by a single "Att göra"-style pane * of list rows (see DashboardContent / AttGoraSection). * * A greeting + hairline-separated rows reads honestly on Hem and stays neutral * on the plain list pages that fall back here (a page title + rows), which is * why it is not shaped like any one page's specific grid. * * /chat is the exception: MainContainer renders it full-bleed (no max-width, * no padding), so the column silhouette would stretch edge-to-edge and read * broken. The chat branch mirrors the two-pane chat shell instead: * conversation sidebar + empty conversation pane (see ChatLayout/ChatSidebar). */ export default function DashboardLoading() { const pathname = usePathname() if (pathname.startsWith('/chat')) { return (
{/* Desktop mounts ChatSidebar COLLAPSED (a 48px rail), so the skeleton must be a rail too: a 320px skeleton that snapped to 48px on hydrate was a visible layout jump on every /chat load. Mobile mounts the full-width list, so that shape stays there. */}
) } return (
{/* Greeting hero (title + date line) */}
{/* Single pane: header over a hairline, then list rows */}
{['w-44', 'w-52', 'w-40', 'w-48', 'w-44'].map((w, i) => (
))}
) }