Fix early return for PDF thumbnail in FileExplorer
All checks were successful
Automated Container Build / build-and-push (push) Successful in 28s
All checks were successful
Automated Container Build / build-and-push (push) Successful in 28s
This commit is contained in:
parent
093a6ac4ef
commit
9ccf29897f
1 changed files with 9 additions and 15 deletions
|
|
@ -1163,15 +1163,15 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
const isAudio = ['mp3', 'flac', 'wav', 'm4a', 'wma', 'aac'].includes(ext) || file.mime_type?.startsWith('audio/');
|
const isAudio = ['mp3', 'flac', 'wav', 'm4a', 'wma', 'aac'].includes(ext) || file.mime_type?.startsWith('audio/');
|
||||||
const isMedia = isImage || isVideo || isOffice || isAudio || ext === 'pdf';
|
const isMedia = isImage || isVideo || isOffice || isAudio || ext === 'pdf';
|
||||||
|
|
||||||
if (ext === 'pdf') {
|
|
||||||
return (
|
|
||||||
<div className={`${large ? 'w-20 h-20 rounded-2xl text-2xl' : 'w-5 h-5 rounded text-[6px] flex-shrink-0 aspect-square'} flex items-center justify-center font-black tracking-tighter shadow-sm text-white bg-[#ea4335]`}>
|
|
||||||
PDF
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const fallbackIcon = (() => {
|
const fallbackIcon = (() => {
|
||||||
|
if (ext === 'pdf') {
|
||||||
|
return (
|
||||||
|
<div className={`${large ? 'w-20 h-20 rounded-2xl text-2xl' : 'w-5 h-5 rounded text-[6px] flex-shrink-0 aspect-square'} flex items-center justify-center font-black tracking-tighter shadow-sm text-white bg-[#ea4335]`}>
|
||||||
|
PDF
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (ext === 'docx' || ext === 'doc') {
|
if (ext === 'docx' || ext === 'doc') {
|
||||||
return (
|
return (
|
||||||
<div className={`${large ? 'w-20 h-20 rounded-2xl text-2xl' : 'w-5 h-5 rounded text-[6px] flex-shrink-0 aspect-square'} flex items-center justify-center font-black tracking-tighter shadow-sm text-white bg-[#2B579A]`}>
|
<div className={`${large ? 'w-20 h-20 rounded-2xl text-2xl' : 'w-5 h-5 rounded text-[6px] flex-shrink-0 aspect-square'} flex items-center justify-center font-black tracking-tighter shadow-sm text-white bg-[#2B579A]`}>
|
||||||
|
|
@ -1241,16 +1241,10 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
|
||||||
|
|
||||||
if (isMedia && file.checksum && viewMode === 'grid') {
|
if (isMedia && file.checksum && viewMode === 'grid') {
|
||||||
const docType = file.name.endsWith('.docx') ? 'docs' : file.name.endsWith('.pptx') ? 'slides' : (file.name.endsWith('.xlsx') || file.name.endsWith('.xls')) ? 'sheets' : ext === 'pdf' ? 'pdf' : null;
|
const docType = file.name.endsWith('.docx') ? 'docs' : file.name.endsWith('.pptx') ? 'slides' : (file.name.endsWith('.xlsx') || file.name.endsWith('.xls')) ? 'sheets' : ext === 'pdf' ? 'pdf' : null;
|
||||||
// Use fallbackIcon for PDF too so it shows "PDF" text while loading
|
|
||||||
const currentFallback = ext === 'pdf' ? (
|
|
||||||
<div className={`${large ? 'w-20 h-20 rounded-2xl text-2xl' : 'w-5 h-5 rounded text-[6px] flex-shrink-0 aspect-square'} flex items-center justify-center font-black tracking-tighter shadow-sm text-white bg-[#ea4335]`}>
|
|
||||||
PDF
|
|
||||||
</div>
|
|
||||||
) : fallbackIcon;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative w-full h-full flex items-center justify-center overflow-hidden rounded-md">
|
<div className="relative w-full h-full flex items-center justify-center overflow-hidden rounded-md">
|
||||||
<ThumbnailImage checksum={file.checksum} fallbackIcon={currentFallback} downloadToken={downloadToken || ''} docType={docType} />
|
<ThumbnailImage checksum={file.checksum} fallbackIcon={fallbackIcon} downloadToken={downloadToken || ''} docType={docType} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue