"use client"; import { PanelLoadingState } from "@/components/panel-loading-state"; import type { FileTreeNode } from "@/lib/types/backend"; type RenderSessionOrLoadStateInput = { isSessionFailed: boolean; sessionError: string | null | undefined; loadState: string; isLoadingTree: boolean; tree: FileTreeNode | null; loadError: string | null; onRetry: () => void; }; export function renderSessionOrLoadState({ isSessionFailed, sessionError, loadState, isLoadingTree, tree, loadError, onRetry, }: RenderSessionOrLoadStateInput) { if (isSessionFailed) { return (
Session failed
{sessionError &&
{sessionError}
}
); } if ((loadState === "loading" || isLoadingTree) && !tree) { return ; } if (loadState === "waiting") { return ; } if (loadState === "manual") { return (
{loadError ?? "Workspace is still starting."}
); } return null; }