pdf-download-files-button.tsx 942 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import {
  2. Dropdown,
  3. DropdownMenu,
  4. DropdownToggle,
  5. } from '@/shared/components/dropdown/dropdown-menu'
  6. import PdfFileList from './pdf-file-list'
  7. import { memo } from 'react'
  8. import { useTranslation } from 'react-i18next'
  9. import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
  10. function PdfDownloadFilesButton() {
  11. const { compiling, fileList } = useCompileContext()
  12. const { t } = useTranslation()
  13. if (!fileList) {
  14. return null
  15. }
  16. return (
  17. <Dropdown drop="up">
  18. <DropdownToggle
  19. id="dropdown-files-logs-pane"
  20. variant="secondary"
  21. size="sm"
  22. disabled={compiling || !fileList}
  23. >
  24. {t('other_logs_and_files')}
  25. </DropdownToggle>
  26. <DropdownMenu id="dropdown-files-logs-pane-list">
  27. <PdfFileList fileList={fileList} />
  28. </DropdownMenu>
  29. </Dropdown>
  30. )
  31. }
  32. export default memo(PdfDownloadFilesButton)