import { getLocalizedString } from "@olenbetong/appframe-core"; import type { DataObject } from "@olenbetong/appframe-data"; import { AppMenuUserMenu, type AppMenuUser } from "./AppMenuUserMenu.js"; import { CloseIcon, HomeIcon, ReloadIcon } from "./icons.js"; import type { AppMenuLink } from "./types.js"; export type AppMenuHeaderProps = { /** Link shown at the start of the header, e.g. the portal/front page. */ homeLink?: AppMenuLink; /** Which pane is shown on narrow viewports. */ mobilePane: "apps" | "groups"; onToggleMobilePane: () => void; hasUpdate: boolean; onInstallUpdate?: () => void; userDataObject?: DataObject; userMenuItems?: AppMenuLink[]; userSubtitle?: string; onClose: () => void; }; /** * Header of the app menu's content pane, holding the navigation shortcuts on * the start side and the user/update/close controls on the end side. * * It is rendered after the app list so it comes last in the tab order, and is * moved back to the top visually with `order: -1`. */ export function AppMenuHeader({ homeLink, mobilePane, onToggleMobilePane, hasUpdate, onInstallUpdate, userDataObject, userMenuItems, userSubtitle, onClose, }: AppMenuHeaderProps) { return (
{homeLink && ( { homeLink.onClick?.(); if (!homeLink.keepOpen) onClose(); }} > {homeLink.label} )}
{hasUpdate && ( )} {userDataObject && }
); }