From fbf1b6261fa58564d3c85e449129771f448fcdb7 Mon Sep 17 00:00:00 2001 From: Alberto-Audrix Date: Tue, 13 Oct 2026 10:47:19 +0700 Subject: [PATCH] update main dashboard ai insight view to show its loading instead of still showing old insight and data --- components/AiInsightCard.tsx | 72 ++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 11 deletions(-) diff --git a/components/AiInsightCard.tsx b/components/AiInsightCard.tsx index 2a88bbc..b63186c 100644 --- a/components/AiInsightCard.tsx +++ b/components/AiInsightCard.tsx @@ -663,6 +663,41 @@ export const AiInsightCard: React.FC = ({ ]); const renderVisualBlock = () => { + if (loading) { + if (page !== 'dashboard') return null; + return ( +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ); + } + if (!hasInsight || !scopedMetrics || page !== 'dashboard') return null; const fcrVal = scopedMetrics.fcr; @@ -830,7 +865,12 @@ export const AiInsightCard: React.FC = ({

AI Insight

- {hasInsight && ( + {loading ? ( + + + Memproses... + + ) : hasInsight ? ( = ({ : undefined } /> - )} + ) : null}

{selectedKandang?.kandang_name ?? `Kandang ${effectiveKandangId}`} @@ -909,16 +949,21 @@ export const AiInsightCard: React.FC = ({ Pilih satu kandang untuk menghasilkan AI Insight. Generate untuk semua kandang tidak diizinkan.

- ) : loading && !insightText ? ( -
+ ) : loading ? ( +
-
-

- Menganalisis data peternakan… proses ini bisa memakan waktu beberapa menit. -

+
+
+

+ Menganalisis data peternakan & menyusun insight… +

+

+ Proses kalkulasi CP 707 dan AI sedang berjalan. Mohon tunggu beberapa saat. +

+
- ) : error && !insightText ? ( + ) : error ? (

Error

{error}

@@ -1179,12 +1224,17 @@ export const AiInsightCard: React.FC = ({
- {hasInsight && ( + {loading ? ( + + + Sedang memperbarui analisis AI... + + ) : hasInsight ? ( Status AI Insight: - )} + ) : null}