fix endsAt #26

This commit is contained in:
prayag17 committed 2023-04-17 14:52:12 +05:30
1 parent 464a3ff5a2
commit ac565b65fe
6 files changed
+109 -19

No files matched your search

+1
View File
@@ -7,6 +7,7 @@
position: relative;
border-radius: $border-radius-default;
overflow: hidden;
box-shadow: 0 0 7px rgb(0 0 0 / 0.2);
}
&-overlay {
position: absolute;
+3 -3
View File
@@ -128,9 +128,9 @@ export const EpisodeCard = ({
opacity: isWatched ? 1 : 0,
}}
/>
<div
<Box
className="card-media-image-container"
style={{ opacity: imgLoading ? 0 : 1 }}
sx={{ opacity: imgLoading ? 0 : 1 }}
>
{imageTags && (
<CardMedia
@@ -153,7 +153,7 @@ export const EpisodeCard = ({
className="card-image"
></CardMedia>
)}
</div>
</Box>
{!!blurhash && (
<Blurhash
hash={blurhash}
-7
View File
@@ -1,7 +0,0 @@
/** @format */
import React from "react";
import { NavLink as NavLinkBase } from "react-router-dom";
export const NavLink = React.forwardRef((props, ref) => (
<NavLinkBase ref={ref} {...props} className={props.activeClassName} />
));
+85
View File
@@ -0,0 +1,85 @@
/** @format */
import Card from "@mui/material/Card";
import CardMedia from "@mui/material/CardMedia";
import CardContent from "@mui/material/CardContent";
import Grid from "@mui/material/Unstable_Grid2";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography";
import Skeleton from "@mui/material/Skeleton";
import { borderRadiusDefault } from "../../palette.module.scss";
export const EpisodeCardsSkeleton = () => {
return (
<Grid
container
columns={{
xs: 2,
sm: 3,
md: 4,
}}
sx={{ width: "100%" }}
>
{Array.from(new Array(4)).map((a, index) => {
return (
<Grid xs={1} sm={1} md={1} key={index}>
<Card
sx={{ background: "transparent" }}
elevation={0}
>
<CardMedia>
<Skeleton
animation="wave"
variant="rectangular"
sx={{
aspectRatio: "1.777",
height: "auto",
m: 1,
borderRadius:
borderRadiusDefault,
}}
/>
</CardMedia>
<CardContent
sx={{
padding: "0 0.5em",
alignItems: "flex-start",
backgroundColor: "transparent",
}}
>
<Typography variant="h6">
<Skeleton
variant="text"
animation="wave"
/>
</Typography>
<Typography variant="subtitle1" mb={1}>
<Skeleton
variant="text"
width="50%"
animation="wave"
/>
</Typography>
<Typography variant="body2">
<Skeleton
variant="text"
animation="wave"
/>
<Skeleton
variant="text"
animation="wave"
/>
<Skeleton
variant="text"
animation="wave"
/>
</Typography>
</CardContent>
</Card>
</Grid>
);
})}
</Grid>
);
};
+18 -3
View File
@@ -44,6 +44,7 @@ import "./item.module.scss";
import { MdiCheck } from "../../components/icons/mdiCheck";
import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline";
import { MdiHeart } from "../../components/icons/mdiHeart";
import { EpisodeCardsSkeleton } from "../../components/skeleton/episodeCards";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -111,6 +112,7 @@ const ItemDetail = () => {
},
enabled: !!user.data,
networkMode: "always",
refetchOnWindowFocus: true,
});
const similarItems = useQuery({
@@ -147,6 +149,7 @@ const ItemDetail = () => {
},
enabled: item.isSuccess,
networkMode: "always",
refetchOnWindowFocus: true,
});
const seasons = useQuery({
@@ -159,6 +162,7 @@ const ItemDetail = () => {
},
enabled: item.isSuccess && item.data.Type == "Series",
networkMode: "always",
refetchOnWindowFocus: true,
});
const [currentSeason, setCurrentSeason] = useState(0);
@@ -174,6 +178,7 @@ const ItemDetail = () => {
},
enabled: seasons.isSuccess,
networkMode: "always",
refetchOnWindowFocus: true,
});
const personShows = useQuery({
@@ -591,7 +596,14 @@ const ItemDetail = () => {
}}
disabled
>
Play
{!!item.data
.UserData
.PlayedPercentage &&
item.data.UserData
.PlayedPercentage >
0
? "Resume"
: "Play"}
{!!item.data
.UserData
.PlayedPercentage && (
@@ -738,7 +750,9 @@ const ItemDetail = () => {
md: 4,
}}
>
{episodes.isSuccess &&
{episodes.isLoading ? (
<EpisodeCardsSkeleton />
) : (
episodes.data.Items.map(
(
mitem,
@@ -820,7 +834,8 @@ const ItemDetail = () => {
</Grid2>
);
},
)}
)
)}
</Grid2>
</TabPanel>
);
+2 -6
View File
@@ -55,14 +55,10 @@ export const getRuntimeFull = (ticks) => {
*/
export const endsAt = (ticks) => {
let current = new Date();
let currentTime =
current.getHours() * 3600000 + current.getMinutes() * 60000;
let currentTime = current.getTime();
let time = ticksToMs(ticks);
let calculatedTime = currentTime + time;
let hr = Math.floor(calculatedTime / 3600000);
calculatedTime -= hr * 3600000;
let min = Math.floor(calculatedTime / 60000);
let formated = new Date(calculatedTime).toLocaleTimeString([], {
let formated = new Date(calculatedTime).toLocaleString([], {
hour: "2-digit",
minute: "2-digit",
});