allow to see time left for playing episode

This commit is contained in:
2026-03-12 14:10:39 +03:00
parent 8e226e9ea1
commit 618c034b05

View File

@@ -12,6 +12,7 @@ export const Player = () => {
const [currentTime, setCurrentTime] = useState(0);
const [duration, setDuration] = useState(0);
const [showTimeLeft, setShowTimeLeft] = useState(false);
useEffect(() => {
if (!episode) return;
@@ -62,6 +63,7 @@ export const Player = () => {
}, []);
const progress = currentTime / duration;
const timeLeft = duration - currentTime;
if (status === "stopped") {
return null;
@@ -117,11 +119,13 @@ export const Player = () => {
className="bg-red-500 h-full"
></div>
</div>
<p
className={`${Math.floor(duration / 3600) > 0 ? "min-w-[70px]" : "min-w-[50px]"} text-right`}
<button
className="min-w-[70px] text-right cursor-pointer"
onClick={() => setShowTimeLeft((prev) => !prev)}
>
{formatTime(currentTime)}
</p>
{showTimeLeft ? "-" : ""}
{formatTime(showTimeLeft ? timeLeft : currentTime)}
</button>
</div>
<h3 className="text-base font-semibold mt-2">{episode?.title}</h3>