Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 26 additions & 30 deletions apps/web/src/browser/BrowserDeviceToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { msg, T, useGT, useMessages } from "gt-react";

import { Button } from "~/components/ui/button";
import { Input } from "~/components/ui/input";
import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
import {
Select,
SelectGroup,
Expand All @@ -26,6 +25,7 @@ import { cn } from "~/lib/utils";
import { BROWSER_DEVICE_TOOLBAR_HEIGHT, resizeFreeformViewport } from "./browserViewportLayout";
import { commitViewportAndAspectRatio } from "./browserDeviceToolbarState";
import { ScreenRotationIcon } from "./ScreenRotationIcon";
import { SharedTooltipTrigger } from "~/components/ui/shared-tooltip";

const RESPONSIVE_VALUE = "responsive";
const SELECT_ITEMS = [
Expand Down Expand Up @@ -293,35 +293,31 @@ export function BrowserDeviceToolbar({
/>
</form>

<Tooltip>
<TooltipTrigger
render={
<Button
variant={aspectRatio === null ? "ghost" : "secondary"}
size="icon-xs"
type="button"
aria-label={
aspectRatio === null
? gt("Lock viewport aspect ratio")
: gt("Unlock viewport aspect ratio")
}
aria-pressed={aspectRatio !== null}
disabled={pending || !customValid}
onPointerDown={(event) => event.preventDefault()}
onClick={toggleAspectRatio}
/>
}
>
{aspectRatio === null ? (
<Unlink2 className={cn(aspectRatio !== null && "text-foreground")} />
) : (
<Link2 className={cn(aspectRatio !== null && "text-foreground")} />
)}
</TooltipTrigger>
<TooltipPopup side="top">
{aspectRatio === null ? <T>Lock aspect ratio</T> : <T>Unlock aspect ratio</T>}
</TooltipPopup>
</Tooltip>
<SharedTooltipTrigger
render={
<Button
variant={aspectRatio === null ? "ghost" : "secondary"}
size="icon-xs"
type="button"
aria-label={
aspectRatio === null
? gt("Lock viewport aspect ratio")
: gt("Unlock viewport aspect ratio")
}
aria-pressed={aspectRatio !== null}
disabled={pending || !customValid}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
onPointerDown={(event) => event.preventDefault()}
onClick={toggleAspectRatio}
/>
}
label={aspectRatio === null ? <T>Lock aspect ratio</T> : <T>Unlock aspect ratio</T>}
>
{aspectRatio === null ? (
<Unlink2 className={cn(aspectRatio !== null && "text-foreground")} />
) : (
<Link2 className={cn(aspectRatio !== null && "text-foreground")} />
)}
</SharedTooltipTrigger>
<Button
variant="ghost"
size="icon-xs"
Expand Down
33 changes: 17 additions & 16 deletions apps/web/src/components/AppRouteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { useCloseAppModal } from "./sidebar/mainAppLocation";
import { GlobalVoiceInputIndicator } from "./chat/GlobalVoiceInputIndicator";
import { Button } from "./ui/button";
import { DialogBackdrop } from "./ui/dialog";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { SharedTooltipTrigger } from "./ui/shared-tooltip";

/**
* Large modal for the Settings and Usage routes. Esc, the close button, or a press on the
Expand Down Expand Up @@ -160,20 +160,21 @@ function blurFocusedWithin(container: HTMLElement | null) {
export function AppRouteModalClose() {
const gt = useGT();
return (
<Tooltip>
<TooltipTrigger
render={
<DialogPrimitive.Close
aria-label={gt("Close")}
render={<Button size="icon-sm" variant="ghost" />}
/>
}
>
<XIcon />
</TooltipTrigger>
<TooltipPopup side="bottom">
<T>Close (Esc)</T>
</TooltipPopup>
</Tooltip>
<SharedTooltipTrigger
render={
<DialogPrimitive.Close
aria-label={gt("Close")}
render={<Button size="icon-sm" variant="ghost" />}
/>
}
label={
<>
<T>Close (Esc)</T>
</>
}
side="bottom"
>
<XIcon />
</SharedTooltipTrigger>
);
}
37 changes: 18 additions & 19 deletions apps/web/src/components/AppSidebarLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ import {
useSidebar,
useSidebarVisibility,
} from "./ui/sidebar";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { appAtomRegistry } from "../rpc/atomRegistry";
import { registerCommands, registerMenuAction } from "../shortcuts/dispatcher";
import { resolveThreadRouteRef } from "../threadRoutes";
import { SharedTooltipTrigger } from "./ui/shared-tooltip";

const MACOS_TRAFFIC_LIGHTS_LEFT_INSET = "var(--desktop-window-controls-inset, 90px)";

Expand Down Expand Up @@ -393,25 +393,24 @@ function SidebarControl({ showSidebar }: { readonly showSidebar: boolean }) {
data-sidebar-control=""
>
{showSidebar ? (
<Tooltip>
<TooltipTrigger
render={
<SidebarTrigger
variant={isSidebarVisible && stageBackdropVariant ? "media-navigation" : "ghost"}
className={cn(
"pointer-events-auto",
isSidebarVisible && stageBackdropVariant && "relative top-auto translate-y-0",
)}
aria-label={gt("Toggle main sidebar")}
/>
}
/>
<TooltipPopup side="bottom">
{shortcutLabel
<SharedTooltipTrigger
render={
<SidebarTrigger
variant={isSidebarVisible && stageBackdropVariant ? "media-navigation" : "ghost"}
className={cn(
"pointer-events-auto",
isSidebarVisible && stageBackdropVariant && "relative top-auto translate-y-0",
)}
aria-label={gt("Toggle main sidebar")}
/>
}
label={
shortcutLabel
? gt("Toggle main sidebar ({shortcut})", { shortcut: shortcutLabel })
: gt("Toggle main sidebar")}
</TooltipPopup>
</Tooltip>
: gt("Toggle main sidebar")
}
side="bottom"
/>
) : null}
</div>
);
Expand Down
63 changes: 32 additions & 31 deletions apps/web/src/components/BranchPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ComboboxPopup,
ComboboxStatus,
} from "./ui/combobox";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { SharedTooltipTrigger } from "./ui/shared-tooltip";

export function BranchPicker({
items,
Expand Down Expand Up @@ -159,37 +159,38 @@ export function BranchPicker({
</ComboboxListVirtualized>
</div>
{originControl ? (
<Tooltip>
<TooltipTrigger
render={
<label
htmlFor={startFromOriginSwitchId}
className="flex cursor-pointer items-center justify-between gap-3 border-t border-border/60 px-3 py-2 text-xs"
>
<span className="flex min-w-0 items-center gap-1.5 font-medium text-muted-foreground">
<RefreshIcon aria-hidden="true" className="size-3 shrink-0" />
<span className="truncate">
<T>Start from remote</T>
</span>
<SharedTooltipTrigger
render={
<label
htmlFor={startFromOriginSwitchId}
className="flex cursor-pointer items-center justify-between gap-3 border-t border-border/60 px-3 py-2 text-xs"
>
<span className="flex min-w-0 items-center gap-1.5 font-medium text-muted-foreground">
<RefreshIcon aria-hidden="true" className="size-3 shrink-0" />
<span className="truncate">
<T>Start from remote</T>
</span>
<Switch
id={startFromOriginSwitchId}
checked={originControl.checked}
size="sm"
aria-label={gt("Start worktree from remote")}
onCheckedChange={(checked) => originControl.onCheckedChange(Boolean(checked))}
/>
</label>
}
/>
<TooltipPopup side="top" className="max-w-72 whitespace-normal">
<T>
Uses the latest commit of the base branch’s tracked remote branch, even if its
name differs. Otherwise uses the same-named branch on origin. Uses your local
branch if that remote branch is missing.
</T>
</TooltipPopup>
</Tooltip>
</span>
<Switch
id={startFromOriginSwitchId}
checked={originControl.checked}
size="sm"
aria-label={gt("Start worktree from remote")}
onCheckedChange={(checked) => originControl.onCheckedChange(Boolean(checked))}
/>
</label>
}
label={
<>
<T>
Uses the latest commit of the base branch’s tracked remote branch, even if its
name differs. Otherwise uses the same-named branch on origin. Uses your local
branch if that remote branch is missing.
</T>
</>
}
className="max-w-72 whitespace-normal"
/>
) : null}
{notice ? <ComboboxStatus>{notice}</ComboboxStatus> : null}
{statusText ? <ComboboxStatus>{statusText}</ComboboxStatus> : null}
Expand Down
60 changes: 29 additions & 31 deletions apps/web/src/components/BranchToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,13 @@ import {
MenuTrigger,
} from "./ui/menu";
import { Separator } from "./ui/separator";
import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
import { MiddleTruncate } from "./ui/middle-truncate";
import { ComposerSurface } from "./chat/ComposerSurface";
import { useComposerMenuProps } from "./chat/composerEventScope";
import { cn } from "~/lib/utils";

import { observeResize } from "~/lib/observeResize";
import { SharedTooltipTrigger } from "./ui/shared-tooltip";

const isClipboardApiUnavailableError = Schema.is(ClipboardApiUnavailableError);
const isClipboardWriteError = Schema.is(ClipboardWriteError);
Expand Down Expand Up @@ -238,41 +238,39 @@ const RunContextSelector = memo(function RunContextSelector({
}
};
const workspaceIcon = (
<Tooltip>
<TooltipTrigger render={<span className="inline-flex shrink-0" />}>
<WorkspaceIcon className={isPanel ? THREAD_DETAILS_PANEL_ICON_CLASS : "size-3 shrink-0"} />
</TooltipTrigger>
<TooltipPopup>
{isPanel
<SharedTooltipTrigger
render={<span className="inline-flex shrink-0" />}
label={
isPanel
? forceNewWorktree
? gt("Each model starts in its own worktree.")
: (workspacePath ?? workspaceLabel)
: workspaceLabel}
</TooltipPopup>
</Tooltip>
: workspaceLabel
}
>
<WorkspaceIcon className={isPanel ? THREAD_DETAILS_PANEL_ICON_CLASS : "size-3 shrink-0"} />
</SharedTooltipTrigger>
);
const environmentIcon = (
<Tooltip>
<TooltipTrigger render={<span className="inline-flex shrink-0" />}>
{autoEnvironmentLabel ? (
<ScaleIcon
className={isPanel ? THREAD_DETAILS_PANEL_ICON_CLASS : "size-3 shrink-0"}
aria-hidden="true"
/>
) : (
<EnvironmentMachineIcon
kind={activeEnvironment?.machine ?? "server"}
// Wide machine glyphs need a little more box to match the square row icons.
className={
isPanel ? cn(THREAD_DETAILS_PANEL_ICON_CLASS, "-mx-px size-4.5") : "size-3 shrink-0"
}
/>
)}
</TooltipTrigger>
<TooltipPopup>
{autoEnvironmentLabel ?? activeEnvironment?.label ?? gt("Run on")}
</TooltipPopup>
</Tooltip>
<SharedTooltipTrigger
render={<span className="inline-flex shrink-0" />}
label={autoEnvironmentLabel ?? activeEnvironment?.label ?? gt("Run on")}
>
{autoEnvironmentLabel ? (
<ScaleIcon
className={isPanel ? THREAD_DETAILS_PANEL_ICON_CLASS : "size-3 shrink-0"}
aria-hidden="true"
/>
) : (
<EnvironmentMachineIcon
kind={activeEnvironment?.machine ?? "server"}
// Wide machine glyphs need a little more box to match the square row icons.
className={
isPanel ? cn(THREAD_DETAILS_PANEL_ICON_CLASS, "-mx-px size-4.5") : "size-3 shrink-0"
}
/>
)}
</SharedTooltipTrigger>
);
const icon = showEnvironmentIndicator ? environmentIcon : workspaceIcon;
const triggerContent = (
Expand Down
Loading
Loading