/* Copyright 2026 Marimo. All rights reserved. */ import { useAtom, useAtomValue } from "jotai"; import { ChevronDownIcon } from "lucide-react"; import { ProgressStatusIcon, type ProgressState, } from "@/components/ui/progress-stages"; import { isConnectedAtom } from "@/core/network/connection"; import { connectionNoticeAtom } from "@/core/network/connection-notice"; import { sandboxAtom } from "@/core/packages/sandbox-state"; import { cn } from "@/utils/cn"; import type { PanelSection } from "./panel-context"; import { runtimeDetailsExpandedAtom } from "./runtime-details-state"; export function RuntimeStatusToggle({ section }: { section: PanelSection }) { const sandbox = useAtomValue(sandboxAtom); const notice = useAtomValue(connectionNoticeAtom); const [expanded, setExpanded] = useAtom(runtimeDetailsExpandedAtom); const connected = useAtomValue(isConnectedAtom); const label = sandbox?.backend ? `${sandbox.backend} sandbox` : "Runtime"; const statusLabel = notice?.title ?? (connected ? "Kernel ready" : "Kernel not connected"); const status: ProgressState = notice ? notice.pending ? "running" : "failed" : connected ? "succeeded" : "waiting"; return ( ); }