import { Notification } from "../types"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faFileLines } from "@fortawesome/free-solid-svg-icons"; function prettyName(s: string | undefined): string { if (!s) { return ""; } return s.replaceAll("/", " / "); } export function TopBar({ pageName, unsavedChanges, notifications, onClick, lhs, rhs, }: { pageName?: string; unsavedChanges: boolean; notifications: Notification[]; onClick: () => void; lhs?: React.ReactNode; rhs?: React.ReactNode; }) { return (
{lhs}
{prettyName(pageName)} {notifications.length > 0 && (
{notifications.map((notification) => (
{notification.message}
))}
)}
{rhs}
); }