shortcut tooltip update

This commit is contained in:
Nate Kelley 2025-03-22 16:16:59 -06:00
parent 7fd5d346ff
commit 2dcd559b26
No known key found for this signature in database
GPG Key ID: FD90372AB8D98B4F
5 changed files with 39 additions and 34 deletions

View File

@ -23,6 +23,7 @@ import {
useGetUserFavorites,
useUpdateUserFavorites
} from '@/api/buster_rest';
import { useHotkeys } from 'react-hotkeys-hook';
const topItems: ISidebarList = {
id: 'top-items',
@ -165,33 +166,41 @@ export const SidebarPrimary = React.memo(() => {
SidebarPrimary.displayName = 'SidebarPrimary';
const SidebarPrimaryHeader = React.memo(() => {
return (
<div className="flex items-center justify-between">
<BusterLogoWithText />
<div className="flex items-center gap-2">
<Tooltip title="Settings">
<Link href={createBusterRoute({ route: BusterRoutes.SETTINGS_PROFILE })}>
<Button prefix={<Gear />} variant="ghost" />
</Link>
</Tooltip>
<Tooltip title="Start a chat">
<Link href={createBusterRoute({ route: BusterRoutes.APP_HOME })}>
<Button
size="tall"
rounding={'large'}
prefix={
<div className="flex items-center justify-center">
<PencilSquareIcon />
</div>
}
/>
</Link>
</Tooltip>
const SidebarPrimaryHeader = React.memo(
() => {
const onChangePage = useAppLayoutContextSelector((s) => s.onChangePage);
useHotkeys('C', () => {
onChangePage(BusterRoutes.APP_HOME);
});
return (
<div className="flex items-center justify-between">
<BusterLogoWithText />
<div className="flex items-center gap-2">
<Tooltip title="Settings">
<Link href={createBusterRoute({ route: BusterRoutes.SETTINGS_PROFILE })}>
<Button prefix={<Gear />} variant="ghost" />
</Link>
</Tooltip>
<Tooltip title="Start a chat" shortcuts={['C']}>
<Link href={createBusterRoute({ route: BusterRoutes.APP_HOME })}>
<Button
size="tall"
rounding={'large'}
prefix={
<div className="flex items-center justify-center">
<PencilSquareIcon />
</div>
}
/>
</Link>
</Tooltip>
</div>
</div>
</div>
);
});
);
},
() => true
);
SidebarPrimaryHeader.displayName = 'SidebarPrimaryHeader';

View File

@ -24,8 +24,8 @@ const TooltipShortcut: React.FC<{ shortcut: string }> = ({ shortcut }) => {
return (
<div
className={cn(
'border-border bg-background text2xs pointer-events-none relative flex h-5 items-center justify-center rounded border-[0.5px] px-[1.5px] leading-none shadow',
numberOfChars === 1 ? 'w-[1.375rem]' : 'px-1'
'bg-background text-gray-light pointer-events-none relative flex h-5 items-center justify-center rounded px-[0.5px] text-xs leading-none',
numberOfChars === 1 ? '' : 'px-1'
)}>
{shortcut}
</div>

View File

@ -59,7 +59,7 @@ const TooltipContent: React.FC<{
shortcut?: string[];
}> = ({ title, shortcut }) => {
return (
<div className="flex h-3 max-h-3 min-h-3 items-center gap-x-1">
<div className="flex h-3 max-h-3 min-h-3 items-center gap-x-1.5">
<span className="text-sm">{title}</span>
<KeyboardShortcutPill shortcut={shortcut} />
</div>

View File

@ -20,7 +20,7 @@ const TooltipContent = React.forwardRef<
sideOffset={sideOffset}
className={cn(
'bg-popover text-popover-foreground',
'rounded border py-1.5 pr-0.5 pl-1.5',
'rounded border px-1.5 py-1.5',
'text-sm shadow',
'animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden',
className

View File

@ -153,10 +153,6 @@ EmptyState.displayName = 'EmptyState';
const TitleCell = React.memo<{ title: string; status: VerificationStatus; metricId: string }>(
({ title, status, metricId }) => {
const onFavoriteDivClick = useMemoizedFn((e: React.MouseEvent<HTMLDivElement>) => {
e.stopPropagation();
});
return (
<div className="mr-2 flex w-full items-center space-x-2">
<div className="flex items-center justify-center">