diff --git a/src/App.tsx b/src/App.tsx index aa457c6..3c55b81 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -5,7 +5,7 @@ import PageNavigator from './components/PageNavigator'; export default function App() { const location = useLocation(); - const isLoadingPage = location.pathname === '/report/loading'; + const isLoadingPage = location.pathname.startsWith('/report/loading'); return (
{message}
-{subtext}
+{message || config.defaultMessage}
+{subtext || config.defaultSubtext}
+ + {onRetry && (currentStatus === 'error' || currentStatus === 'timeout') && ( + + )} ); } diff --git a/src/hooks/useEnrichment.ts b/src/hooks/useEnrichment.ts index 7588dee..a6bf05d 100644 --- a/src/hooks/useEnrichment.ts +++ b/src/hooks/useEnrichment.ts @@ -8,6 +8,10 @@ type EnrichmentStatus = 'idle' | 'loading' | 'success' | 'error'; interface UseEnrichmentResult { status: EnrichmentStatus; enrichedReport: MarketingReport | null; + /** Number of retry attempts made */ + retryCount: number; + /** Call this to retry enrichment (max 2 retries) */ + retry: () => void; } interface EnrichmentParams { @@ -20,10 +24,12 @@ interface EnrichmentParams { address?: string; } +const MAX_RETRIES = 2; + /** * Triggers background channel enrichment after Phase 1 report renders. * Fires once, waits for the Edge Function to complete (~27s), - * then returns the merged report. + * then returns the merged report. Supports up to 2 manual retries. */ export function useEnrichment( baseReport: MarketingReport | null, @@ -31,40 +37,55 @@ export function useEnrichment( ): UseEnrichmentResult { const [status, setStatus] = useState{error}
- + + {errorDetails && ( +Failed channels:
+ {Object.entries(errorDetails).map(([ch, err]) => ( ++ • {ch}: {err} +
+ ))} +Resuming analysis...
+ + ) : ( + <> +- AI가 마케팅 데이터를 분석하고 있습니다. 약 1~2분 소요됩니다. -
+ return ( ++ AI가 마케팅 데이터를 분석하고 있습니다. 약 1~2분 소요됩니다. +
+ > + )} > )}