import React from 'react'; import { Text, Center } from '@mantine/core'; import Editor from './Editor'; import MarkdownPreview from './MarkdownPreview'; import { getFileUrl, isImageFile } from '../../utils/fileHelpers'; import { useWorkspace } from '@/contexts/WorkspaceContext'; type ViewTab = 'source' | 'preview'; interface ContentViewProps { activeTab: ViewTab; selectedFile: string | null; content: string; handleContentChange: (content: string) => void; handleSave: (filePath: string, content: string) => Promise; handleFileSelect: (filePath: string | null) => Promise; } const ContentView: React.FC = ({ activeTab, selectedFile, content, handleContentChange, handleSave, handleFileSelect, }) => { const { currentWorkspace } = useWorkspace(); if (!currentWorkspace) { return (
No workspace selected.
); } if (!selectedFile) { return (
No file selected.
); } if (isImageFile(selectedFile)) { return (
{selectedFile}
); } return activeTab === 'source' ? ( ) : ( ); }; export default ContentView;