"use client"; import { useState } from "react"; import classNames from "classnames"; import { isCloudEnvironment, useBoolean } from "@/utils"; import { PlayIcon } from "@/ui/Icons"; import PopupMenu from "@/ui/elements/PopupMenu"; import { IconButton } from "@/ui/elements"; import { LoadingIndicator } from "@/ui/App"; import { Cell } from "./types"; interface NotebookCellHeaderProps { cell: Cell; runCell?: (cell: Cell, cogneeInstance: string) => Promise; renameCell: (cell: Cell) => void; removeCell: (cell: Cell) => void; moveCellUp: (cell: Cell) => void; moveCellDown: (cell: Cell) => void; className?: string; } export default function NotebookCellHeader({ cell, runCell, renameCell, removeCell, moveCellUp, moveCellDown, className, }: NotebookCellHeaderProps) { const { value: isRunningCell, setTrue: setIsRunningCell, setFalse: setIsNotRunningCell, } = useBoolean(false); const [runInstance] = useState(isCloudEnvironment() ? "cloud" : "local"); const handleCellRun = () => { if (runCell) { setIsRunningCell(); runCell(cell, runInstance) .finally(() => { setIsNotRunningCell(); }); } }; return (
{runCell && ( <> {isRunningCell ? : } )} {cell.type === "markdown" ? "Markdown Cell" : cell.name}
{runCell && ( isCloudEnvironment() ? (
cloud cognee
) : (
local cognee
) )} {/* */}
); }