import { useContext } from "react";
import Button from "@moduletrace/twui/layout/Button";
import Span from "@moduletrace/twui/layout/Span";
import { Hand } from "lucide-react";
import { ComputerViewModes, type ComputerViewMode } from "@/src/dict/computer-dict";
import { BotComputersContext } from "../(data)/bot-computers-context";
type Props = {
computer_id: number;
mode: ComputerViewMode;
};
/**
* The bot asked the user to take over a computer (`takeOverRef`): a
* button that opens it in the viewer, in the mode the bot asked for. A
* computer the bot can't use (any more) is shown by name only.
*/
export default function TakeOverChip({ computer_id, mode }: Props) {
const { computers, openComputer } = useContext(BotComputersContext);
const computer = computers.find((c) => c.id == computer_id);
const name = computer?.name || `computer ${computer_id}`;
const mode_title = ComputerViewModes.find((m) => m.value == mode)?.title || mode;
if (!computer) {
return {name};
}
return (
);
}