import { useRef, useState } from 'react'; import { Button } from '@/components/ui/button'; import { normalizeAppError } from '@/lib/error-model'; import { codingRecovery, type CodingRecoveryAction } from '../../../shared/coding-recovery'; export function CodingRecoveryCard({ code, work, onRecovery }: { code?: string; work: boolean; onRecovery(action: CodingRecoveryAction, work: boolean): Promise | void; }) { const [busy, setBusy] = useState(false); const [retryCode, setRetryCode] = useState(); const [retryFailed, setRetryFailed] = useState(false); const flight = useRef(false); const recovery = codingRecovery(retryCode ?? code, work); return

{work ? '作品还没有打开' : '这一步需要再接着做'}

{retryFailed ? '暂时还没连接上。可以稍后再试,已输入的内容会保留。' : recovery.message}

; }