diff --git a/FRONTEND/src/components/ModalHistory.tsx b/FRONTEND/src/components/ModalHistory.tsx
index a4d3481..e2eb39a 100644
--- a/FRONTEND/src/components/ModalHistory.tsx
+++ b/FRONTEND/src/components/ModalHistory.tsx
@@ -91,6 +91,13 @@ function ModalHistory({
}
}, [opened]);
+ // Change station or filter will reset scroll
+ useEffect(() => {
+ if (scrollViewportRef?.current) {
+ scrollViewportRef.current.scrollTop = 0;
+ }
+ }, [activeStation, activeTimePeriod]);
+
// Utility function to format timestamp (can be used later if needed)
// const formatTimestamp = (timestamp: number) => {
// const date = new Date(timestamp);
@@ -373,46 +380,54 @@ function ModalHistory({
{/* Các items trong nhóm */}
- {items.map((item, itemIndex) => (
- 0
- ? "1px solid #f1f3f5"
- : "none",
- backgroundColor:
- itemIndex % 2 === 0 ? "white" : "#f8f9fa",
- }}
- >
-
+ activeTimePeriod === "current"
+ ? i === 0
+ : true
+ )
+ .map((item, itemIndex) => (
+ 0
+ ? "1px solid #f1f3f5"
+ : "none",
+ backgroundColor:
+ itemIndex % 2 === 0
+ ? "white"
+ : "#f8f9fa",
+ }}
>
- {item.pid} {item.vid} SN: {item.sn}
-
- | {item.scenario}
-
-
- {new Date(
- item.timestamp
- ).toLocaleString()}
-
-
-
- ))}
+ {item.pid} {item.vid} SN: {item.sn}
+
+ | {item.scenario}
+
+
+ {new Date(
+ item.timestamp
+ ).toLocaleString()}
+
+
+
+ ))}
))}