import * as React from 'react'; import Box from '@mui/material/Box'; import Toolbar from '@mui/material/Toolbar'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import AppsIcon from '@mui/icons-material/Apps'; import SwapCallsIcon from '@mui/icons-material/SwapCalls'; import HistoryIcon from '@mui/icons-material/History'; import NotificationsIcon from '@mui/icons-material/Notifications'; import * as URLS from 'config/urls'; import useVersion from 'hooks/useVersion'; import AppBar from 'components/AppBar'; import Drawer from 'components/Drawer'; type PublicLayoutProps = { children: React.ReactNode; } const drawerLinks = [ { Icon: SwapCallsIcon, primary: 'drawer.flows', to: URLS.FLOWS, }, { Icon: AppsIcon, primary: 'drawer.apps', to: URLS.APPS, }, { Icon: HistoryIcon, primary: 'drawer.executions', to: URLS.EXECUTIONS, }, ]; const generateDrawerBottomLinks = ({ notificationBadgeContent = 0 }) => [ { Icon: NotificationsIcon, primary: 'settingsDrawer.notifications', to: URLS.UPDATES, badgeContent: notificationBadgeContent, }, ] export default function PublicLayout({ children }: PublicLayoutProps): React.ReactElement { const version = useVersion(); const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg'), { noSsr: true }); const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens); const openDrawer = () => setDrawerOpen(true); const closeDrawer = () => setDrawerOpen(false); const drawerBottomLinks = generateDrawerBottomLinks({ notificationBadgeContent: version.newVersionCount, }); return ( <> {children} ); }