import React from 'react'
import PropTypes from 'prop-types'
import { Dropdown, MenuItem } from 'react-bootstrap'
import { useTranslation, Trans } from 'react-i18next'
import Icon from '../../../shared/components/icon'
export const topFileTypes = ['bbl', 'gls', 'ind']
function PreviewDownloadButton({ isCompiling, outputFiles, pdfDownloadUrl }) {
let topFiles = []
let otherFiles = []
const { t } = useTranslation()
if (outputFiles) {
topFiles = outputFiles.filter(file => {
if (topFileTypes.includes(file.type)) {
return file
}
})
otherFiles = outputFiles.filter(file => {
if (!topFileTypes.includes(file.type)) {
if (file.type === 'pdf' && file.main === true) return
return file
}
})
}
return (
{t('download_pdf')}
{otherFiles.length > 0 && topFiles.length > 0 ? (
<>
>
) : (
<>>
)}
{otherFiles.length > 0 ? (
<>
>
) : (
<>>
)}
)
}
function FileList({ listType, list }) {
return list.map((file, index) => {
return (
)
})
}
PreviewDownloadButton.propTypes = {
isCompiling: PropTypes.bool.isRequired,
outputFiles: PropTypes.array,
pdfDownloadUrl: PropTypes.string
}
FileList.propTypes = {
list: PropTypes.array.isRequired,
listType: PropTypes.string.isRequired
}
export default PreviewDownloadButton