Skip to content
Merged
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: 6 additions & 8 deletions src/components/DevPreview/ConsoleDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useState, useCallback, useEffect } from "react";
import { ChevronUp, RotateCw } from "lucide-react";
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";

import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from "@/components/ui/tooltip";
import { XtermAdapter } from "../Terminal/XtermAdapter";
import { terminalInstanceService } from "../../services/TerminalInstanceService";
Expand Down Expand Up @@ -120,21 +120,19 @@ export function ConsoleDrawer({
<Tooltip>
<TooltipTrigger asChild>
<span className="inline-flex">
<Button
<button
type="button"
onClick={onHardRestart}
disabled={hardRestartDisabled}
className={cn(
"flex min-h-8 shrink-0 items-center gap-2 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wide text-canopy-text/80 transition-colors",
"hover:bg-overlay-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-status-info disabled:cursor-not-allowed disabled:opacity-40",
isRestarting && "text-server-starting"
"p-1.5 rounded hover:bg-overlay-medium disabled:opacity-30 disabled:cursor-not-allowed transition-colors",
isRestarting && "animate-spin"
)}
aria-label={restartTooltip}
aria-busy={isRestarting}
>
<RotateCw className={cn("h-3.5 w-3.5", isRestarting && "animate-spin")} />
<span>Restart</span>
</Button>
<RotateCw className="h-3.5 w-3.5" />
</button>
</span>
</TooltipTrigger>
<TooltipContent side="bottom">{restartTooltip}</TooltipContent>
Expand Down
14 changes: 14 additions & 0 deletions src/components/DevPreview/__tests__/ConsoleDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,20 @@ describe("ConsoleDrawer", () => {
expect(screen.getByRole("button", { name: "Hard restart dev preview" })).toBeTruthy();
});

it("renders restart button as icon-only with no visible text", () => {
render(
<ConsoleDrawer
terminalId={mockTerminalId}
defaultOpen={false}
onHardRestart={vi.fn()}
status="running"
/>
);
const restartButton = screen.getByRole("button", { name: "Hard restart dev preview" });
expect(restartButton.textContent).toBe("");
expect(restartButton.querySelector("svg")).toBeTruthy();
});

it("calls onHardRestart when restart button is clicked", () => {
const onHardRestart = vi.fn();
render(
Expand Down