"use client"; import { TabsContent } from "@kandev/ui/tabs"; import { FileEditorContent } from "./file-editor-content"; import { FileImageViewer } from "./file-image-viewer"; import { FileBinaryViewer } from "./file-binary-viewer"; import type { OpenFileTab } from "@/lib/types/backend"; import { getFileCategory } from "@/lib/utils/file-types"; export function FileTabContent({ tab, activeSession, activeSessionId, isSaving, onFileChange, onFileSave, onFileDelete, }: { tab: OpenFileTab; activeSession: { worktree_path?: string | null } | null; activeSessionId: string | null; isSaving: boolean; onFileChange: (path: string, content: string) => void; onFileSave: (path: string) => void; onFileDelete: (path: string) => void; }) { const extCategory = getFileCategory(tab.path); let category: "image" | "binary" | "text" = "text"; if (tab.isBinary) category = extCategory === "image" ? "image" : "binary"; return ( {category === "image" && ( )} {category === "binary" && ( )} {category === "text" && ( onFileChange(tab.path, newContent)} onSave={() => onFileSave(tab.path)} onDelete={() => onFileDelete(tab.path)} /> )} ); }