import { useState } from "react"; import type { InstanceTab } from "../../generated/types"; import IdBadge from "./IdBadge"; import { TabsLayout, EmptyView } from "../molecules"; import ScreencastTile from "../screencast/ScreencastTile"; interface Props { selectedTab: InstanceTab | null; instanceId?: string; } type SubTabId = "actions" | "live" | "console" | "errors"; export default function SelectedTabPanel({ selectedTab, instanceId }: Props) { const [activeSubTab, setActiveSubTab] = useState("live"); const subTabs: { id: SubTabId; label: string }[] = [ { id: "live", label: "Live" }, { id: "actions", label: "Actions" }, { id: "console", label: "Console" }, { id: "errors", label: "Errors" }, ]; if (!selectedTab) { return (
); } return (
{selectedTab.title || "Untitled"}
{selectedTab.url}
setActiveSubTab(id)} > {activeSubTab === "actions" && ( )} {activeSubTab === "live" && (
{instanceId ? (
) : ( )}
)} {activeSubTab === "console" && ( )} {activeSubTab === "errors" && ( )}
); }