TypeScript
fix(web): composer host and workspace tooltips show their shortcuts (#21167)
Jordan Munch O'Hare70bdbc30b293
diff --git a/apps/web/src/components/BranchToolbarEnvModeSelector.tsx b/apps/web/src/components/BranchToolbarEnvModeSelector.tsxindex 0a529ca5ee5..60a9584fe0b 100644--- a/apps/web/src/components/BranchToolbarEnvModeSelector.tsx+++ b/apps/web/src/components/BranchToolbarEnvModeSelector.tsx@@ -20,6 +20,9 @@ import {SelectValue,} from "./ui/select";import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";+import { useAtomValue } from "@effect/atom-react";+import { shortcutLabelForCommand } from "../keybindings";+import { primaryServerKeybindingsAtom } from "../state/server";const PREVIOUS_WORKTREE_SELECT_VALUE = "previous-worktree";@@ -45,6 +48,10 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSeonUsePreviousWorktree,}: BranchToolbarEnvModeSelectorProps) {const composerFloatingLayerProps = useComposerMenuProps();+ const shortcutLabel = shortcutLabelForCommand(+ useAtomValue(primaryServerKeybindingsAtom),+ "composer.workspace",+ );const showPreviousWorktree = Boolean(previousWorktreeLabel && onUsePreviousWorktree);const envModeItems = [{@@ -137,6 +144,7 @@ export const BranchToolbarEnvModeSelector = memo(function BranchToolbarEnvModeSe{effectiveEnvMode === "worktree"? resolveEnvModeLabel("worktree"): resolveCurrentWorkspaceLabel(activeWorktreePath)}+ {shortcutLabel ? ` · ${shortcutLabel}` : null}</TooltipPopup></Tooltip><SelectPopupdiff --git a/apps/web/src/components/BranchToolbarEnvironmentSelector.tsx b/apps/web/src/components/BranchToolbarEnvironmentSelector.tsxindex f1647a812a1..038f33f02e9 100644--- a/apps/web/src/components/BranchToolbarEnvironmentSelector.tsx+++ b/apps/web/src/components/BranchToolbarEnvironmentSelector.tsx@@ -1,6 +1,9 @@import { ComposerSelectControl } from "./chat/ComposerControl";import { ComposerContextLabel } from "./ComposerContextLabel";import { Tooltip, TooltipTrigger, TooltipPopup } from "./ui/tooltip";+import { useAtomValue } from "@effect/atom-react";+import { shortcutLabelForCommand } from "../keybindings";+import { primaryServerKeybindingsAtom } from "../state/server";import type { EnvironmentId } from "@t3tools/contracts";import { ScaleIcon } from "lucide-react";import { memo } from "react";@@ -35,6 +38,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvironEnvironmentChange,}: BranchToolbarEnvironmentSelectorProps) {const composerFloatingLayerProps = useComposerMenuProps();+ const shortcutLabel = shortcutLabelForCommand(+ useAtomValue(primaryServerKeybindingsAtom),+ "composer.host",+ );const activeEnvironment =availableEnvironments.find((env) => env.environmentId === environmentId) ?? null;@@ -107,7 +114,10 @@ export const BranchToolbarEnvironmentSelector = memo(function BranchToolbarEnvir<SelectValue /></ComposerContextLabel></TooltipTrigger>- <TooltipPopup>{autoEnvironmentLabel ?? activeEnvironment?.label ?? "Run on"}</TooltipPopup>+ <TooltipPopup>+ {autoEnvironmentLabel ?? activeEnvironment?.label ?? "Run on"}+ {shortcutLabel ? ` · ${shortcutLabel}` : null}+ </TooltipPopup></Tooltip><SelectPopup alignItemWithTrigger={false} {...composerFloatingLayerProps}><SelectGroup>