Add criticsRating and improve icons and animations in itemPage

This commit is contained in:
Prayag Prajapati committed 2023-12-14 17:39:10 +05:30
1 parent 2268bca663
commit 3134818ca7
12 files changed
+194 -74

No files matched your search

+61 -34
View File
@@ -13,8 +13,7 @@ import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client/models/base-ite
import { MediaStreamType } from "@jellyfin/sdk/lib/generated-client/models/media-stream-type";
import { Card } from "../../card/card";
import { MdiStar } from "../../icons/mdiStar";
import { yellow } from "@mui/material/colors";
import { yellow, red } from "@mui/material/colors";
import { endsAt, getRuntime, getRuntimeFull } from "../../../utils/date/time";
import LikeButton from "../../buttons/likeButton";
import MarkPlayedButton from "../../buttons/markPlayedButton";
@@ -25,6 +24,7 @@ import { Blurhash } from "react-blurhash";
import TextLink from "../../textLink";
import { useApi } from "../../../utils/store/api";
import { ErrorBoundary } from "react-error-boundary";
/**
* @typedef {Object} Props
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
@@ -418,42 +418,69 @@ const Hero = ({
item.OfficialRating ?? "Not Rated"
}
/>
<div
style={{
display: "flex",
gap: "0.25em",
alignItems: "center",
}}
className="hero-carousel-info-rating"
>
{item.CommunityRating ? (
<>
<MdiStar
sx={{
color: yellow[700],
}}
/>
<Typography
style={{
opacity: "0.8",
}}
variant="subtitle1"
>
{Math.round(
item.CommunityRating *
10,
) / 10}
</Typography>
</>
) : (
<ErrorBoundary fallback={<></>}>
<div
style={{
display: "flex",
gap: "0.25em",
alignItems: "center",
}}
className="hero-carousel-info-rating"
>
<div
className="material-symbols-rounded "
style={{
fontSize: "2.2em",
color: yellow[700],
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
star
</div>
<Typography
style={{ opacity: "0.8" }}
style={{
opacity: "0.8",
}}
variant="subtitle1"
>
No Community Rating
{Math.round(
item.CommunityRating *
10,
) / 10}
</Typography>
)}
</div>
</div>
</ErrorBoundary>
<ErrorBoundary fallback={<></>}>
<div
style={{
display: "flex",
gap: "0.25em",
alignItems: "center",
}}
className="hero-carousel-info-rating"
>
<div
className="material-symbols-rounded "
style={{
color: red[400],
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
thumb_up
</div>
<Typography
style={{
opacity: "0.8",
}}
variant="subtitle1"
>
{item.CriticRating}
</Typography>
</div>
</ErrorBoundary>
{!!item.RunTimeTicks && (
<Typography
style={{ opacity: "0.8" }}
+1 -1
View File
@@ -57,7 +57,7 @@ $maskPercentage: 40%;
&-name-logo {
width: 10.4em;
height: 2.6em;
max-height: 2.6em;
object-fit: contain;
object-position: left;
opacity: 0;
@@ -10,7 +10,7 @@ export const EmptyNotice = () => {
<Box
sx={{
width: "100%",
height: "100vh",
height: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
@@ -23,16 +23,14 @@ export const EmptyNotice = () => {
style={{
fontSize: "10em",
color: yellow[800],
"--clr": yellow[800],
fontVariationSettings:
'"FILL" 0, "wght" 100, "GRAD" 25, "opsz" 40',
"--clr": "rgb(249 168 37 / 30%)",
}}
>
sentiment_dissatisfied
</div>
<Typography
variant="h3"
fontFamily="JetBrains Mono Variable"
fontWeight={100}
>
<Typography variant="h3" fontWeight={100}>
No results found
</Typography>
</Box>
@@ -24,16 +24,14 @@ export const ErrorNotice = ({ error, resetErrorBoundary }) => {
style={{
fontSize: "10em",
color: red[800],
"--clr": red[800],
"--clr": "rgb(198 40 40 / 30%)",
fontVariationSettings:
'"FILL" 0, "wght" 100, "GRAD" 25, "opsz" 40',
}}
>
error
</div>
<Typography
variant="h3"
fontFamily="JetBrains Mono Variable"
fontWeight={100}
>
<Typography variant="h3" fontWeight={100}>
Something went wrong
</Typography>
<Typography
@@ -59,9 +57,20 @@ export const ErrorNotice = ({ error, resetErrorBoundary }) => {
style={{
marginTop: "1em",
}}
color="info"
>
Retry
Close
</Button>
<Typography
variant="subitle1"
fontWeight={300}
style={{
marginTop: "1em",
}}
>
Note: You need to click on CLOSE button if you change the
page in order to close this error message
</Typography>
</Box>
);
};
+16 -2
View File
@@ -9,6 +9,8 @@ import Paper from "@mui/material/Paper";
import { useParams } from "react-router-dom";
import { motion } from "framer-motion";
import {
BaseItemKind,
ItemFields,
@@ -34,6 +36,7 @@ import { useBackdropStore } from "../../utils/store/backdrop";
import LikeButton from "../../components/buttons/likeButton";
import { useAudioPlayback } from "../../utils/store/audioPlayback";
import { useApi } from "../../utils/store/api";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -179,7 +182,18 @@ const MusicAlbumTitlePage = () => {
}
if (item.isSuccess && similarItems.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -418,7 +432,7 @@ const MusicAlbumTitlePage = () => {
})}
</CardScroller>
)}
</div>
</motion.div>
);
}
if (item.isError || similarItems.isError) {
+14 -2
View File
@@ -32,6 +32,7 @@ import { ArtistAlbum } from "../../components/layouts/artist/artistAlbum";
import { useBackdropStore } from "../../utils/store/backdrop";
import MusicTrack from "../../components/musicTrack";
import { useApi } from "../../utils/store/api";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -197,7 +198,18 @@ const ArtistTitlePage = () => {
}
if (item.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -401,7 +413,7 @@ const ArtistTitlePage = () => {
</TabPanel>
</AnimatePresence>
</div>
</div>
</motion.div>
);
}
if (item.isError) {
+15 -2
View File
@@ -6,6 +6,8 @@ import Box from "@mui/material/Box";
import CircularProgress from "@mui/material/CircularProgress";
import { useParams, useNavigate } from "react-router-dom";
import { motion } from "framer-motion";
import {
BaseItemKind,
ItemFields,
@@ -149,7 +151,18 @@ const BoxSetTitlePage = () => {
}
if (item.isSuccess && similarItems.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -312,7 +325,7 @@ const BoxSetTitlePage = () => {
})}
</CardScroller>
)}
</div>
</motion.div>
);
}
if (item.isError || similarItems.isError) {
+16 -2
View File
@@ -7,6 +7,8 @@ import CircularProgress from "@mui/material/CircularProgress";
import { useParams } from "react-router-dom";
import { motion } from "framer-motion";
import {
BaseItemKind,
ItemFields,
@@ -27,6 +29,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { useBackdropStore } from "../../utils/store/backdrop";
import { ActorCard } from "../../components/card/actorCards";
import { useApi } from "../../utils/store/api";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -175,7 +178,18 @@ const EpisodeTitlePage = () => {
}
if (item.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY episode"
style={{
padding: "5em 2em 2em 1em",
@@ -270,7 +284,7 @@ const EpisodeTitlePage = () => {
)}
</CardScroller>
)}
</div>
</motion.div>
);
}
if (item.isError) {
+17 -2
View File
@@ -7,6 +7,8 @@ import CircularProgress from "@mui/material/CircularProgress";
import { useParams } from "react-router-dom";
import { motion, AnimatePresence } from "framer-motion";
import {
BaseItemKind,
ItemFields,
@@ -29,6 +31,7 @@ import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { useBackdropStore } from "../../utils/store/backdrop";
import { ActorCard } from "../../components/card/actorCards";
import { useApi } from "../../utils/store/api";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -200,9 +203,21 @@ const ItemDetail = () => {
</Box>
);
}
if (item.isSuccess && similarItems.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -320,7 +335,7 @@ const ItemDetail = () => {
})}
</CardScroller>
)}
</div>
</motion.div>
);
}
if (item.isError || similarItems.isError) {
+13 -2
View File
@@ -267,7 +267,18 @@ const PersonTitlePage = () => {
}
if (item.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -446,7 +457,7 @@ const PersonTitlePage = () => {
})}
</AnimatePresence>
</div>
</div>
</motion.div>
);
}
if (item.isError) {
+13 -2
View File
@@ -228,7 +228,18 @@ const SeriesTitlePage = () => {
}
if (item.isSuccess && similarItems.isSuccess) {
return (
<div
<motion.div
key={id}
initial={{
opacity: 0,
}}
animate={{
opacity: 1,
}}
transition={{
duration: 0.25,
ease: "easeInOut",
}}
className="scrollY"
style={{
padding: "5em 2em 2em 1em",
@@ -633,7 +644,7 @@ const SeriesTitlePage = () => {
})}
</CardScroller>
)}
</div>
</motion.div>
);
}
if (item.isError || similarItems.isError) {
+7 -11
View File
@@ -181,22 +181,18 @@ h1 {
height: 100%;
border-radius: 100%;
opacity: 0;
filter: blur(10px);
animation: iconAnimation cubic-bezier(0.175, 0.885, 0.32, 1.275) 3s
infinite;
background: radial-gradient(transparent, var(--clr));
// filter: blur(10px);
animation: iconAnimation ease-out 1s infinite;
background: var(--clr);
z-index: -1;
// background: radial-gradient(transparent, var(--clr));
}
}
@keyframes iconAnimation {
0% {
opacity: 0;
transform: translate(-50%, -50%) scale(1);
}
60% {
opacity: 0.1;
transform: translate(-50%, -50%) scale(4);
opacity: 1;
transform: translate(-50%, -50%) scale(0);
}
100% {
opacity: 0;