import { Progress } from '@chakra-ui/react'; import { IoClose } from '@react-icons/all-files/io5/IoClose'; import { IoDocumentTextOutline } from '@react-icons/all-files/io5/IoDocumentTextOutline'; import { IoWarningOutline } from '@react-icons/all-files/io5/IoWarningOutline'; import { isExcelFile, isOntimeFile } from '../uploadUtils'; import style from './UploadEntry.module.scss'; interface UploadEntryProps { file: File | null; errors?: string; progress: number; handleClear: () => void; } export default function UploadEntry(props: UploadEntryProps) { const { file, errors, progress, handleClear } = props; if (errors) { return (
{errors} Please try again
); } if (file) { const fileSize = `${(file.size / 1024).toFixed(2)}kb`; let fileType = ''; if (isOntimeFile(file)) { fileType = 'Ontime Project File'; } else if (isExcelFile(file)) { fileType = 'Excel Rundown'; } return (
{file.name} {`${fileSize} - ${fileType}`}
); } return null; }