diff --git a/ui/src/components/viewer/drawer/drawer-download-button.tsx b/ui/src/components/viewer/drawer/drawer-download-button.tsx index cbd12799d..10b41b7ef 100644 --- a/ui/src/components/viewer/drawer/drawer-download-button.tsx +++ b/ui/src/components/viewer/drawer/drawer-download-button.tsx @@ -1,4 +1,4 @@ -import { Button, IconButton } from '@chakra-ui/react' +import { Button, IconButton, Tooltip } from '@chakra-ui/react' import cx from 'classnames' import { File } from '@/client/api/file' import { IconDownload } from '@/lib/components/icons' @@ -13,31 +13,32 @@ const DrawerDownloadButton = ({ file, isCollapsed, }: DrawerDownloadButtonProps) => { - if (isCollapsed) { - return ( - } - variant="solid" - colorScheme="blue" - aria-label="Download" - title="Download" - className={cx('h-[50px]', 'w-[50px]', 'p-1.5', 'rounded-md')} - onClick={() => downloadFile(file)} - /> - ) - } else { - return ( - - ) - } + const label = 'Download' + return ( + + {isCollapsed ? ( + } + variant="solid" + colorScheme="blue" + aria-label="Download" + title="Download" + className={cx('h-[50px]', 'w-[50px]', 'p-1.5', 'rounded-md')} + onClick={() => downloadFile(file)} + /> + ) : ( + + )} + + ) } export default DrawerDownloadButton diff --git a/ui/src/components/viewer/drawer/drawer-open-new-tab-button.tsx b/ui/src/components/viewer/drawer/drawer-open-new-tab-button.tsx index 096604862..b0a815322 100644 --- a/ui/src/components/viewer/drawer/drawer-open-new-tab-button.tsx +++ b/ui/src/components/viewer/drawer/drawer-open-new-tab-button.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react' -import { Button, IconButton } from '@chakra-ui/react' +import { Button, IconButton, Tooltip } from '@chakra-ui/react' import cx from 'classnames' import { File } from '@/client/api/file' import { IconOpenInNew } from '@/lib/components/icons' @@ -35,31 +35,31 @@ const DrawerOpenNewTabButton = ({ if (!file.snapshot?.original) { return null } - if (isCollapsed) { - return ( - } - as="a" - className={cx('h-[50px]', 'w-[50px]', 'p-1.5', 'rounded-md')} - href={url} - target="_blank" - title={label} - aria-label={label} - /> - ) - } else { - return ( - - ) - } + return ( + + {isCollapsed ? ( + } + as="a" + className={cx('h-[50px]', 'w-[50px]', 'p-1.5', 'rounded-md')} + href={url} + target="_blank" + title={label} + aria-label={label} + /> + ) : ( + + )} + + ) } export default DrawerOpenNewTabButton diff --git a/ui/src/lib/components/drawer/drawer-item.tsx b/ui/src/lib/components/drawer/drawer-item.tsx index 10d1fd969..49351728c 100644 --- a/ui/src/lib/components/drawer/drawer-item.tsx +++ b/ui/src/lib/components/drawer/drawer-item.tsx @@ -1,5 +1,6 @@ import { ReactElement, useContext, useEffect, useState } from 'react' import { Link, useLocation } from 'react-router-dom' +import { Tooltip } from '@chakra-ui/react' import cx from 'classnames' import { DrawerContext } from './drawer-context' @@ -38,55 +39,57 @@ export const DrawerItem = ({ title={isCollapsed ? `${primaryText}: ${secondaryText}` : secondaryText} className={cx('w-full')} > -
+
- {icon} -
- {!isCollapsed ? ( - - {primaryText} - - ) : null} -
+ {icon} + + {!isCollapsed ? ( + + {primaryText} + + ) : null} + + ) } diff --git a/ui/src/lib/components/drawer/index.tsx b/ui/src/lib/components/drawer/index.tsx index 255e49d8e..e1738e716 100644 --- a/ui/src/lib/components/drawer/index.tsx +++ b/ui/src/lib/components/drawer/index.tsx @@ -29,14 +29,10 @@ const Drawer = ({ children, storage, logo }: DrawerProps) => { if (value) { collapse = JSON.parse(value) } else { - localStorage.setItem(localStorageCollapsedKey, JSON.stringify(false)) + localStorage.setItem(localStorageCollapsedKey, JSON.stringify(true)) } } - if (collapse) { - setIsCollapsed(true) - } else { - setIsCollapsed(false) - } + setIsCollapsed(collapse) }, [localStorageCollapsedKey, setIsCollapsed]) if (isCollapsed === undefined) { diff --git a/ui/src/lib/components/switch-card.tsx b/ui/src/lib/components/switch-card.tsx index a0dfdecec..893723fce 100644 --- a/ui/src/lib/components/switch-card.tsx +++ b/ui/src/lib/components/switch-card.tsx @@ -14,6 +14,7 @@ import { PopoverContent, PopoverTrigger, Switch, + Tooltip, } from '@chakra-ui/react' import cx from 'classnames' @@ -72,13 +73,17 @@ const SwitchCard = ({ return ( - +
+ + + +
{children}