| 1 | import { useT } from "../lib/i18n"; |
| 2 | import type { useSessionComposerPersistence } from "../lib/sessionComposerPersistence"; |
| 3 | |
| 4 | type InputState = ReturnType<typeof useSessionComposerPersistence>; |
| 5 | |
| 6 | export function SessionInputRecovery({ input }: { input: InputState }) { |
| 7 | const t = useT(); |
| 8 | if (!input.error && !input.attention && !input.recovering) return null; |
| 9 | return <div role="alert" className="session-draft-surface__error"> |
| 10 | <span>{t(input.recovering ? "composer.inputRecovering" : input.attention ? "composer.inputUnconfirmed" : "composer.inputRetry")}</span> |
| 11 | {!input.recovering && <button type="button" onClick={() => void input.retry().catch(() => {})}>{t("common.retry")}</button>} |
| 12 | </div>; |
| 13 | } |
| 14 |