Open the bot's computer from beside the composer's tools

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-19 15:52:43 +01:00
co-authored by Claude Opus 5.5
parent dd1e9e0cfe
commit a207f9ae93
3 changed files with 46 additions and 4 deletions
@@ -0,0 +1,33 @@
import { useContext } from "react";
import Button from "@moduletrace/twui/layout/Button";
import { Monitor } from "lucide-react";
import { BotComputersContext } from "../(data)/bot-computers-context";
/**
* Beside the composer's tools: opens the computer the bot is on in the
* viewer. Nothing when it has none.
*/
export default function ComposerComputerButton() {
const { computers, openComputer } = useContext(BotComputersContext);
const computer = computers[0];
if (!computer?.id) return null;
const title = `Open ${computer.name || `computer ${computer.id}`}`;
return (
<Button
title={title}
aria-label={title}
type="button"
variant="ghost"
color="gray"
size="small"
onClick={() => openComputer({ computer_id: computer.id || 0, mode: "browser" })}
className="shrink-0 px-1.5! py-0.5! text-ink-secondary dark:text-ink-secondary hover:text-ink hover:dark:text-ink"
>
<Monitor size={14} aria-hidden />
</Button>
);
}