);
}
function MobileRail({ state }: { state: ShellState }) {
const [open, setOpen] = useState(false);
useEffect(() => setOpen(false), [state.pathname]);
return (
}>
}>
);
}
/** Lets a keyboard user jump past the rail and the header. It shows only when it has focus. */
function SkipLink() {
return (
Skip to content
);
}
/** Hides or shows the rail on wide screens, like the sidebar button of a desktop app. Narrow screens use the drawer. */
function RailToggle() {
const [hidden, toggle] = useRailHidden();
const label = hidden ? "Show sidebar" : "Hide sidebar";
return (
}>
);
}
function UserMenu({ user, showMembers, showWaitlist, onSignOut }: { user: Person; showMembers: boolean; showWaitlist: boolean; onSignOut: () => void }) {
return (
{user.name}{user.email}
}>
Access tokens
{showMembers && (
}>
Members
)}
{showWaitlist && (
}>
Waitlist
)}
} onClick={onSignOut}>
Sign out
);
}
function CreateMenu() {
return (
} aria-label="Create new" />}>New
}>
New repository
}>
New task
}>
New organization
);
}
function Crumbs({ trail }: { trail: Crumb[] }) {
return (
);
}
/**
* The header floats over the page as a translucent material. Its hairline is a scroll edge when the header
* stands alone, and a fixed divider when it carries tabs.
*/
function Header({ subnav, children }: { subnav?: ReactNode; children: ReactNode }) {
return (
{children}
{subnav &&
{subnav}
}
);
}
/**
* The signed-in frame: a quiet rail on the left, the floating header with location and actions, then the page.
* `full` removes the bottom space, for a canvas such as the code map.
*/
export function AppShell({ state, crumbs = [], subnav, full = false, children }: { state: ShellState; crumbs?: Crumb[]; subnav?: ReactNode; full?: boolean; children: ReactNode }) {
const { user } = state;
const trail: Crumb[] = [...(state.org ? [{ label: state.org, href: state.namespace ? `/${state.namespace}` : "/" }] : []), ...crumbs];
if (!user) {
return (
<>
{trail.length > 0 && }
);
}
/** A sign-in or sign-up page: the form on one side, the product at work on the other. */
export function AuthPage({ subtitle, error, children }: { subtitle: string; error?: string; children: ReactNode }) {
return (