diff --git a/apps/mobile/src/app/scan-review/[jobId].tsx b/apps/mobile/src/app/scan-review/[jobId].tsx index 582dbac..9894134 100644 --- a/apps/mobile/src/app/scan-review/[jobId].tsx +++ b/apps/mobile/src/app/scan-review/[jobId].tsx @@ -167,7 +167,7 @@ export default function ScanReviewScreen() { if (query.isLoading || job?.status === "queued" || job?.status === "running") { return ( - + {t("scan.analyzing")} ); diff --git a/apps/mobile/src/components/ui.tsx b/apps/mobile/src/components/ui.tsx index 03a8d79..37b63bc 100644 --- a/apps/mobile/src/components/ui.tsx +++ b/apps/mobile/src/components/ui.tsx @@ -1,4 +1,5 @@ import type { PropsWithChildren, ReactNode } from "react"; +import { useEffect, useState } from "react"; import { ActivityIndicator, KeyboardAvoidingView, @@ -204,11 +205,20 @@ export function ProgressBar({ ); } -export function LoadingView() { +export function LoadingView({ messages }: { messages?: string[] } = {}) { + const [i, setI] = useState(0); + const list = messages ?? []; + useEffect(() => { + setI(0); + if (list.length <= 1) return; + const id = setInterval(() => setI((v) => (v + 1 < list.length ? v + 1 : v)), 1800); + return () => clearInterval(id); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [list.length]); return ( - {t("common.loading")} + {list.length ? list[i] : t("common.loading")} ); }