Merge branch 'feature/CF2-87-Archive-page-redesign' into dev

This commit is contained in:
goodmice 2021-10-29 17:50:08 +05:00
commit 2065789404

View File

@ -1,25 +1,29 @@
import { Progress, Button } from "antd"
import { downloadFile } from "../../components/factory"
import { Progress, Button } from 'antd'
import { downloadFile } from '../../components/factory'
export const ReportCreationNotify = ({progressData}) => {
progressData = progressData ?? {progress: 0.0, operation: 'Создание отчета'}
let downloadButton = null
if (progressData.file)
downloadButton = <Button
type="link"
onClick={_ => {downloadFile(progressData.file)}}
download={progressData.file.name}>
export const ReportCreationNotify = ({ progressData }) => (
<>
<Progress percent={ Number(progressData.progress?.toFixed(2)) } />
<br/>
<span>{progressData.operation} стр {progressData.currentPage} из {progressData.totalPages}</span>
{progressData.file && (
<Button
type={'link'}
onClick={() => {downloadFile(progressData.file)}}
download={progressData.file.name}
>
{progressData.file.name}
</Button>
const progressText = `${progressData.operation} стр ${progressData.currentPage} из ${progressData.totalPages}`
return (
<>
<Progress percent={ progressData.progress } />
<br/>
<span>{progressText}</span>
{downloadButton}
)}
</>
)
ReportCreationNotify.defaultProps = {
progressData: {
progress: 0.0,
operation: 'Создание отчета',
currentPage: 0,
totalPages: 0,
file: null
}
}