Fix drag and drop and code viewer color palete
All checks were successful
Automated Container Build / build-and-push (push) Successful in 42s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 42s
This commit is contained in:
parent
3d63461976
commit
099e066223
2 changed files with 7 additions and 6 deletions
|
|
@ -881,9 +881,9 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
}
|
||||
|
||||
function handleDragOver(e: React.DragEvent) {
|
||||
if (draggedFile || activeSection === 'trash') return;
|
||||
if (!e.dataTransfer.types.includes('Files')) return;
|
||||
e.preventDefault();
|
||||
if (draggedFile || activeSection === 'trash') return;
|
||||
if (!Array.from(e.dataTransfer.types).includes('Files')) return;
|
||||
setDragOver(true);
|
||||
}
|
||||
|
||||
|
|
@ -2639,7 +2639,7 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
|||
</AnimatePresence>
|
||||
|
||||
<TaskManager />
|
||||
<FilePreview file={previewFile} onClose={() => setPreviewFile(null)} downloadToken={downloadToken} />
|
||||
<FilePreview file={previewFile} onClose={() => setPreviewFile(null)} downloadToken={downloadToken} theme={theme} />
|
||||
<AnimatePresence>
|
||||
{sharingFile && (
|
||||
<ShareModal filePath={sharingFile} onClose={() => setSharingFile(null)} />
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { X, Download, File, Image as ImageIcon, Film, Music, FileText, Code, Loa
|
|||
import api from '@/lib/api';
|
||||
import dynamic from 'next/dynamic';
|
||||
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
||||
import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
||||
import { vscDarkPlus, vs } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
||||
import { formatSize, getFileDisplayName } from '@/lib/utils';
|
||||
|
||||
const DynamicPdfViewer = dynamic(() => import('./PdfViewer'), { ssr: false });
|
||||
|
|
@ -22,11 +22,12 @@ interface FilePreviewProps {
|
|||
} | null;
|
||||
onClose: () => void;
|
||||
downloadToken?: string;
|
||||
theme?: string;
|
||||
}
|
||||
|
||||
// getFileDisplayName imported from utils
|
||||
|
||||
export default function FilePreview({ file, onClose, downloadToken }: FilePreviewProps) {
|
||||
export default function FilePreview({ file, onClose, downloadToken, theme = 'dark' }: FilePreviewProps) {
|
||||
const [content, setContent] = useState<string | null>(null);
|
||||
const [archiveItems, setArchiveItems] = useState<{name: string, size: number, path: string}[] | null>(null);
|
||||
const [archivePath, setArchivePath] = useState<string>('');
|
||||
|
|
@ -333,7 +334,7 @@ export default function FilePreview({ file, onClose, downloadToken }: FilePrevie
|
|||
<div className="w-full h-full overflow-auto rounded-lg" style={{ backgroundColor: 'var(--color-bg-secondary)', border: '1px solid var(--color-border-subtle)' }}>
|
||||
<SyntaxHighlighter
|
||||
language={file.name.split('.').pop()?.toLowerCase() || 'text'}
|
||||
style={vscDarkPlus}
|
||||
style={theme === 'light' ? vs : vscDarkPlus}
|
||||
customStyle={{ margin: 0, background: 'transparent', height: '100%', fontSize: '14px' }}
|
||||
showLineNumbers={true}
|
||||
>
|
||||
|
|
|
|||
Reference in a new issue