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>
);
};