"use client"; import { IconLoader2 } from "@tabler/icons-react"; 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
Loading files...
; } if (loadState === "waiting") { return (
Preparing workspace...
); } if (loadState === "manual") { return (
{loadError ?? "Workspace is still starting."}
); } return null; }