29 lines
925 B
TypeScript
29 lines
925 B
TypeScript
/**
|
|||
|
|
* Shown while a text is being written again after a failed attempt: it is
|
||
|
|
* retried on its own, nothing to do. Admins also see the error.
|
||
|
|
*/
|
||
|
|
export function RetryNotice({
|
||
|
|
status,
|
||
|
|
error,
|
||
|
|
nextAttemptAt,
|
||
|
|
isAdmin = false,
|
||
|
|
}: {
|
||
|
|
status: string;
|
||
|
|
error?: string | null;
|
||
|
|
nextAttemptAt?: string;
|
||
|
|
isAdmin?: boolean;
|
||
|
|
}) {
|
||
|
|
if (!error || (status !== "pending" && status !== "running")) return null;
|
||
|
|
const wait = nextAttemptAt ? Math.round((Date.parse(nextAttemptAt) - Date.now()) / 60_000) : 0;
|
||
|
|
return (
|
||
|
|
<div className="msg retry-notice" role="status">
|
||
|
|
<p>
|
||
|
|
Az előző próbálkozás nem sikerült, ezért automatikusan újrapróbáljuk. Nem kell újra kérned, és nem kerül
|
||
|
|
többe.
|
||
|
|
{status === "pending" && wait >= 1 ? ` A következő próbálkozás kb. ${wait} perc múlva indul.` : ""}
|
||
|
|
</p>
|
||
|
|
{isAdmin && <p className="hint">Hiba: {error}</p>}
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|