{terminalGroup.terminalIds.map((terminalId) => {
const isActive = terminalId === resolvedActiveTerminalId;
- const closeTerminalLabel = `Close ${
- terminalLabelById.get(terminalId) ?? "terminal"
- }${isActive && closeShortcutLabel ? ` (${closeShortcutLabel})` : ""}`;
+ const terminalLabel = terminalLabelById.get(terminalId) ?? "Terminal";
+ const closeTerminalLabel = `Close ${terminalLabel}${
+ isActive && closeShortcutLabel ? ` (${closeShortcutLabel})` : ""
+ }`;
return (
- {showGroupHeaders && (
-
└
+ : "text-muted-foreground hover:bg-accent/60 hover:text-foreground",
)}
+ >
+
confirmCloseTerminal(terminalId)}
+ tooltip={closeTerminalLabel}
+ >
+
+
- {normalizedTerminalIds.length > 1 && (
-
- confirmCloseTerminal(terminalId)}
- aria-label={closeTerminalLabel}
- />
- }
- >
-
-
-
- {closeTerminalLabel}
-
-
- )}
);
})}
diff --git a/apps/web/src/components/ui/panel-tab-close-button.tsx b/apps/web/src/components/ui/panel-tab-close-button.tsx
new file mode 100644
index 000000000000..0e17a8f23a38
--- /dev/null
+++ b/apps/web/src/components/ui/panel-tab-close-button.tsx
@@ -0,0 +1,41 @@
+import { X } from "lucide-react";
+import type { ReactNode } from "react";
+import { Tooltip, TooltipPopup, TooltipTrigger } from "~/components/ui/tooltip";
+
+interface PanelTabCloseButtonProps {
+ children: ReactNode;
+ label: string;
+ onClick: () => void;
+ tooltip?: string;
+}
+
+/** Inside a `group/tab` row, swaps the tab identity for its close action on hover or focus. */
+export function PanelTabCloseButton({
+ children,
+ label,
+ onClick,
+ tooltip,
+}: PanelTabCloseButtonProps) {
+ const button = (
+
+ );
+
+ if (!tooltip) return button;
+
+ return (
+
+
+ {tooltip}
+
+ );
+}