);
}
function AdminNav({ active, badges, onNavigate }: { active: string; badges?: Badges; onNavigate?: () => void }) {
return (
);
}
/**
* The sidebar: who's signed in, then the sections of the part you're in (1.8.0: your account or
* admin, not both at once; the bar across the top switches). In the phone menu, both.
*/
function SidebarContent({ me, active, badges, both, onNavigate }: { me: ShellUser; active: string; badges?: Badges; both?: boolean; onNavigate?: () => void }) {
const inAdmin = me.role === "admin" && active.startsWith("/admin");
return (
<>
{me.name}
{(both || !inAdmin) && }
{me.role === "admin" && (both || inAdmin) && }
{!both && me.role === "admin" && (
{inAdmin ? : }
{inAdmin ? "Go to your account" : "Go to admin"}
)}
>
);
}
/**
* The frame of the account and admin pages (1.3.0, as Cross Events' dashboard): the church's logo
* and name across the top, a sidebar of sections, the page on a light grey, and a dark footer.
* Without `me` (a public page) there's no sidebar. `active` is the current section's address.
*/
export function AppShell({ me, active = "", badges, children }: { me: ShellUser | null; active?: string; badges?: Badges; children: React.ReactNode }) {
const b = useBranding();
const [open, setOpen] = useState(false);
const top = "text-sm border-b-2 pb-0.5 transition-colors";
const inAdmin = active.startsWith("/admin");
return (
);
}
/** A page's title and a line under it, at the top of the main column; with the section's icon. */
export function PageTitle({ children, sub, icon: Icon }: { children: React.ReactNode; sub?: React.ReactNode; icon?: LucideIcon }) {
return (
{Icon && }
{children}
{sub &&
{sub}
}
);
}
/** While a page loads its data: the frame without a sidebar yet. */
export function ShellLoading() {
return (