import { FC } from 'react'; import { useTranslation } from 'react-i18next'; import { makeStyles, Theme, Divider, Typography } from '@material-ui/core'; import CustomSelector from '@/components/customSelector/CustomSelector'; import { InsertImportProps } from './Types'; import Uploader from '@/components/uploader/Uploader'; import { INSERT_MAX_SIZE } from '@/consts'; import { parseByte } from '@/utils'; const getStyles = makeStyles((theme: Theme) => ({ tip: { color: theme.palette.attuGrey.dark, fontWeight: 500, marginBottom: theme.spacing(1), }, selectors: { '& .selectorWrapper': { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: theme.spacing(3), '& .selectLabel': { fontSize: '14px', lineHeight: '20px', color: theme.palette.attuDark.main, }, '& .divider': { width: '20px', margin: theme.spacing(0, 4), backgroundColor: theme.palette.attuGrey.dark, }, }, '& .selector': { flexBasis: '40%', minWidth: '256px', }, }, uploadWrapper: { marginTop: theme.spacing(3), padding: theme.spacing(1), backgroundColor: '#f9f9f9', '& .text': { color: theme.palette.attuGrey.dark, }, '& .file': { marginBottom: theme.spacing(1), }, '& .uploaderWrapper': { display: 'flex', alignItems: 'center', border: '1px solid #e9e9ed', padding: theme.spacing(1), backgroundColor: '#fff', '& .uploader': { marginRight: theme.spacing(1), }, }, '& .sampleWrapper': { '& .sample': { backgroundColor: '#fff', padding: theme.spacing(2), margin: theme.spacing(1, 0), }, }, '& .title': { marginTop: theme.spacing(1), }, '& .noteList': { marginTop: theme.spacing(1), paddingLeft: theme.spacing(3), }, '& .noteItem': { maxWidth: '560px', }, }, })); const InsertImport: FC = ({ collectionOptions, partitionOptions, selectedCollection, selectedPartition, handleCollectionChange, handlePartitionChange, handleUploadedData, handleUploadFileChange, fileName, setFileName, }) => { const { t: insertTrans } = useTranslation('insert'); const { t: collectionTrans } = useTranslation('collection'); const { t: partitionTrans } = useTranslation('partition'); const classes = getStyles(); return (
{insertTrans('targetTip')}
{ const collection = e.target.value; handleCollectionChange && handleCollectionChange(collection as string); }} /> { const partition = e.target.value; handlePartitionChange(partition as string); }} />
{insertTrans('file')}
{fileName || insertTrans('fileNamePlaceHolder')}
{insertTrans('noteTitle')}
    {insertTrans('notes').map((note: string) => (
  • {note}
  • ))}
); }; export default InsertImport;