|
| 1 | +import React from 'react'; |
| 2 | +import { ServerBackup } from '@/api/server/backups/getServerBackups'; |
| 3 | +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; |
| 4 | +import { faArchive } from '@fortawesome/free-solid-svg-icons/faArchive'; |
| 5 | +import format from 'date-fns/format'; |
| 6 | +import distanceInWordsToNow from 'date-fns/distance_in_words_to_now' |
| 7 | +import Spinner from '@/components/elements/Spinner'; |
| 8 | +import { faCloudDownloadAlt } from '@fortawesome/free-solid-svg-icons/faCloudDownloadAlt'; |
| 9 | + |
| 10 | +interface Props { |
| 11 | + backup: ServerBackup; |
| 12 | + className?: string; |
| 13 | +} |
| 14 | + |
| 15 | +export default ({ backup, className }: Props) => { |
| 16 | + return ( |
| 17 | + <div className={`grey-row-box flex items-center ${className}`}> |
| 18 | + <div className={'mr-4'}> |
| 19 | + <FontAwesomeIcon icon={faArchive} className={'text-neutral-300'}/> |
| 20 | + </div> |
| 21 | + <div className={'flex-1'}> |
| 22 | + <p className={'text-sm mb-1'}>{backup.name}</p> |
| 23 | + <p className={'text-xs text-neutral-400 font-mono'}>{backup.uuid}</p> |
| 24 | + </div> |
| 25 | + <div className={'ml-4 text-center'}> |
| 26 | + <p |
| 27 | + title={format(backup.createdAt, 'ddd, MMMM Do, YYYY HH:mm:ss Z')} |
| 28 | + className={'text-sm'} |
| 29 | + > |
| 30 | + {distanceInWordsToNow(backup.createdAt, { includeSeconds: true, addSuffix: true })} |
| 31 | + </p> |
| 32 | + <p className={'text-2xs text-neutral-500 uppercase mt-1'}>Created</p> |
| 33 | + </div> |
| 34 | + <div className={'ml-6'} style={{ marginRight: '-0.5rem' }}> |
| 35 | + {!backup.completedAt ? |
| 36 | + <div title={'Backup is in progress'} className={'p-2'}> |
| 37 | + <Spinner size={'tiny'}/> |
| 38 | + </div> |
| 39 | + : |
| 40 | + <a href={'#'} className={'text-sm text-neutral-300 p-2 transition-colors duration-250 hover:text-cyan-400'}> |
| 41 | + <FontAwesomeIcon icon={faCloudDownloadAlt}/> |
| 42 | + </a> |
| 43 | + } |
| 44 | + </div> |
| 45 | + </div> |
| 46 | + ); |
| 47 | +}; |
0 commit comments