fix: endsAt not updating correctly

This commit is contained in:
--remove-section committed 2025-12-20 13:19:01 +05:30
1 parent 27d8e04b0f
commit 81e0c3b9a8
2 files changed
+29 -6

No files matched your search

@@ -0,0 +1,26 @@
import { Typography } from "@mui/material";
import React from "react";
import { useShallow } from "zustand/shallow";
import { endsAt } from "@/utils/date/time";
import { usePlaybackStore } from "@/utils/store/playback";
const EndsAtDisplay = () => {
const { currentTime, itemDuration } = usePlaybackStore(
useShallow((state) => ({
currentTime: state.playerState.currentTime,
itemDuration: state.metadata.itemDuration,
})),
);
if (!itemDuration) return null;
const remaining = itemDuration - (currentTime ?? 0);
return (
<Typography variant="subtitle1">
{endsAt(remaining)}
</Typography>
);
};
export default EndsAtDisplay;