Every record editor gets a sticky "On this page" column listing its field groups and collections (with row counts), lighting the one in view and marking any with a save error. Below lg it becomes a sticky "Jump to" menu. Editor pages widen to fit it through a small layout context; other admin pages keep their width. Each collection now sits in its own card, and repeater rows fold to their title line. Rows start folded, with Expand all and Collapse all; a new row, or one the server rejected, opens itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.1 KiB
TypeScript
26 lines
1.1 KiB
TypeScript
/* ═══════════════════════════════════════════════════════════════
|
|
ADMIN PAGE WIDTH
|
|
|
|
The admin column is max-w-5xl. The record editor wants more: its
|
|
section nav sits to the left of a form that keeps that width.
|
|
Like the title (adminTitle.tsx), the page asks and the layout
|
|
decides, so AdminLayout stays the one place that sets <main>'s
|
|
width.
|
|
|
|
Clears on unmount, so leaving the editor puts the list pages
|
|
back to their usual width.
|
|
═══════════════════════════════════════════════════════════════ */
|
|
|
|
import { createContext, useContext, useEffect } from "react";
|
|
|
|
export const AdminWidthContext = createContext<((wide: boolean) => void) | null>(null);
|
|
|
|
export function useWideAdminPage() {
|
|
const setWide = useContext(AdminWidthContext);
|
|
|
|
useEffect(() => {
|
|
if (!setWide) return undefined;
|
|
setWide(true);
|
|
return () => setWide(false);
|
|
}, [setWide]);
|
|
}
|