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
14 changes: 5 additions & 9 deletions apps/web/src/components/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,8 @@ export default function ChatView(props: ChatViewProps) {
const rightPanelPresent = rightPanelPresence.present;
const rightPanelControlsInPanel =
shouldUsePlanSidebarSheet && rightPanelPresent && rightPanelOpen;
const rightPanelControlsAtRoot = rightPanelPresent && !shouldUsePlanSidebarSheet;
// One mount point for open and closed, so the toggles are not remounted.
const rightPanelControlsAtRoot = !rightPanelControlsInPanel;
Comment thread
maria-rcks marked this conversation as resolved.
Resolved
const renderedRightPanelSurface = rightPanelPresence.value?.activeSurface ?? null;
const renderedRightPanelSurfaces = rightPanelPresence.value?.surfaces ?? [];
const previewMiniPlayerVisible = shouldRenderPreviewMiniPlayer(
Expand Down Expand Up @@ -3371,7 +3372,6 @@ export default function ChatView(props: ChatViewProps) {
state={deviceState}
/>
)}
{rightPanelControlsAtRoot && !embedded ? panelLayoutControls : null}
<div
className={cn(
"flex min-h-0 min-w-0 flex-col overflow-x-hidden",
Expand Down Expand Up @@ -3399,13 +3399,6 @@ export default function ChatView(props: ChatViewProps) {
COLLAPSED_SIDEBAR_TITLEBAR_INSET_CLASS,
)}
>
{isElectron && rightPanelControlsAtRoot ? (
<span
aria-hidden
className="pointer-events-none fixed top-[var(--workspace-controls-top)] right-[var(--workspace-controls-right)] h-[var(--workspace-topbar-height)] w-28 [-webkit-app-region:no-drag]"
/>
) : null}
{!rightPanelControlsAtRoot && !rightPanelControlsInPanel ? panelLayoutControls : null}
{inlineRightPanelOwnsTitleBar ? threadPanelHeaderControl : null}
<ChatHeader
activeThreadEnvironmentId={activeThread.environmentId}
Expand Down Expand Up @@ -4092,6 +4085,9 @@ export default function ChatView(props: ChatViewProps) {
</ChatRightPanel>
) : null}

{/* Electron caption hit-testing gives later no-drag regions precedence. */}
{rightPanelControlsAtRoot && !embedded ? panelLayoutControls : null}

<RevertConfirmHost
threadKey={routeThreadKey}
checkpoints={serverProjection?.checkpoints}
Expand Down
39 changes: 25 additions & 14 deletions apps/web/src/components/chat/PanelLayoutControls.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import {
PanelBottomCloseIcon,
PanelBottomIcon,
PanelRightCloseIcon,
PanelRightIcon,
SquareMenuIcon,
Maximize2Icon,
Expand All @@ -11,6 +13,7 @@ import { memo, type ReactNode, useLayoutEffect, useRef } from "react";
import { cn } from "~/lib/utils";

import type { ThreadPanelPresentation } from "../../rightPanelLayout";
import { Button } from "../ui/button";
import { PopoverCreateHandle, PopoverTrigger } from "../ui/popover";
import { useMobileSidebarSheetMounted } from "../ui/sidebar";
import { Toggle } from "../ui/toggle";
Expand Down Expand Up @@ -97,17 +100,21 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
{showTerminalControl ? (
<Tooltip>
<TooltipTrigger render={<span className="flex shrink-0" />}>
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={terminalOpen}
onPressedChange={onToggleTerminal}
<Button
className="[-webkit-app-region:no-drag]"
aria-pressed={terminalOpen}
onClick={onToggleTerminal}
aria-label={gt("Toggle terminal drawer")}
variant="ghost"
size="sm"
size="icon-sm"
disabled={!terminalAvailable}
>
<PanelBottomIcon className="size-4" />
</Toggle>
{terminalOpen ? (
<PanelBottomCloseIcon className="size-4" />
) : (
<PanelBottomIcon className="size-4" />
)}
</Button>
</TooltipTrigger>
<TooltipPopup side="bottom">
{terminalAvailable
Expand All @@ -121,18 +128,22 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
{showRightPanelControl ? (
<Tooltip>
<TooltipTrigger render={<span className="flex shrink-0" />}>
<Toggle
className="shrink-0 [-webkit-app-region:no-drag]"
pressed={rightPanelOpen}
onPressedChange={onToggleRightPanel}
<Button
className="[-webkit-app-region:no-drag]"
aria-pressed={rightPanelOpen}
onClick={onToggleRightPanel}
aria-label={gt("Toggle right panel")}
data-right-panel-toggle
variant="ghost"
size="sm"
size="icon-sm"
disabled={!rightPanelAvailable}
>
<PanelRightIcon className="size-4" />
</Toggle>
{rightPanelOpen ? (
<PanelRightCloseIcon className="size-4" />
) : (
<PanelRightIcon className="size-4" />
)}
</Button>
</TooltipTrigger>
<TooltipPopup side="bottom">
{rightPanelAvailable
Expand Down
14 changes: 9 additions & 5 deletions apps/web/src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -1479,22 +1479,26 @@ html[data-theme-id] [data-chat-header] [data-toolbar-control] {
color: var(--contrast-toolbar-control-foreground);
}

/* The panel layout toggles stay ghost: they render both inside the header and
in the titlebar strip, so filling them would make them change appearance as
the panel opens. They only take the themed foreground; hover and pressed
keep the base ghost accent. The tooltip trigger's data-slot wins over the
toggle's when the trigger renders the toggle, so match both. */
/* The panel layout controls stay ghost: some render inside the header and
others in the titlebar strip, so filling them would make them disagree. They
only take the themed foreground; hover and pressed keep the base ghost
accent. The tooltip trigger's data-slot wins over the control's when the
trigger renders it, so match both. */
html[data-theme-id] [data-panel-layout-controls] [data-slot="toggle"],
html[data-theme-id] [data-panel-layout-controls] [data-slot="button"],
html[data-theme-id] [data-panel-layout-controls] [data-slot="tooltip-trigger"],
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="toggle"],
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="button"],
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="tooltip-trigger"] {
--control-icon-color: var(--contrast-toolbar-foreground);
color: var(--contrast-toolbar-foreground);
}

html[data-theme-id] [data-panel-layout-controls] [data-slot="toggle"]:disabled,
html[data-theme-id] [data-panel-layout-controls] [data-slot="button"]:disabled,
html[data-theme-id] [data-panel-layout-controls] [data-slot="tooltip-trigger"]:disabled,
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="toggle"]:disabled,
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="button"]:disabled,
html[data-theme-id] [data-workspace-titlebar-controls] [data-slot="tooltip-trigger"]:disabled {
--control-icon-color: color-mix(
in oklab,
Expand Down
Loading