ArchiveFilesTable.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import React from 'react';
  2. import { format } from 'date-fns';
  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): JSX.Element => {
  10. const { t } = useTranslation();
  11. return (
  12. <div className="table-responsive">
  13. <table className="table table-bordered">
  14. <thead>
  15. <tr>
  16. <th>{t('admin:export_management.file')}</th>
  17. <th>{t('admin:export_management.growi_version')}</th>
  18. <th>{t('admin:export_management.collections')}</th>
  19. <th>{t('admin:export_management.exported_at')}</th>
  20. <th></th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. {props.zipFileStats.map(({ meta, fileName, innerFileStats }) => {
  25. return (
  26. <tr key={fileName}>
  27. <th>{fileName}</th>
  28. <td>{meta.version}</td>
  29. <td className="text-capitalize">{innerFileStats.map(fileStat => fileStat.collectionName).join(', ')}</td>
  30. <td>{meta.exportedAt ? format(new Date(meta.exportedAt), 'yyyy/MM/dd HH:mm:ss') : ''}</td>
  31. <td>
  32. <ArchiveFilesTableMenu
  33. fileName={fileName}
  34. onZipFileStatRemove={props.onZipFileStatRemove}
  35. />
  36. </td>
  37. </tr>
  38. );
  39. })}
  40. </tbody>
  41. </table>
  42. </div>
  43. );
  44. };
  45. export default ArchiveFilesTable;