diff --git a/frontend/src/features/workspace/WorkspacePage.tsx b/frontend/src/features/workspace/WorkspacePage.tsx index 9aa03d8801..6ca14c2a1a 100644 --- a/frontend/src/features/workspace/WorkspacePage.tsx +++ b/frontend/src/features/workspace/WorkspacePage.tsx @@ -9,6 +9,7 @@ import { Flex, Grid, Stack, + useBreakpointValue, useDisclosure, } from '@chakra-ui/react' @@ -16,7 +17,6 @@ import { EMERGENCY_CONTACT_KEY_PREFIX, ROLLOUT_ANNOUNCEMENT_KEY_PREFIX, } from '~constants/localStorage' -import { useIsMobile } from '~hooks/useIsMobile' import { useLocalStorage } from '~hooks/useLocalStorage' import { RolloutAnnouncementModal } from '~features/rollout-announcement/RolloutAnnouncementModal' @@ -33,7 +33,12 @@ import { useDashboard, useWorkspace } from './queries' export const WorkspacePage = (): JSX.Element => { const [currWorkspaceId, setCurrWorkspaceId] = useState('') - const isMobile = useIsMobile() + const shouldUseTopMenu = useBreakpointValue({ + base: true, + xs: true, + md: true, + lg: false, + }) const createFormModal = useDisclosure() const mobileDrawer = useDisclosure() @@ -99,6 +104,8 @@ export const WorkspacePage = (): JSX.Element => { { - {isMobile ? ( + {shouldUseTopMenu ? ( { borderRightColor="neutral.300" minH="100vh" > - + void + shouldShowAddWorkspaceButton?: boolean + shouldShowMenuIcon?: boolean } export const WorkspaceMenuHeader = ({ - shouldShowAddWorkspaceButton = true, + shouldShowAddWorkspaceButton = false, + shouldShowMenuIcon = false, onMenuClick, ...props -}: WorkspaceMenuHeaderProps): JSX.Element => { - const isMobile = useIsMobile() - - return ( - - - {isMobile && ( - } - onClick={() => onMenuClick && onMenuClick()} - aria-label="open workspace drawer" - variant="clear" - colorScheme="primary" - color="secondary.500" - /> - )} - - Workspaces - - - - {shouldShowAddWorkspaceButton && ( +}: WorkspaceMenuHeaderProps): JSX.Element => ( + + + {shouldShowMenuIcon && ( } + onClick={() => onMenuClick && onMenuClick()} + aria-label="open workspace drawer" variant="clear" colorScheme="primary" color="secondary.500" - // TODO (hans): Implement add workspace modal view - onClick={() => null} - icon={} - justifySelf="flex-end" /> )} + + Workspaces + - ) -} + + {shouldShowAddWorkspaceButton && ( + null} + icon={} + justifySelf="flex-end" + /> + )} + +)