mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-20 11:41:38 +10:00
adding stylelint to repo
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
.modal {
|
||||
width: min(600px, calc(100vw - 100px));
|
||||
|
||||
@apply p-8 rounded bg-primary-50 outline-none;
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import { clone } from 'lodash';
|
||||
import React, { memo, useContext, useEffect, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FaPrint } from 'react-icons/fa';
|
||||
import { toast } from 'react-toastify';
|
||||
import Button from '../../components/shared/Button';
|
||||
import ModalContext from '../../contexts/ModalContext';
|
||||
import { useSelector } from '../../contexts/ResumeContext';
|
||||
@ -31,22 +32,22 @@ const ExportModal = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleSinglePageDownload = async () => {
|
||||
setLoadingSingle(true);
|
||||
const printResume = firebase.functions().httpsCallable('printResume');
|
||||
const { data } = await printResume({ id: state.id, type: 'single' });
|
||||
const blob = b64toBlob(data, 'application/pdf');
|
||||
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
|
||||
setLoadingSingle(false);
|
||||
};
|
||||
const handleDownload = async (isSinglePDF) => {
|
||||
isSinglePDF ? setLoadingSingle(true) : setLoadingMulti(true);
|
||||
|
||||
const handleMultiPageDownload = async () => {
|
||||
setLoadingMulti(true);
|
||||
const printResume = firebase.functions().httpsCallable('printResume');
|
||||
const { data } = await printResume({ id: state.id, type: 'multi' });
|
||||
const blob = b64toBlob(data, 'application/pdf');
|
||||
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
|
||||
setLoadingMulti(false);
|
||||
try {
|
||||
const printResume = firebase.functions().httpsCallable('printResume');
|
||||
const { data } = await printResume({
|
||||
id: state.id,
|
||||
type: isSinglePDF ? 'single' : 'multi',
|
||||
});
|
||||
const blob = b64toBlob(data, 'application/pdf');
|
||||
download(blob, `RxResume-${state.id}.pdf`, 'application/pdf');
|
||||
} catch (error) {
|
||||
toast(t('builder.toasts.printError'));
|
||||
} finally {
|
||||
isSinglePDF ? setLoadingSingle(false) : setLoadingMulti(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleExportToJson = () => {
|
||||
@ -93,14 +94,14 @@ const ExportModal = () => {
|
||||
<div className="flex">
|
||||
<Button
|
||||
isLoading={isLoadingSingle}
|
||||
onClick={handleSinglePageDownload}
|
||||
onClick={() => handleDownload(true)}
|
||||
>
|
||||
{t('modals.export.downloadPDF.buttons.single')}
|
||||
</Button>
|
||||
<Button
|
||||
className="ml-8"
|
||||
isLoading={isLoadingMulti}
|
||||
onClick={handleMultiPageDownload}
|
||||
onClick={() => handleDownload(false)}
|
||||
>
|
||||
{t('modals.export.downloadPDF.buttons.multi')}
|
||||
</Button>
|
||||
|
||||
Reference in New Issue
Block a user