feat: add new episode layout

This commit is contained in:
Prayag Prajapati committed 2024-03-16 20:00:27 +05:30
1 parent 9251a3518e
commit ff5fc5a149
10 files changed
+318 -288

No files matched your search

+1 -1
View File
@@ -142,7 +142,7 @@
}
&-progress{
width: attr('data-progress');
// width: attr('data-progress');
height: 100%;
background: white;
transition: width $transition-time-default ease-in-out;
+31 -17
View File
@@ -1,19 +1,24 @@
import React, { useState } from "react";
/** @format */
import React from "react";
import { Component, useState } from "react";
import { useNavigate } from "react-router-dom";
import LinearProgress from "@mui/material/LinearProgress";
import Typography from "@mui/material/Typography";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.module.scss";
import { BaseItemDto, BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
import {
type BaseItemDto,
BaseItemKind,
} from "@jellyfin/sdk/lib/generated-client";
import { useApi } from "../../utils/store/api";
import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton";
import PlayButton from "../buttons/playButton";
import ErrorBoundary from "../errorBoundary";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.module.scss";
const cardImageAspectRatios = {
thumb: 1.777,
@@ -54,7 +59,7 @@ export const Card = ({
hideText: boolean;
onClick: Function | null;
disableOverlay: boolean;
overrideIcon: React.Component | null;
overrideIcon: any;
}) => {
const [api] = useApi((state) => [state.api]);
const navigate = useNavigate();
@@ -84,12 +89,16 @@ export const Card = ({
opacity: item.UserData?.Played ? 1 : 0,
}}
>
<div className="material-symbols-rounded">done</div>
<div className="material-symbols-rounded">
done
</div>
</div>
<div
className={"card-indicator text"}
style={{
opacity: item.UserData?.UnplayedItemCount ? 1 : 0,
opacity: item.UserData?.UnplayedItemCount
? 1
: 0,
}}
>
<Typography
@@ -112,7 +121,9 @@ export const Card = ({
/>
)} */}
<div className="card-image-icon-container">
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
{overrideIcon
? getTypeIcon(overrideIcon)
: getTypeIcon(item.Type)}
</div>
<img
alt={item.Name}
@@ -120,14 +131,13 @@ export const Card = ({
overrideIcon === "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl(
seriesId ? item.SeriesId : item.AlbumId ?? item.Id,
seriesId
? item.SeriesId
: item.AlbumId ?? item.Id,
imageType,
{
quality: 90,
fillHeight: 226,
fillWidth: Math.floor(
226 / cardImageAspectRatios[cardType],
),
fillWidth: 400,
},
)
}
@@ -159,12 +169,16 @@ export const Card = ({
}}
iconOnly
audio={
item.Type === BaseItemKind.MusicAlbum ||
item.Type ===
BaseItemKind.MusicAlbum ||
item.Type === BaseItemKind.Audio ||
item.Type === BaseItemKind.AudioBook ||
item.Type ===
BaseItemKind.AudioBook ||
item.Type === BaseItemKind.Playlist
}
playlistItem={
item.Type === BaseItemKind.Playlist
}
playlistItem={item.Type === BaseItemKind.Playlist}
playlistItemId={item.Id}
/>
<LikeButton
+67
View File
@@ -0,0 +1,67 @@
import { Divider, Skeleton, Typography } from "@mui/material";
import React from "react";
const EpisodeSkeleton = () => {
return Array.from(new Array(8)).map((a, index) => {
return <>
<div
key={index}
style={{
width: "100%",
}}
className="item-detail-episode"
>
<Typography variant="h6"><Skeleton variant="circular" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} /></Typography>
<div className="item-detail-episode-image-container">
<Skeleton className="item-detail-episode-image" variant="rectangular" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</div>
<div className="item-detail-episode-info">
<Typography variant="h4">
<Skeleton variant="text" width="10em" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</Typography>
<Skeleton variant="rounded" width="5em" style={{ borderRadius: "100px" }} sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
<Typography style={{
width: "100%"
}}>
<Skeleton width="100%" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
<Skeleton width="100%" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</Typography>
</div>
</div>
{index !== 7 && <Divider orientation="horizontal" flexItem />}
</>
})
}
export default EpisodeSkeleton
+2 -77
View File
@@ -1,10 +1,8 @@
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
import Divider from "@mui/material/Divider";
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
import Grid from "@mui/material/Unstable_Grid2";
import EpisodeSkeleton from "./episode";
import { borderRadiusDefault } from "../../palette.module.scss";
@@ -47,80 +45,7 @@ export const SeasonSelectorSkeleton = () => {
paddingBottom: " 0.5em",
}}
/>
{Array.from(new Array(4)).map((a, index) => {
return (
<Grid xs={1} sm={1} md={1} key={a}>
<Card sx={{ background: "transparent" }} elevation={0}>
<CardMedia>
<Skeleton
// animation="wave"
variant="rectangular"
sx={{
aspectRatio: "1.777",
height: "auto",
m: 1,
borderRadius: "10px",
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</CardMedia>
<CardContent
sx={{
padding: "0 0.5em",
alignItems: "flex-start",
backgroundColor: "transparent",
}}
>
<Typography variant="h6">
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</Typography>
<Typography variant="body2">
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</Typography>
</CardContent>
</Card>
</Grid>
);
})}
<EpisodeSkeleton/>
</Grid>
);
};