mirror of
https://github.com/sussy-code/smov.git
synced 2025-01-02 16:37:39 +01:00
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
import React from 'react'
|
|
import { Arrow } from './Arrow'
|
|
import './MovieRow.css'
|
|
import { PercentageOverlay } from './PercentageOverlay'
|
|
|
|
// title: string
|
|
// onClick: () => void
|
|
export function MovieRow(props) {
|
|
|
|
const progressData = JSON.parse(localStorage.getItem("video-progress") || "{}")
|
|
let progress;
|
|
let percentage = null;
|
|
if(props.type === "movie") {
|
|
progress = progressData?.lookmovie?.movie?.[props.slug]?.full
|
|
if(progress) {
|
|
percentage = Math.floor((progress.currentlyAt / progress.totalDuration) * 100)
|
|
}
|
|
}
|
|
|
|
return (
|
|
<div className="movieRow" onClick={() => props.onClick && props.onClick()}>
|
|
<div className="left">
|
|
{props.title}
|
|
<span className="year">({props.year})</span>
|
|
</div>
|
|
<div className="watch">
|
|
<p>Watch {props.type}</p>
|
|
<Arrow/>
|
|
</div>
|
|
<PercentageOverlay percentage={percentage} />
|
|
</div>
|
|
)
|
|
}
|