import { __ } from '@wordpress/i18n'; import type { JSX } from 'react'; import type { Fix } from '../../shared/api/types/fixes'; import { classNames } from '../../shared/lib/classNames'; import { timeAgoSentence } from '../../shared/lib/timeAgo'; import { Button } from '../../shared/ui/Button'; import { Icon } from '../../shared/ui/Icon'; import { FixStatePill } from './FixStatePill'; import { fixDetail, fixIcon, fixTitle } from './historyTexts'; import { useHistoryEntryActions } from './useHistoryEntryActions'; type HistoryEntryProps = { fix: Fix; now: number; }; export function HistoryEntry( { fix, now }: HistoryEntryProps ): JSX.Element { const { work, runUndo, runContinue } = useHistoryEntryActions( fix ); const isUndone = fix.state === 'undone'; const isBusy = work !== null; return (
{ fixTitle( fix ) } { timeAgoSentence( fix.created_at, now ) }.{ ' ' } { fixDetail( fix ) }
{ fix.state === 'running' && ( ) }
); }