TypeScript
fix(web): add tooltips to boring sidebar actions (#26477)
Utkarsh Patil8df96fb3ec4d
diff --git a/apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsx b/apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsxindex 1ee152533a7..a73c3f21f0b 100644--- a/apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsx+++ b/apps/web/src/components/sidebar/SidebarProjectFolderHeader.tsx@@ -9,6 +9,7 @@ import { useUiStateStore } from "../../uiStateStore";import { resolveSidebarFolderDot, resolveThreadLastVisitedAt } from "../Sidebar.logic";import { ProjectFavicon } from "../ProjectFavicon";import { Button } from "../ui/button";+import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";const FOLDER_DOT_CLASS_NAME = {attention: "bg-warning",@@ -100,15 +101,22 @@ export const SidebarProjectFolderHeader = memo(function SidebarProjectFolderHead</button>{/* Sits over the count, which hides on hover, and left of the chevron. */}<span className="absolute inset-y-0 right-6 flex items-center opacity-0 focus-within:opacity-100 group-hover/project-folder:opacity-100 pointer-coarse:opacity-100">- <Button- data-sidebar-action-for={rowId}- size="icon-xs"- variant="ghost-muted"- aria-label={`New thread in ${group.displayName}`}- onClick={() => props.onNewThread(group)}- >- <SquarePenIcon aria-hidden />- </Button>+ <Tooltip>+ <TooltipTrigger+ render={+ <Button+ data-sidebar-action-for={rowId}+ size="icon-xs"+ variant="ghost-muted"+ aria-label={`New thread in ${group.displayName}`}+ onClick={() => props.onNewThread(group)}+ />+ }+ >+ <SquarePenIcon aria-hidden />+ </TooltipTrigger>+ <TooltipPopup>New thread in {group.displayName}</TooltipPopup>+ </Tooltip></span></li>);diff --git a/apps/web/src/components/sidebar/SidebarThreadRow.tsx b/apps/web/src/components/sidebar/SidebarThreadRow.tsxindex 4873a4b5b13..bc89186d937 100644--- a/apps/web/src/components/sidebar/SidebarThreadRow.tsx+++ b/apps/web/src/components/sidebar/SidebarThreadRow.tsx@@ -1352,18 +1352,25 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP<TooltipPopup side="top">Un-settle thread</TooltipPopup></Tooltip>) : (- <button- type="button"- aria-label="Settle thread"- onClick={handleSettleClick}- onPointerDown={handleActionPointerDown}- className={cn(- "pointer-events-none absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",- isWoke && "group-any-hover/sidebar-row:static",- )}- >- <CheckIcon className="size-3" />- </button>+ <Tooltip>+ <TooltipTrigger+ render={+ <button+ type="button"+ aria-label="Settle thread"+ onClick={handleSettleClick}+ onPointerDown={handleActionPointerDown}+ className={cn(+ "pointer-events-none absolute inset-y-0 right-0 inline-flex cursor-pointer items-center gap-1 rounded-md bg-transparent px-2 text-xs text-muted-foreground opacity-0 transition-opacity hover:text-foreground focus-visible:pointer-events-auto focus-visible:opacity-100 group-any-hover/sidebar-row:pointer-events-auto group-any-hover/sidebar-row:opacity-100",+ isWoke && "group-any-hover/sidebar-row:static",+ )}+ />+ }+ >+ <CheckIcon className="size-3" />+ </TooltipTrigger>+ <TooltipPopup side="top">Settle thread</TooltipPopup>+ </Tooltip>)}</span>)}