import { memo, useState, useEffect } from 'react' import type { components } from '@/api/opencode-types' import { RefreshCw, AlertTriangle } from 'lucide-react' type RetryPartType = components['schemas']['RetryPart'] interface RetryPartProps { part: RetryPartType } export const RetryPart = memo(function RetryPart({ part }: RetryPartProps) { const [countdown, setCountdown] = useState(5) useEffect(() => { if (countdown <= 0) return const timer = setInterval(() => { setCountdown(prev => Math.max(0, prev - 1)) }, 1000) return () => clearInterval(timer) }, [countdown]) const errorMessage = part.error?.data?.message || 'An error occurred' return (
Retry attempt {part.attempt} {countdown > 0 && ( (retrying in {countdown}s) )}

{errorMessage}

) })