import { Code, ImportExport, LinkedIn, TrackChanges, UploadFile } from '@mui/icons-material'; import { Button, Divider } from '@mui/material'; import { Integration, Resume } from '@reactive-resume/schema'; import { Trans, useTranslation } from 'next-i18next'; import { useRef } from 'react'; import toast from 'react-hot-toast'; import { useMutation } from 'react-query'; import BaseModal from '@/components/shared/BaseModal'; import { RESUMES_QUERY } from '@/constants/index'; import { ServerError } from '@/services/axios'; import { importFromExternal, ImportFromExternalParams } from '@/services/integrations'; import queryClient from '@/services/react-query'; import { useAppDispatch, useAppSelector } from '@/store/hooks'; import { setModalState } from '@/store/modal/modalSlice'; const FILE_UPLOAD_MAX_SIZE = 2000000; // 2 MB const ImportExternalModal: React.FC = () => { const { t } = useTranslation(); const dispatch = useAppDispatch(); const linkedinInputRef = useRef(null); const jsonResumeInputRef = useRef(null); const reactiveResumeInputRef = useRef(null); const { open: isOpen } = useAppSelector((state) => state.modal['dashboard.import-external']); const { mutateAsync, isLoading } = useMutation(importFromExternal); const handleClose = () => { dispatch(setModalState({ modal: 'dashboard.import-external', state: { open: false } })); }; const handleClick = (integration: Integration) => { if (integration === 'linkedin') { if (linkedinInputRef.current) { linkedinInputRef.current.click(); linkedinInputRef.current.value = ''; } } else if (integration === 'json-resume') { if (jsonResumeInputRef.current) { jsonResumeInputRef.current.click(); jsonResumeInputRef.current.value = ''; } } else if (integration === 'reactive-resume') { if (reactiveResumeInputRef.current) { reactiveResumeInputRef.current.click(); reactiveResumeInputRef.current.value = ''; } } }; const handleChange = async (event: React.ChangeEvent, integration: Integration) => { if (event.target.files && event.target.files[0]) { const file = event.target.files[0]; if (file.size > FILE_UPLOAD_MAX_SIZE) { toast.error(t('common.toast.error.upload-file-size')); return; } await mutateAsync({ integration, file }); queryClient.invalidateQueries(RESUMES_QUERY); handleClose(); } }; return ( } heading={t('modals.dashboard.import-external.heading')} handleClose={handleClose} >

{t('modals.dashboard.import-external.linkedin.heading')}

You can save time by exporting your data from LinkedIn and using it to auto-fill fields on Reactive Resume. Head over to the Data Privacy section on LinkedIn and request an archive of your data. Once it is available, upload the ZIP file below.

handleChange(event, 'linkedin')} accept="application/zip" />

{t('modals.dashboard.import-external.json-resume.heading')}

If you have a validated JSON Resume ready to go, you can use it to fast-track your development on Reactive Resume. Click the button below and upload a valid JSON file to begin.

handleChange(event, 'json-resume')} accept="application/json" />

{t('modals.dashboard.import-external.reactive-resume.heading')}

{t('modals.dashboard.import-external.reactive-resume.body')}

handleChange(event, 'reactive-resume')} accept="application/json" />
); }; export default ImportExternalModal;