From 26c69b340d69e5dbbe854ca9c4059a67cd9b2215 Mon Sep 17 00:00:00 2001 From: Alberto-Audrix Date: Thu, 8 Oct 2026 10:54:49 +0700 Subject: [PATCH] update collapse button, add to bottom of ai insight --- components/AiInsightCard.tsx | 30 +++++++++++++++++++++++------ components/shared/PageAiInsight.tsx | 21 +++++++++++++++++++- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/components/AiInsightCard.tsx b/components/AiInsightCard.tsx index 270fa0c..6d04c02 100644 --- a/components/AiInsightCard.tsx +++ b/components/AiInsightCard.tsx @@ -265,6 +265,7 @@ export const AiInsightCard: React.FC = ({ const [reportType, setReportType] = useState('daily'); const [dayPeriod, setDayPeriod] = useState(null); const [isCollapsed, setIsCollapsed] = useState(false); + const cardRef = useRef(null); const insightInFlightRef = useRef(false); const effectiveKandangId = kandangId ?? selectedKandangId; @@ -782,7 +783,10 @@ export const AiInsightCard: React.FC = ({ }; return ( -
+
= ({ )}
- {lastUpdated && ( -
-

Terakhir diperbarui: {formatLastUpdated()}

-
- )} +
+ + {lastUpdated && ( +

+ Terakhir diperbarui: {formatLastUpdated()} +

+ )} +
)}
diff --git a/components/shared/PageAiInsight.tsx b/components/shared/PageAiInsight.tsx index 320674e..1835e66 100644 --- a/components/shared/PageAiInsight.tsx +++ b/components/shared/PageAiInsight.tsx @@ -239,6 +239,7 @@ export const PageAiInsight: React.FC = ({ const lastCacheKeyRef = useRef(null); const desiredKeyRef = useRef(''); const requestIdRef = useRef(0); + const cardRef = useRef(null); const generateRef = useRef<(force?: boolean) => Promise>(async () => {}); const chartHighlight = React.useMemo(() => { @@ -674,7 +675,10 @@ export const PageAiInsight: React.FC = ({ }, [scopeKey]); return ( -
+
= ({
)} + +
+ +
)}