import { createSignal } from 'solid-js';
import { Button } from '@/components/ui/Button';
import { ModalPortal } from '@/components/ui/ModalPortal';
import { IconX, IconDownload, IconExternalLink, IconEye, IconFile, IconCode, IconFileText, IconAlertTriangle, IconMusic, IconFileDescription, IconChartBar, IconChartLine } from '@tabler/icons-solidjs';
import { isDemoMode } from '@/lib/demo-mode';
interface FilePreviewModalProps {
isOpen: boolean;
onClose: () => void;
file: any;
}
export const FilePreviewModal = (props: FilePreviewModalProps) => {
const [previewError, setPreviewError] = createSignal(false);
const getFileIcon = (fileType: string) => {
if (fileType.startsWith('image/')) return
Preview Failed
Unable to load preview for this file
{file.name}
{file.preview || `# Preview of ${file.name}\n\nFile content would be displayed here...\n\nIn a real implementation, this would show the actual file content.\n\nFor text files, this would display the full text content.\nFor code files, this would show syntax-highlighted code.\nFor markdown files, this would render the formatted content.`}
PDF Document
{file.name}
{file.type === 'docx' ? 'Word Document' : file.type === 'pptx' ? 'PowerPoint Presentation' : 'Excel Spreadsheet'}
{file.name}
{file.preview && ({file.preview.substring(0, 200)}...
File Preview
{file.name}
Type: {file.type}
Size: {formatFileSize(file.size)}
{file.preview.substring(0, 150)}...