Remove a lot of Box components, replace sx with style, move from npm to pnpm, etc...

This commit is contained in:
Prayag Prajapati committed 2023-09-11 15:16:54 +05:30
1 parent 5c425b65c6
commit 5caa9b084f
20 files changed
+2356 -3352

No files matched your search

+5 -3
View File
@@ -1,3 +1,5 @@
# @format
# To get started with Dependabot version updates, you'll need to specify which # To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located. # package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options: # Please see the documentation for all configuration options:
@@ -5,13 +7,13 @@
version: 2 version: 2
updates: updates:
- package-ecosystem: "npm" # See documentation for possible values - package-ecosystem: "pnpm" # See documentation for possible values
directory: "/" # Location of package manifests directory: "/" # Location of package manifests
schedule: schedule:
interval: "weekly" interval: "weekly"
commit-message: commit-message:
prefix: "chore(package-update) NPM" prefix: "chore(package-update) PNPM"
- package-ecosystem: "cargo" - package-ecosystem: "Cargo"
directory: "/src-tauri" directory: "/src-tauri"
schedule: schedule:
interval: "weekly" interval: "weekly"
+22 -10
View File
@@ -1,39 +1,51 @@
![Banner](https://user-images.githubusercontent.com/55829513/215268063-c7e114c2-0200-42e9-9e38-6dc765fcf6cc.png) ![Banner](https://user-images.githubusercontent.com/55829513/215268063-c7e114c2-0200-42e9-9e38-6dc765fcf6cc.png)
# 📝 Prerequisites: # 📝 Prerequisites
- Nodejs (≥19.1.0) - Nodejs (≥19.1.0)
- Rust (≥1.66.1) - Rust (≥1.66.1)
- Visual Studio C++ Build tools - Visual Studio C++ Build tools
- pnpm
# ℹ️ Getting started
# ℹ️ Getting started:
- Install Nodejs and Rust. - Install Nodejs and Rust.
> **Note** : Install Rust from https://www.rust-lang.org/learn/get-started > **Note** : Install Rust from <https://www.rust-lang.org/learn/get-started>
- install depencies using npm: - install depencies using npm:
```shell ```shell
npm install pnpm install
``` ```
# 🛠️ Development: # 🛠️ Development
- Running the app: - Running the app:
```shell ```shell
npm run tauri dev pnpm run tauri dev
``` ```
- Building the app: - Building the app:
```shell ```shell
npm run tauri build pnpm run tauri build
``` ```
- other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json) - other commands can be found inside the `"scripts"` inside [package.json](https://github.com/prayag17/JellyPlayer/blob/main/package.json)
# 💻 Contribution: # 💻 Contribution
- Checkout `issues` to see currently worked on features and bugs - Checkout `issues` to see currently worked on features and bugs
- Add features or fix bugs - Add features or fix bugs
- Create a pull request - Create a pull request
# 📃 Roadmap: # 📃 Roadmap
- Checkout [GitHub Project](https://github.com/users/prayag17/projects/3) - Checkout [GitHub Project](https://github.com/users/prayag17/projects/3)
> **Note** : There is no current due date for alpha 1 release > **Note** : There is no current due date for alpha 1 release
# 🎊 Special thanks to: # 🎊 Special thanks to
- [@ferferga](https://github.com/ferferga) for helping in development behind the scenes. - [@ferferga](https://github.com/ferferga) for helping in development behind the scenes.
- All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue). - All contributors of [jellyfin/jellyfin-vue](https://github.com/jellyfin/jellyfin-vue).
- And also [@jellyfin](https://github.com/jellyfin/) for creating the main service - And also [@jellyfin](https://github.com/jellyfin/) for creating the main service
-3215
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -4,6 +4,7 @@
"version": "1.0.0-alpha0", "version": "1.0.0-alpha0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm",
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"preview": "vite preview", "preview": "vite preview",
@@ -42,6 +43,7 @@
"devDependencies": { "devDependencies": {
"@tauri-apps/cli": "^1.3.1", "@tauri-apps/cli": "^1.3.1",
"@vitejs/plugin-react": "^4.0.3", "@vitejs/plugin-react": "^4.0.3",
"prop-types": "^15.8.1",
"sass": "^1.66.1", "sass": "^1.66.1",
"vite": "^4.4.2" "vite": "^4.4.2"
}, },
+2147
View File
File diff suppressed because it is too large. Load diff
+1 -1
View File
@@ -71,7 +71,7 @@
"width": 800, "width": 800,
"resizable": true, "resizable": true,
"title": "JellyPlayer", "title": "JellyPlayer",
"visible": false, "visible": true,
"center": true "center": true
}, },
{ {
+2 -3
View File
@@ -36,7 +36,6 @@ import DialogContentText from "@mui/material/DialogContentText";
import DialogTitle from "@mui/material/DialogTitle"; import DialogTitle from "@mui/material/DialogTitle";
import Button from "@mui/material/Button"; import Button from "@mui/material/Button";
import Slide from "@mui/material/Slide"; import Slide from "@mui/material/Slide";
import Box from "@mui/material/Box";
import LinearProgress from "@mui/material/LinearProgress"; import LinearProgress from "@mui/material/LinearProgress";
// Routes // Routes
@@ -381,7 +380,7 @@ function App() {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<Box className="app-backdrop-container"> <div className="app-backdrop-container">
<AnimatePresence> <AnimatePresence>
<motion.img <motion.img
key={backdropId} key={backdropId}
@@ -407,7 +406,7 @@ function App() {
}} }}
/> />
</AnimatePresence> </AnimatePresence>
</Box> </div>
<div <div
style={{ style={{
display: "flex", display: "flex",
+6 -6
View File
@@ -113,10 +113,10 @@ export const AppBar = () => {
paddingLeft: "12px !important", paddingLeft: "12px !important",
}} }}
> >
<Box <div
sx={{ style={{
display: "flex", display: "flex",
gap: 1, gap: "1em",
alignItems: "center", alignItems: "center",
}} }}
> >
@@ -149,8 +149,8 @@ export const AppBar = () => {
<IconButton> <IconButton>
<MdiMagnify /> <MdiMagnify />
</IconButton> </IconButton>
</Box> </div>
<Box sx={{ display: "flex", gap: 2 }}> <div style={{ display: "flex", gap: "2em" }}>
<IconButton disabled> <IconButton disabled>
<MdiHeartOutline /> <MdiHeartOutline />
</IconButton> </IconButton>
@@ -215,7 +215,7 @@ export const AppBar = () => {
Remove Server Remove Server
</MenuItem> </MenuItem>
</Menu> </Menu>
</Box> </div>
</Toolbar> </Toolbar>
</MuiAppBar> </MuiAppBar>
); );
+4 -2
View File
@@ -142,7 +142,7 @@ const PlayButton = ({
<LinearProgress <LinearProgress
variant="determinate" variant="determinate"
value={ value={
!!itemUserData.PlayedPercentage 100 > itemUserData.PlayedPercentage > 0
? itemUserData.PlayedPercentage ? itemUserData.PlayedPercentage
: 0 : 0
} }
@@ -159,7 +159,9 @@ const PlayButton = ({
}} }}
color="white" color="white"
/> />
{itemUserData.PlayedPercentage > 0 ? "Resume" : "Play"} {100 > itemUserData.PlayedPercentage > 0
? "Resume"
: "Play"}
</Button> </Button>
); );
} }
+19 -53
View File
@@ -3,7 +3,6 @@ import PropTypes from "prop-types";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import MuiCard from "@mui/material/Card"; import MuiCard from "@mui/material/Card";
import CardActionArea from "@mui/material/CardActionArea"; import CardActionArea from "@mui/material/CardActionArea";
@@ -71,63 +70,31 @@ export const Card = ({
justifyContent="center" justifyContent="center"
mr={1} mr={1}
> >
<Box <div
className="card-image-container" className="card-image-container"
sx={{ style={{
aspectRatio: cardImageAspectRatios[cardType], aspectRatio: cardImageAspectRatios[cardType],
overflow: "hidden",
height: "auto",
width: "100%",
zIndex: 0,
}} }}
> >
{!!item.UserData && ( {!!item.UserData && (
<> <>
<Box <div
sx={{ className="card-indicator check"
position: "absolute", style={{
top: "0.4em",
right: "0.4em",
zIndex: 2,
background:
"rgb(20 20 20 / 0.5)",
padding: "0.2em 0.75em",
display: "flex",
alignItems: "center",
justifyContent: "center",
borderRadius: "100px",
backdropFilter: "blur(5px)",
transition: "opacity 250ms",
opacity: item.UserData?.Played opacity: item.UserData?.Played
? 1 ? 1
: 0, : 0,
boxShadow:
"0 0 5px rgb(0 0 0 / 0.2)",
}} }}
> >
<MdiCheck /> <MdiCheck />
</Box> </div>
<Box <div
sx={{ className={`card-indicator text`}
position: "absolute", style={{
top: "0.4em", opacity: !!item.UserData
right: "0.4em",
zIndex: 2,
background:
"rgb(20 20 20 / 0.5)",
padding: "0.2em 0.75em",
display: "flex",
alignItems: "center",
justifyContent: "center",
borderRadius: "100px",
backdropFilter: "blur(5px)",
transition: "opacity 250ms",
opacity: item.UserData
?.UnplayedItemCount ?.UnplayedItemCount
? 1 ? 1
: 0, : 0,
boxShadow:
"0 0 5px rgb(0 0 0 / 0.2)",
}} }}
> >
<Typography <Typography
@@ -140,7 +107,7 @@ export const Card = ({
?.UnplayedItemCount ?.UnplayedItemCount
} }
</Typography> </Typography>
</Box> </div>
</> </>
)} )}
{!!imageBlurhash && ( {!!imageBlurhash && (
@@ -153,11 +120,11 @@ export const Card = ({
className="card-image-blurhash" className="card-image-blurhash"
/> />
)} )}
<Box className="card-image-icon-container"> <div className="card-image-icon-container">
{!!overrideIcon {!!overrideIcon
? TypeIconCollectionCard[overrideIcon] ? TypeIconCollectionCard[overrideIcon]
: TypeIconCollectionCard[item.Type]} : TypeIconCollectionCard[item.Type]}
</Box> </div>
<img <img
src={ src={
overrideIcon == "User" overrideIcon == "User"
@@ -184,7 +151,7 @@ export const Card = ({
className="card-image" className="card-image"
/> />
{!disableOverlay && ( {!disableOverlay && (
<Box className="card-overlay"> <div className="card-overlay">
<PlayButton <PlayButton
itemId={item.Id} itemId={item.Id}
userId={userId} userId={userId}
@@ -214,9 +181,9 @@ export const Card = ({
queryKey={queryKey} queryKey={queryKey}
userId={userId} userId={userId}
/> />
</Box> </div>
)} )}
{Boolean(item.UserData?.PlayedPercentage) && ( {100 > item.UserData?.PlayedPercentage > 0 && (
<LinearProgress <LinearProgress
variant="determinate" variant="determinate"
value={item.UserData.PlayedPercentage} value={item.UserData.PlayedPercentage}
@@ -234,10 +201,9 @@ export const Card = ({
color="primary" color="primary"
/> />
)} )}
</Box> </div>
<Box <div
className="card-text-container" className="card-text-container"
height="15%"
style={{ display: hideText ? "none" : "block" }} style={{ display: hideText ? "none" : "block" }}
> >
<Typography <Typography
@@ -258,7 +224,7 @@ export const Card = ({
> >
{cardCaption} {cardCaption}
</Typography> </Typography>
</Box> </div>
</Stack> </Stack>
</MuiCard> </MuiCard>
</CardActionArea> </CardActionArea>
+23
View File
@@ -14,6 +14,9 @@
width: 100%; width: 100%;
border-radius: $border-radius-default; border-radius: $border-radius-default;
box-shadow: 0 4px 8px rgb(0 0 0 / 0.2); box-shadow: 0 4px 8px rgb(0 0 0 / 0.2);
overflow: hidden;
height: auto;
z-index: 0;
} }
&-icon { &-icon {
position: absolute; position: absolute;
@@ -71,4 +74,24 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1; z-index: 1;
} }
&-indicator {
position: absolute;
top: 0.4em;
right: 0.4em;
z-index: 2;
padding: 0.2em 0.75em;
background: rgb(20 20 20 / 0.5);
display: flex;
align-items: center;
justify-content: center;
backdrop-filter: blur(5px);
transition: opacity 250ms;
border-radius: 100px;
box-shadow: 0 0 5px rgb(0 0 0 / 0.2);
}
&-text {
&-container {
height: 15%;
}
}
} }
+2
View File
@@ -1,6 +1,8 @@
/** @format */ /** @format */
.carousel { .carousel {
position: relative;
height: 100vh;
&-button { &-button {
position: absolute !important; position: absolute !important;
top: 50%; top: 50%;
+8 -9
View File
@@ -2,7 +2,6 @@
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { AnimatePresence, motion } from "framer-motion"; import { AnimatePresence, motion } from "framer-motion";
import Box from "@mui/material/Box";
import IconButton from "@mui/material/IconButton"; import IconButton from "@mui/material/IconButton";
import { MdiChevronLeft } from "../icons/mdiChevronLeft"; import { MdiChevronLeft } from "../icons/mdiChevronLeft";
import { MdiChevronRight } from "../icons/mdiChevronRight"; import { MdiChevronRight } from "../icons/mdiChevronRight";
@@ -27,7 +26,7 @@ const Carousel = ({ content, onChange }) => {
}, [currentSlide]); }, [currentSlide]);
return ( return (
<Box className="carousel" position="relative" height="100vh"> <div className="carousel">
<IconButton <IconButton
className="carousel-button left" className="carousel-button left"
onClick={() => { onClick={() => {
@@ -96,14 +95,14 @@ const Carousel = ({ content, onChange }) => {
> >
<MdiChevronRight /> <MdiChevronRight />
</IconButton> </IconButton>
<Box className="carousel-indicator-container"> <div className="carousel-indicator-container">
<Box <div
className={ className={
currentSlide == 0 currentSlide == 0
? "carousel-indicator active" ? "carousel-indicator active"
: "carousel-indicator" : "carousel-indicator"
} }
sx={{ style={{
background: background:
currentSlide == 0 currentSlide == 0
? "white" ? "white"
@@ -115,14 +114,14 @@ const Carousel = ({ content, onChange }) => {
}} }}
/> />
{content.map((item, index) => ( {content.map((item, index) => (
<Box <div
className={ className={
currentSlide == index + 1 currentSlide == index + 1
? "carousel-indicator active" ? "carousel-indicator active"
: "carousel-indicator" : "carousel-indicator"
} }
key={index} key={index}
sx={{ style={{
background: background:
currentSlide == index + 1 currentSlide == index + 1
? "white" ? "white"
@@ -138,8 +137,8 @@ const Carousel = ({ content, onChange }) => {
}} }}
/> />
))} ))}
</Box> </div>
</Box> </div>
); );
}; };
+20 -19
View File
@@ -1,11 +1,10 @@
/** @format */ /** @format */
import { memo } from "react"; import React, { memo } from "react";
import { Blurhash } from "react-blurhash"; import { Blurhash } from "react-blurhash";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
import Box from "@mui/material/Box";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import Chip from "@mui/material/Chip"; import Chip from "@mui/material/Chip";
@@ -20,21 +19,25 @@ import { MdiStar } from "../icons/mdiStar";
import { endsAt, getRuntime } from "../../utils/date/time"; import { endsAt, getRuntime } from "../../utils/date/time";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { MediaTypeIconCollection } from "../utils/iconsCollection"; import { MediaTypeIconCollection } from "../utils/iconsCollection";
import { MdiPlayOutline } from "../icons/mdiPlayOutline";
import { MdiChevronRight } from "../icons/mdiChevronRight"; import { MdiChevronRight } from "../icons/mdiChevronRight";
import { MdiHeart } from "../icons/mdiHeart"; import { useQuery } from "@tanstack/react-query";
import { MdiHeartOutline } from "../icons/mdiHeartOutline";
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { getUserLibraryApi } from "@jellyfin/sdk/lib/utils/api/user-library-api";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api"; import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useSnackbar } from "notistack";
import LikeButton from "../buttons/likeButton"; import LikeButton from "../buttons/likeButton";
import MarkPlayedButton from "../buttons/markPlayedButton"; import MarkPlayedButton from "../buttons/markPlayedButton";
import { theme } from "../../theme";
import { useCarouselStore } from "../../utils/store/carousel"; import { useCarouselStore } from "../../utils/store/carousel";
import PlayButton from "../buttons/playButton"; import PlayButton from "../buttons/playButton";
/**
* @typedef {Object} Props
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
*/
/**
* @description Carousel slide component
* @param {Props}
* @returns {React.Component}
*/
const CarouselSlide = ({ item }) => { const CarouselSlide = ({ item }) => {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -105,9 +108,7 @@ const CarouselSlide = ({ item }) => {
{MediaTypeIconCollection[item.Type]} {MediaTypeIconCollection[item.Type]}
</div> </div>
</div> </div>
<Box <motion.div
component={motion.div}
// variants={slideAnim}
initial={{ initial={{
transform: transform:
animationDirection == "right" animationDirection == "right"
@@ -168,8 +169,8 @@ const CarouselSlide = ({ item }) => {
direction="row" direction="row"
gap={1} gap={1}
divider={ divider={
<Box <div
sx={{ style={{
width: "4px", width: "4px",
height: "4px", height: "4px",
background: "white", background: "white",
@@ -177,7 +178,7 @@ const CarouselSlide = ({ item }) => {
aspectRatio: 1, aspectRatio: 1,
borderRadius: "10px", borderRadius: "10px",
}} }}
></Box> ></div>
} }
className="hero-carousel-info" className="hero-carousel-info"
> >
@@ -190,8 +191,8 @@ const CarouselSlide = ({ item }) => {
variant="filled" variant="filled"
label={item.OfficialRating ?? "Not Rated"} label={item.OfficialRating ?? "Not Rated"}
/> />
<Box <div
sx={{ style={{
display: "flex", display: "flex",
gap: "0.25em", gap: "0.25em",
alignItems: "center", alignItems: "center",
@@ -217,7 +218,7 @@ const CarouselSlide = ({ item }) => {
No Community Rating No Community Rating
</Typography> </Typography>
)} )}
</Box> </div>
{!!item.RunTimeTicks && ( {!!item.RunTimeTicks && (
<Typography variant="subtitle1"> <Typography variant="subtitle1">
{getRuntime(item.RunTimeTicks)} {getRuntime(item.RunTimeTicks)}
@@ -293,7 +294,7 @@ const CarouselSlide = ({ item }) => {
/> />
</Stack> </Stack>
</Stack> </Stack>
</Box> </motion.div>
</Paper> </Paper>
</ErrorBoundary> </ErrorBoundary>
); );
+76 -11
View File
@@ -1,5 +1,7 @@
/** @format */ /** @format */
import { useEffect, useState } from "react"; import PropTypes from "prop-types";
import React, { useEffect, useState } from "react";
import TextField from "@mui/material/TextField"; import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem"; import MenuItem from "@mui/material/MenuItem";
import Chip from "@mui/material/Chip"; import Chip from "@mui/material/Chip";
@@ -7,7 +9,11 @@ import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography"; import Typography from "@mui/material/Typography";
import LinearProgress from "@mui/material/LinearProgress"; import LinearProgress from "@mui/material/LinearProgress";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client"; // import { BaseItemDto } from "";
// import { BaseItemPerson } from "@jellyfin/sdk/lib/generated-client/models/base-item-person";
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client/models/base-item-kind";
import { MediaStreamType } from "@jellyfin/sdk/lib/generated-client/models/media-stream-type";
import { Card } from "../../card/card"; import { Card } from "../../card/card";
import { MdiStar } from "../../icons/mdiStar"; import { MdiStar } from "../../icons/mdiStar";
import { yellow } from "@mui/material/colors"; import { yellow } from "@mui/material/colors";
@@ -20,6 +26,22 @@ import "./hero.module.scss";
import { Blurhash } from "react-blurhash"; import { Blurhash } from "react-blurhash";
import { MediaTypeIconCollection } from "../../utils/iconsCollection"; import { MediaTypeIconCollection } from "../../utils/iconsCollection";
/**
* @typedef {Object} Props
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemDto} item
* @property {Array} queryKey
* @property {string} userId
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} writers
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} directors
* @property {import("@jellyfin/sdk/lib/generated-client/models").BaseItemPerson[]} artists
*
*/
/**
* @description Hero section for item pages
* @param {Props}
* @returns {React.Component}
*/
const Hero = ({ const Hero = ({
item, item,
queryKey, queryKey,
@@ -27,19 +49,48 @@ const Hero = ({
writers = [], writers = [],
directors = [], directors = [],
artists = [], artists = [],
videoTracks = [],
audioTracks = [],
subtitleTracks = [],
}) => { }) => {
const filterMediaStreamVideo = (source) => {
if (source.Type == MediaStreamType.Video) {
return true;
}
return false;
};
const filterMediaStreamAudio = (source) => {
if (source.Type == MediaStreamType.Audio) {
return true;
}
return false;
};
const filterMediaStreamSubtitle = (source) => {
if (source.Type == MediaStreamType.Subtitle) {
return true;
}
return false;
};
const videoTracks = item.MediaStreams?.filter(filterMediaStreamVideo);
const audioTracks = item.MediaStreams?.filter(filterMediaStreamAudio);
const subtitleTracks = item.MediaStreams?.filter(
filterMediaStreamSubtitle,
);
const [currentVideoIndex, setCurrentVideoIndex] = useState(""); const [currentVideoIndex, setCurrentVideoIndex] = useState("");
const [currentAudioIndex, setCurrentAudioIndex] = useState(""); const [currentAudioIndex, setCurrentAudioIndex] = useState("");
const [currentSubtitleIndex, setCurrentSubtitleIndex] = useState(""); const [currentSubtitleIndex, setCurrentSubtitleIndex] = useState("");
useEffect(() => { useEffect(() => {
console.error(
JSON.stringify([videoTracks, audioTracks, subtitleTracks]) +
`${new Date()}`,
);
if (!!videoTracks && !!audioTracks & !!subtitleTracks) {
setCurrentVideoIndex(videoTracks[0]?.Index); setCurrentVideoIndex(videoTracks[0]?.Index);
setCurrentAudioIndex(audioTracks[0]?.Index); setCurrentAudioIndex(audioTracks[0]?.Index);
setCurrentSubtitleIndex(subtitleTracks[0]?.Index); setCurrentSubtitleIndex(subtitleTracks[0]?.Index);
}
}, [videoTracks, audioTracks, subtitleTracks]); }, [videoTracks, audioTracks, subtitleTracks]);
return ( return (
<div <div
className="item-detail-hero" className="item-detail-hero"
@@ -220,7 +271,7 @@ const Hero = ({
{item.Genres.join(", ")} {item.Genres.join(", ")}
</Typography> </Typography>
</div> </div>
{item.UserData?.PlayedPercentage > 0 && ( {100 > item.UserData?.PlayedPercentage > 0 && (
<div <div
style={{ style={{
display: "flex", display: "flex",
@@ -293,6 +344,7 @@ const Hero = ({
maxWidth: "60%", maxWidth: "60%",
}} }}
> >
{Boolean(videoTracks?.length) && (
<div className="hero-grid"> <div className="hero-grid">
<Typography <Typography
variant="subtitle1" variant="subtitle1"
@@ -308,7 +360,9 @@ const Hero = ({
value={currentVideoIndex} value={currentVideoIndex}
select select
onChange={(e) => onChange={(e) =>
setCurrentVideoIndex(e.target.value) setCurrentVideoIndex(
e.target.value,
)
} }
SelectProps={{ SelectProps={{
MenuProps: { MenuProps: {
@@ -328,6 +382,8 @@ const Hero = ({
})} })}
</TextField> </TextField>
</div> </div>
)}
{Boolean(audioTracks?.length) && (
<div className="hero-grid"> <div className="hero-grid">
<Typography <Typography
variant="subtitle1" variant="subtitle1"
@@ -343,7 +399,9 @@ const Hero = ({
value={currentAudioIndex} value={currentAudioIndex}
select select
onChange={(e) => onChange={(e) =>
setCurrentAudioIndex(e.target.value) setCurrentAudioIndex(
e.target.value,
)
} }
SelectProps={{ SelectProps={{
MenuProps: { MenuProps: {
@@ -363,7 +421,8 @@ const Hero = ({
})} })}
</TextField> </TextField>
</div> </div>
)}
{Boolean(subtitleTracks?.length) && (
<div className="hero-grid"> <div className="hero-grid">
<Typography <Typography
variant="subtitle1" variant="subtitle1"
@@ -379,7 +438,9 @@ const Hero = ({
value={currentSubtitleIndex} value={currentSubtitleIndex}
select select
onChange={(e) => onChange={(e) =>
setCurrentSubtitleIndex(e.target.value) setCurrentSubtitleIndex(
e.target.value,
)
} }
SelectProps={{ SelectProps={{
MenuProps: { MenuProps: {
@@ -399,6 +460,7 @@ const Hero = ({
})} })}
</TextField> </TextField>
</div> </div>
)}
</div> </div>
<div <div
style={{ style={{
@@ -432,7 +494,10 @@ const Hero = ({
</Typography> </Typography>
<Typography variant="subtitle1"> <Typography variant="subtitle1">
{writers {writers
.map((writer) => writer.Name) .map(
(writer, index) =>
writer.Name,
)
.join(", ")} .join(", ")}
</Typography> </Typography>
</div> </div>
+8 -2
View File
@@ -10,13 +10,19 @@ import Box from "@mui/material/Box";
export const CardsSkeleton = () => { export const CardsSkeleton = () => {
return ( return (
<Box sx={{ display: "flex", flexFlow: "column", mb: 4 }}> <div
style={{
display: "flex",
flexFlow: "column",
marginBottom: "2em",
}}
>
<Typography variant="h4" sx={{ mb: "0.15em" }}> <Typography variant="h4" sx={{ mb: "0.15em" }}>
<Skeleton width="35%" animation="wave" /> <Skeleton width="35%" animation="wave" />
</Typography> </Typography>
<Skeleton width="100%" variant="rounded" animation="wave"> <Skeleton width="100%" variant="rounded" animation="wave">
<div style={{ paddingTop: "20%" }}></div> <div style={{ paddingTop: "20%" }}></div>
</Skeleton> </Skeleton>
</Box> </div>
); );
}; };
+2 -2
View File
@@ -29,7 +29,7 @@ export const CarouselSkeleton = () => {
}} }}
></Skeleton> ></Skeleton>
</div> </div>
<Box className="hero-carousel-detail"> <div className="hero-carousel-detail">
<Typography variant="h3" className="hero-carousel-text"> <Typography variant="h3" className="hero-carousel-text">
<Skeleton <Skeleton
variant="text" variant="text"
@@ -46,7 +46,7 @@ export const CarouselSkeleton = () => {
animation="wave" animation="wave"
></Skeleton> ></Skeleton>
</Typography> </Typography>
</Box> </div>
</Paper> </Paper>
); );
}; };
+1 -1
View File
@@ -24,7 +24,7 @@ const queryClient = new QueryClient({
ReactDOM.createRoot(document.getElementById("root")).render( ReactDOM.createRoot(document.getElementById("root")).render(
<React.StrictMode> <React.StrictMode>
<QueryClientProvider client={queryClient} option> <QueryClientProvider client={queryClient}>
<Router> <Router>
<App /> <App />
</Router> </Router>
+8 -10
View File
@@ -10,8 +10,6 @@ import { getUser, delUser } from "../../utils/storage/user";
import "./home.module.scss"; import "./home.module.scss";
import Box from "@mui/material/Box";
import Carousel from "../../components/carousel"; import Carousel from "../../components/carousel";
// Custom Components // Custom Components
@@ -207,12 +205,12 @@ const Home = () => {
return ( return (
<> <>
<Box <div
component="main" component="main"
className="scrollY home" className="scrollY home"
sx={{ style={{
flexGrow: 1, flexGrow: 1,
pb: 3, paddingBottom: "3em",
position: "relative", position: "relative",
}} }}
> >
@@ -243,10 +241,10 @@ const Home = () => {
}} }}
/> />
)} )}
<Box <div
className="padded-container" className="padded-container"
sx={{ style={{
px: 3, padding: "3em",
}} }}
> >
{libraries.isLoading ? ( {libraries.isLoading ? (
@@ -503,8 +501,8 @@ const Home = () => {
/> />
); );
})} })}
</Box> </div>
</Box> </div>
</> </>
); );
}; };
-5
View File
@@ -510,7 +510,6 @@ const ItemDetail = () => {
let videos = item.data.MediaStreams.filter( let videos = item.data.MediaStreams.filter(
filterMediaStreamVideo, filterMediaStreamVideo,
); );
console.log(videos);
let audios = item.data.MediaStreams.filter( let audios = item.data.MediaStreams.filter(
filterMediaStreamAudio, filterMediaStreamAudio,
); );
@@ -521,10 +520,6 @@ const ItemDetail = () => {
setVideoTracks(videos); setVideoTracks(videos);
setAudioTracks(audios); setAudioTracks(audios);
setSubtitleTracks(subs); setSubtitleTracks(subs);
setCurrentVideoTrack(videos[0]?.Index);
setCurrentAudioTrack(audios[0]?.Index);
setCurrentSubTrack(subs[0]?.Index);
} }
}, [item.isSuccess]); }, [item.isSuccess]);