Update ModalHistory.tsx
This commit is contained in:
parent
2ba35743fd
commit
78f9ca1aa1
|
|
@ -91,6 +91,13 @@ function ModalHistory({
|
||||||
}
|
}
|
||||||
}, [opened]);
|
}, [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)
|
// Utility function to format timestamp (can be used later if needed)
|
||||||
// const formatTimestamp = (timestamp: number) => {
|
// const formatTimestamp = (timestamp: number) => {
|
||||||
// const date = new Date(timestamp);
|
// const date = new Date(timestamp);
|
||||||
|
|
@ -373,7 +380,13 @@ function ModalHistory({
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{/* Các items trong nhóm */}
|
{/* Các items trong nhóm */}
|
||||||
{items.map((item, itemIndex) => (
|
{items
|
||||||
|
?.filter((el, i) =>
|
||||||
|
activeTimePeriod === "current"
|
||||||
|
? i === 0
|
||||||
|
: true
|
||||||
|
)
|
||||||
|
.map((item, itemIndex) => (
|
||||||
<Box
|
<Box
|
||||||
key={`${item.stationId}-${item.number}-${item.timestamp}-${itemIndex}`}
|
key={`${item.stationId}-${item.number}-${item.timestamp}-${itemIndex}`}
|
||||||
style={{
|
style={{
|
||||||
|
|
@ -383,7 +396,9 @@ function ModalHistory({
|
||||||
? "1px solid #f1f3f5"
|
? "1px solid #f1f3f5"
|
||||||
: "none",
|
: "none",
|
||||||
backgroundColor:
|
backgroundColor:
|
||||||
itemIndex % 2 === 0 ? "white" : "#f8f9fa",
|
itemIndex % 2 === 0
|
||||||
|
? "white"
|
||||||
|
: "#f8f9fa",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue