import * as React from "react"; import classnames from "classnames"; import { Link, NavLink } from "react-router-dom"; import { useMediaQuery } from "react-responsive"; import { I18nText, useC, useMobile } from "./common"; import { useUser } from "@/services/user"; import TimelineLogo from "./TimelineLogo"; import UserAvatar from "./user/UserAvatar"; import "./AppBar.css"; function AppBarNavLink({ link, className, label, children, }: { link: string; className?: string; label?: I18nText; children?: React.ReactNode; }) { if (label != null && children != null) { throw new Error("AppBarNavLink: label and children cannot be both set"); } const c = useC(); return ( classnames(className, isActive && "active")} > {children != null ? children : c(label)} ); } function DesktopAppBar() { const user = useUser(); const hasAdministrationPermission = user && user.hasAdministrationPermission; return ( ); } // TODO: Go make this! function MobileAppBar() { const c = useC(); const user = useUser(); const hasAdministrationPermission = user && user.hasAdministrationPermission; const isSmallScreen = useMediaQuery({ maxWidth: 576 }); const [expand, setExpand] = React.useState(false); const collapse = (): void => setExpand(false); const toggleExpand = (): void => setExpand(!expand); const createLink = ( link: string, label: React.ReactNode, className?: string, ): React.ReactNode => ( classnames(className, isActive && "active")} > {label} ); return ( ); } export default function AppBar() { const isMobile = useMobile(); return isMobile ? : ; }