Improve lazy loading (#12186)
WIP, using preview app to test performance (which was very bad)
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
import { ActivityRow } from '@/activities/components/ActivityRow';
|
||||
import { AttachmentDropdown } from '@/activities/files/components/AttachmentDropdown';
|
||||
import { AttachmentIcon } from '@/activities/files/components/AttachmentIcon';
|
||||
import { PREVIEWABLE_EXTENSIONS } from '@/activities/files/components/DocumentViewer';
|
||||
import { Attachment } from '@/activities/files/types/Attachment';
|
||||
import { downloadFile } from '@/activities/files/utils/downloadFile';
|
||||
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
|
||||
@ -17,10 +16,11 @@ import styled from '@emotion/styled';
|
||||
import { useState } from 'react';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
||||
import { getFileNameAndExtension } from '~/utils/file/getFileNameAndExtension';
|
||||
import { PREVIEWABLE_EXTENSIONS } from '@/activities/files/const/previewable-extensions.const';
|
||||
import { IconCalendar, OverflowingTextWithTooltip } from 'twenty-ui/display';
|
||||
import { isModifiedEvent } from 'twenty-ui/utilities';
|
||||
import { formatToHumanReadableDate } from '~/utils/date-utils';
|
||||
import { getFileNameAndExtension } from '~/utils/file/getFileNameAndExtension';
|
||||
|
||||
const StyledLeftContent = styled.div`
|
||||
align-items: center;
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import { PREVIEWABLE_EXTENSIONS } from '@/activities/files/const/previewable-extensions.const';
|
||||
import { fetchCsvPreview } from '@/activities/files/utils/fetchCsvPreview';
|
||||
import DocViewer, { DocViewerRenderers } from '@cyntler/react-doc-viewer';
|
||||
import '@cyntler/react-doc-viewer/dist/index.css';
|
||||
@ -41,29 +42,6 @@ type DocumentViewerProps = {
|
||||
documentUrl: string;
|
||||
};
|
||||
|
||||
export const PREVIEWABLE_EXTENSIONS = [
|
||||
'bmp',
|
||||
'csv',
|
||||
'odt',
|
||||
'doc',
|
||||
'docx',
|
||||
'gif',
|
||||
'htm',
|
||||
'html',
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'pdf',
|
||||
'png',
|
||||
'ppt',
|
||||
'pptx',
|
||||
'tiff',
|
||||
'txt',
|
||||
'xls',
|
||||
'xlsx',
|
||||
'mp4',
|
||||
'webp',
|
||||
];
|
||||
|
||||
const MIME_TYPE_MAPPING: Record<
|
||||
(typeof PREVIEWABLE_EXTENSIONS)[number],
|
||||
string
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
export const PREVIEWABLE_EXTENSIONS = [
|
||||
'bmp',
|
||||
'csv',
|
||||
'odt',
|
||||
'doc',
|
||||
'docx',
|
||||
'gif',
|
||||
'htm',
|
||||
'html',
|
||||
'jpg',
|
||||
'jpeg',
|
||||
'pdf',
|
||||
'png',
|
||||
'ppt',
|
||||
'pptx',
|
||||
'tiff',
|
||||
'txt',
|
||||
'xls',
|
||||
'xlsx',
|
||||
'mp4',
|
||||
'webp',
|
||||
];
|
||||
Reference in New Issue
Block a user