ArchiveFilesTable.tsx 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import React from 'react';
  2. import { format } from 'date-fns/format';
  3. import { useTranslation } from 'next-i18next';
  4. import ArchiveFilesTableMenu from './ArchiveFilesTableMenu';
  5. type ArchiveFilesTableProps = {
  6. zipFileStats: any[],
  7. onZipFileStatRemove: (fileName: string) => void,
  8. }
  9. const ArchiveFilesTable = (props: ArchiveFilesTableProps): React.ReactElement => {
  10. const { t } = useTranslation();
  11. return (
  12. <table className="table table-bordered">
  13. <thead>
  14. <tr>
  15. <th>{t('admin:export_management.file')}</th>
  16. <th>{t('admin:export_management.growi_version')}</th>
  17. <th>{t('admin:export_management.collections')}</th>
  18. <th>{t('admin:export_management.exported_at')}</th>
  19. <th></th>
  20. </tr>
  21. </thead>
  22. <tbody>
  23. {props.zipFileStats.map(({ meta, fileName, innerFileStats }) => {
  24. return (
  25. <tr key={fileName}>
  26. <th>{fileName}</th>
  27. <td>{meta.version}</td>
  28. <td className="text-capitalize">{innerFileStats.map(fileStat => fileStat.collectionName).join(', ')}</td>
  29. <td>{meta.exportedAt ? format(new Date(meta.exportedAt), 'yyyy/MM/dd HH:mm:ss') : ''}</td>
  30. <td>
  31. <ArchiveFilesTableMenu
  32. fileName={fileName}
  33. onZipFileStatRemove={props.onZipFileStatRemove}
  34. />
  35. </td>
  36. </tr>
  37. );
  38. })}
  39. </tbody>
  40. </table>
  41. );
  42. };
  43. export default ArchiveFilesTable;