()
| 36 | const Divider = (props: BoxProps) => <Box h="1px" bgColor="gray.300" w="full" {...props} />; |
| 37 | |
| 38 | const NavSidebar = () => { |
| 39 | const user = useSession().data; |
| 40 | const project = useSelectedProject().data; |
| 41 | |
| 42 | const sidebarExpanded = useAppStore((state) => state.sidebarExpanded); |
| 43 | const setSidebarExpanded = useAppStore((state) => state.setSidebarExpanded); |
| 44 | |
| 45 | const isAdmin = useAccessCheck("requireIsAdmin").access; |
| 46 | |
| 47 | return ( |
| 48 | <VStack |
| 49 | align="stretch" |
| 50 | py={2} |
| 51 | pb={0} |
| 52 | height="100%" |
| 53 | px={{ base: 2, md: sidebarExpanded ? 3 : 2 }} |
| 54 | w={{ base: "56px", md: sidebarExpanded ? "220px" : "56px" }} |
| 55 | transition="width 0.2s ease-in-out; padding 0.2s ease-in-out;" |
| 56 | overflow="hidden" |
| 57 | borderRightWidth={1} |
| 58 | borderColor="gray.300" |
| 59 | > |
| 60 | <HStack |
| 61 | as={Link} |
| 62 | href="/" |
| 63 | _hover={{ textDecoration: "none" }} |
| 64 | spacing={{ base: 1, md: 0 }} |
| 65 | mx={2} |
| 66 | py={{ base: 1, md: 2 }} |
| 67 | display={{ md: "none" }} |
| 68 | > |
| 69 | <Image src="/logo.svg" alt="" boxSize={6} mr={4} ml={0.5} /> |
| 70 | </HStack> |
| 71 | <Divider display={{ md: "none" }} /> |
| 72 | |
| 73 | <VStack align="flex-start" overflowY="auto" overflowX="hidden" flex={1}> |
| 74 | {user != null && ( |
| 75 | <> |
| 76 | <ProjectMenu displayProjectName={sidebarExpanded} /> |
| 77 | <Divider /> |
| 78 | <IconLink icon={IoStatsChartOutline} label="Request Logs" href="/request-logs" /> |
| 79 | <IconLink icon={AiOutlineDatabase} label="Datasets" href="/datasets" /> |
| 80 | <IconLink icon={AiOutlineThunderbolt} label="Fine Tunes" href="/fine-tunes" /> |
| 81 | <IconLink icon={FaBalanceScale} label="Evals" href="/evals" /> |
| 82 | {isAdmin && <IconLink icon={BsClipboard2Data} label="Monitors" href="/monitors" />} |
| 83 | <VStack w="full" alignItems="flex-start" spacing={1} pt={8}> |
| 84 | <Text |
| 85 | pl={2} |
| 86 | pb={2} |
| 87 | fontSize="xs" |
| 88 | fontWeight="bold" |
| 89 | color="gray.500" |
| 90 | h={6} |
| 91 | display={{ base: "none", md: "flex" }} |
| 92 | > |
| 93 | {sidebarExpanded ? "CONFIGURATION" : ""} |
| 94 | </Text> |
| 95 | <IconLink icon={BsGear} label="Project Settings" href="/settings" /> |
nothing calls this directly
no test coverage detected