From e88b8c90d9a2b538ee560032adc0d7d08d56fc9b Mon Sep 17 00:00:00 2001 From: lemonknowsall Date: Sun, 16 Nov 2025 17:44:17 -0800 Subject: [PATCH] prevent image loading and add image-off logo for code preview --- src/components/Shakespeare/FileEditor.tsx | 56 +++++++++++++--------- src/components/Shakespeare/PreviewPane.tsx | 8 ++++ src/lib/fileUtils.ts | 23 +++++++++ 3 files changed, 64 insertions(+), 23 deletions(-) diff --git a/src/components/Shakespeare/FileEditor.tsx b/src/components/Shakespeare/FileEditor.tsx index 3e79d416..a106bab5 100644 --- a/src/components/Shakespeare/FileEditor.tsx +++ b/src/components/Shakespeare/FileEditor.tsx @@ -3,9 +3,10 @@ import { useTranslation } from 'react-i18next'; import { Button } from '@/components/ui/button'; import { Textarea } from '@/components/ui/textarea'; import { CardContent, CardHeader, CardTitle } from '@/components/ui/card'; -import { Save, Loader2 } from 'lucide-react'; +import { Save, Loader2, ImageOff } from 'lucide-react'; import { cn } from '@/lib/utils'; import { useGitStatus } from '@/hooks/useGitStatus'; +import { isMediaFile } from '@/lib/fileUtils'; interface FileEditorProps { filePath: string; @@ -93,6 +94,7 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }: // Get git status for the current file const currentFileGitStatus = getFileGitStatus(filePath); const gitStatusClasses = getGitStatusClasses(currentFileGitStatus); + const isMedia = isMediaFile(filePath); return (
@@ -100,32 +102,36 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
{filePath}
- {hasChanges && ( + {hasChanges && !isMedia && ( {t('unsavedChanges')} )} - + {!isMedia && ( + + )}
-
- {t('languageLabel')}: {getLanguageFromPath(filePath)} -
+ {!isMedia && ( +
+ {t('languageLabel')}: {getLanguageFromPath(filePath)} +
+ )} @@ -133,6 +139,10 @@ export function FileEditor({ filePath, content, onSave, isLoading, projectId }:
+ ) : isMedia ? ( +
+ +
) : (