import { PROJECT_EXTENSION_URL, PROJECT_NAME, PROJECT_REPO_GITHUB_URL, } from '#config/project'; import { Box, Burger, Button, Drawer, Flex, Group, Image, rem, useMantineTheme, } from '@mantine/core'; import { useDisclosure, useMediaQuery } from '@mantine/hooks'; import { useEffect } from 'react'; import { UserDropdown } from '~/components/common/floating_navbar/user_dropdown'; import { ExternalLinkUnstyled } from '~/components/common/links/external_link_unstyled'; import { InternalLink } from '~/components/common/links/internal_link'; import { useAuth } from '~/hooks/use_auth'; import classes from './floating_navbar.module.css'; interface FloatingNavbarProps { width: string; } export function FloatingNavbar({ width }: FloatingNavbarProps) { const auth = useAuth(); const theme = useMantineTheme(); const [opened, handler] = useDisclosure(false); const isMobile = useMediaQuery(`(max-width: ${theme.breakpoints.sm})`, false); useEffect(() => { if (opened && !isMobile) { handler.close(); } }, [isMobile]); const links = ( <> Dashboard Github Extension ); return ( <> MyLinks's logo {!isMobile && {links}} {isMobile && } {auth.isAuthenticated && } {!auth.isAuthenticated && ( )} {/* Mobile drawer */} {links} ); }