2025-06-11 00:14:17 +02:00
|
|
|
import { LocalFileNode } from '@colanode/client/types';
|
2025-11-18 11:07:58 -08:00
|
|
|
import { FileNoPreview } from '@colanode/ui/components/files/file-no-preview';
|
|
|
|
|
import { FilePreview } from '@colanode/ui/components/files/file-preview';
|
|
|
|
|
import { FileSaveButton } from '@colanode/ui/components/files/file-save-button';
|
|
|
|
|
import { FileSidebar } from '@colanode/ui/components/files/file-sidebar';
|
|
|
|
|
import { canPreviewFile } from '@colanode/ui/lib/files';
|
2024-10-23 18:33:49 +02:00
|
|
|
|
|
|
|
|
interface FileContainerProps {
|
2025-11-18 11:07:58 -08:00
|
|
|
file: LocalFileNode;
|
2024-10-23 18:33:49 +02:00
|
|
|
}
|
|
|
|
|
|
2025-11-18 11:07:58 -08:00
|
|
|
export const FileContainer = ({ file }: FileContainerProps) => {
|
|
|
|
|
const canPreview = canPreviewFile(file.attributes.subtype);
|
2024-12-22 17:47:39 +01:00
|
|
|
|
2025-11-18 11:07:58 -08:00
|
|
|
return (
|
|
|
|
|
<div className="flex h-full max-h-full w-full flex-row items-center gap-2">
|
|
|
|
|
<div className="flex flex-col w-full max-w-full h-full grow overflow-hidden">
|
|
|
|
|
<div className="flex flex-row w-full items-center justify-end p-4 gap-4">
|
|
|
|
|
<FileSaveButton file={file} />
|
|
|
|
|
</div>
|
2024-12-30 21:50:08 +01:00
|
|
|
|
2025-11-18 11:07:58 -08:00
|
|
|
<div className="flex flex-col grow items-center justify-center overflow-hidden p-10">
|
|
|
|
|
{canPreview ? (
|
|
|
|
|
<FilePreview file={file} />
|
|
|
|
|
) : (
|
|
|
|
|
<FileNoPreview mimeType={file.attributes.mimeType} />
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="h-full w-72 min-w-72 overflow-hidden border-l border-border p-2 pl-3">
|
|
|
|
|
<FileSidebar file={file} />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-10-23 18:33:49 +02:00
|
|
|
};
|