style: update everything to biome conventions

This commit is contained in:
DanCodes committed 2024-01-09 13:50:20 +00:00
1 parent 96350fa793
commit c0b9d93880
88 files changed
+491 -708

No files matched your search

+3
View File
@@ -9,6 +9,9 @@
"recommended": true,
"style": {
"noNonNullAssertion": "off"
},
"a11y": {
"useKeyWithClickEvents": "off"
}
}
},
+65 -65
View File
@@ -1,67 +1,67 @@
{
"name": "jellyplayer",
"private": true,
"version": "0.0.3-dev",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri",
"lint": "biome check src/",
"lint:fix": "biome check --apply src/"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@fontsource-variable/jetbrains-mono": "^5.0.19",
"@fontsource/noto-sans": "^5.0.18",
"@jellyfin/sdk": "0.8.2",
"@mdi/js": "^7.4.47",
"@mui/lab": "5.0.0-alpha.159",
"@mui/material": "^5.15.3",
"@tanstack/react-query": "^5.17.5",
"@tanstack/react-query-devtools": "^5.17.5",
"@tauri-apps/api": "^1.5.3",
"@types/node": "^20.10.7",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"axios": "^1.6.5",
"axios-tauri-api-adapter": "^0.2.1",
"blurhash": "^2.0.5",
"events": "^3.3.0",
"framer-motion": "^10.17.9",
"material-symbols": "^0.14.4",
"notistack": "^3.0.1",
"react": "^18.2.0",
"react-blurhash": "^0.3.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-markdown": "^9.0.1",
"react-multi-carousel": "^2.8.4",
"react-player": "^2.14.1",
"react-router-dom": "^6.21.1",
"react-use-konami": "^1.1.0",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"typescript": "^5.3.3",
"uuid": "^9.0.1",
"vite-plugin-svgr": "^4.2.0",
"wavesurfer.js": "^7.6.1",
"zustand": "^4.4.7"
},
"devDependencies": {
"@biomejs/biome": "^1.5.0",
"@tauri-apps/cli": "^1.5.9",
"@types/uuid": "^9.0.7",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-refresh": "^0.4.5",
"prop-types": "^15.8.1",
"sass": "^1.69.7",
"vite": "^5.0.11",
"vite-plugin-compression": "^0.5.1"
},
"license": "GPL-3.0-only"
"name": "jellyplayer",
"private": true,
"version": "0.0.3-dev",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri",
"lint": "biome check src/**/*",
"lint:fix": "biome check --apply src/**/*"
},
"dependencies": {
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@fontsource-variable/jetbrains-mono": "^5.0.19",
"@fontsource/noto-sans": "^5.0.18",
"@jellyfin/sdk": "0.8.2",
"@mdi/js": "^7.4.47",
"@mui/lab": "5.0.0-alpha.159",
"@mui/material": "^5.15.3",
"@tanstack/react-query": "^5.17.5",
"@tanstack/react-query-devtools": "^5.17.5",
"@tauri-apps/api": "^1.5.3",
"@types/node": "^20.10.7",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"axios": "^1.6.5",
"axios-tauri-api-adapter": "^0.2.1",
"blurhash": "^2.0.5",
"events": "^3.3.0",
"framer-motion": "^10.17.9",
"material-symbols": "^0.14.4",
"notistack": "^3.0.1",
"react": "^18.2.0",
"react-blurhash": "^0.3.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12",
"react-markdown": "^9.0.1",
"react-multi-carousel": "^2.8.4",
"react-player": "^2.14.1",
"react-router-dom": "^6.21.1",
"react-use-konami": "^1.1.0",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log#v1",
"tauri-plugin-store-api": "github:tauri-apps/tauri-plugin-store",
"typescript": "^5.3.3",
"uuid": "^9.0.1",
"vite-plugin-svgr": "^4.2.0",
"wavesurfer.js": "^7.6.1",
"zustand": "^4.4.7"
},
"devDependencies": {
"@biomejs/biome": "^1.5.0",
"@tauri-apps/cli": "^1.5.9",
"@types/uuid": "^9.0.7",
"@vitejs/plugin-react": "^4.2.1",
"eslint": "^8.56.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-refresh": "^0.4.5",
"prop-types": "^15.8.1",
"sass": "^1.69.7",
"vite": "^5.0.11",
"vite-plugin-compression": "^0.5.1"
},
"license": "GPL-3.0-only"
}
+1
View File
@@ -330,6 +330,7 @@ export const AppBar = () => {
"Primary",
) ? (
<img
alt={library.Name}
src={`${api.basePath}/Items/${library.Id}/Images/Primary?quality=90&fillHeight=226&fillWidth=127`}
/>
) : (
-1
View File
@@ -1,4 +1,3 @@
import AppBar from "@mui/material/AppBar";
import IconButton from "@mui/material/IconButton";
import Toolbar from "@mui/material/Toolbar";
+2
View File
@@ -199,6 +199,7 @@ const PlayButton = ({
setItemName(
<div className="video-osd-name">
<img
alt={item.Items[0].Name}
src={`${api.basePath}/Items/${item.Items[0].Id}/Images/Logo`}
className="video-osd-name-logo"
onLoad={(e) => {
@@ -220,6 +221,7 @@ const PlayButton = ({
setItemName(
<div className="video-osd-name">
<img
alt={item.Items[0].SeriesName}
src={`${api.basePath}/Items/${item.Items[0].SeriesId}/Images/Logo`}
className="video-osd-name-logo"
onLoad={(e) => {
+4 -1
View File
@@ -72,6 +72,7 @@ export const ActorCard = ({
<div className="material-symbols-rounded">person</div>
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
seriesId ? item.SeriesId : item.Id,
"Primary",
@@ -87,7 +88,9 @@ export const ActorCard = ({
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
className="card-image"
/>
</div>
+4 -1
View File
@@ -130,6 +130,7 @@ export const Card = ({
{overrideIcon ? getTypeIcon(overrideIcon) : getTypeIcon(item.Type)}
</div>
<img
alt={item.Name}
src={
overrideIcon === "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
@@ -155,7 +156,9 @@ export const Card = ({
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
className="card-image"
/>
<div className="card-overlay">
+4 -1
View File
@@ -86,6 +86,7 @@ export const EpisodeCard = ({
<div className="material-symbols-rounded">tv_gen</div>
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(item.Id, "Primary", {
quality: 90,
fillHeight: 512,
@@ -97,7 +98,9 @@ export const EpisodeCard = ({
opacity: 0,
}}
loading="lazy"
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
className="card-image"
/>
@@ -1,4 +1,3 @@
import PropTypes from "prop-types";
import React, { useState } from "react";
+3 -1
View File
@@ -20,6 +20,8 @@ const Carousel = ({ content, onChange }) => {
state.setDirection,
state.direction,
]);
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
useEffect(() => {
onChange(currentSlide);
}, [content[currentSlide].key]);
@@ -106,7 +108,7 @@ const Carousel = ({ content, onChange }) => {
? "carousel-indicator active"
: "carousel-indicator"
}
key={index}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
+8 -2
View File
@@ -100,6 +100,7 @@ const CarouselSlide = ({ item }) => {
/>
)}
<img
alt={item.Name}
className="hero-carousel-background-image"
src={
item.ParentBackdropItemId
@@ -109,7 +110,9 @@ const CarouselSlide = ({ item }) => {
style={{
opacity: 0,
}}
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
loading="eager"
/>
</>
@@ -156,6 +159,7 @@ const CarouselSlide = ({ item }) => {
item.Name
) : (
<img
alt={item.Name}
className="hero-carousel-text-logo"
src={`${api.basePath}/Items/${item.Id}/Images/Logo?quality=90&tag=${item.ImageTags.Logo}`}
style={{
@@ -163,7 +167,9 @@ const CarouselSlide = ({ item }) => {
transition: "opacity 0.2s",
objectFit: "contain",
}}
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
/>
)}
</Typography>
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import React from "react";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { MdiChevronLeft } from "./mdiChevronLeft";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiArrowLeft } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiBook } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiBookMultiple } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiCheck } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiChevronDown } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiChevronRight } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { MdiChevronLeft } from "./mdiChevronLeft";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiCogSync } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiEyeOffOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiEyeOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFilmstrip } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFilmstripBoxMultiple } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFilterOutline } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFolderMultiple } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFolderMusicOutline } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFolderOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFullscreen } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiFullscreenExit } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiHdr } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiHeart } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiHeartOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiHomeVariant } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiHomeVariantOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiImage } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiImageMultiple } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiInformation } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiMicrophone } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiMovieOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiMultimedia } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiMusicBoxMultipleOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPlaySpeed } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiPlaylistMusicOutline } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiStar } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiStarHalfFull } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiTelevision } from "@mdi/js";
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiTelevisionClassic } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiVolumeHigh } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiVolumeOff } from "@mdi/js";
-1
View File
@@ -1,4 +1,3 @@
import SvgIcon from "@mui/material/SvgIcon";
import { mdiYoutube } from "@mdi/js";
+14 -12
View File
@@ -111,13 +111,14 @@ const Hero = ({
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("4k")
) {
return "4K";
}if (
}
if (
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("1080p") ||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("hd")
) {
return "HD";
}
return "SD";
return "SD";
};
const atmosLabel = () => {
@@ -126,25 +127,24 @@ const Hero = ({
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
) {
return "TrueHD | Atmos";
}if (
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")
) {
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")) {
return "Atmos";
}if (
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
) {
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")) {
return "TrueHD";
}
return "";
return "";
};
const surroundSoundLabel = () => {
if (audioTracks[0]?.DisplayTitle.includes("7.1")) {
return "7.1";
}if (audioTracks[0].DisplayTitle.includes("5.1")) {
}
if (audioTracks[0].DisplayTitle.includes("5.1")) {
return "5.1";
}
return "2.0";
return "2.0";
};
return (
@@ -182,7 +182,9 @@ const Hero = ({
style={{
opacity: 0,
}}
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
loading="eager"
/>
</>
+1 -1
View File
@@ -109,7 +109,7 @@ export const SideMenu = () => {
justifyContent: "center",
}}
>
<img src={Icon} className="sidemenu-icon" />
<img alt="JellyPlayer" src={Icon} className="sidemenu-icon" />
</DrawerHeader>
<div className="sidemenu-item-container">
{libraries.isPending ? (
+4 -1
View File
@@ -49,6 +49,7 @@ const MusicTrack = ({
/>
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
"Primary",
@@ -64,7 +65,9 @@ const MusicTrack = ({
objectFit: "cover",
opacity: 0,
}}
onLoad={(e) => (e.target.style.opacity = 1)}
onLoad={(e) => {
e.target.style.opacity = 1;
}}
/>
<div className="music-track-image-overlay">
<PlayButton
-1
View File
@@ -1,4 +1,3 @@
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import CardActionArea from "@mui/material/CardActionArea";
+2 -3
View File
@@ -1,4 +1,3 @@
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
@@ -19,9 +18,9 @@ export const EpisodeCardsSkeleton = () => {
}}
sx={{ width: "100%" }}
>
{Array.from(new Array(4)).map((a, index) => {
{Array.from(new Array(4)).map((a) => {
return (
<Grid xs={1} sm={1} md={1} key={index}>
<Grid xs={1} sm={1} md={1} key={a}>
<Card sx={{ background: "transparent" }} elevation={0}>
<CardMedia>
<Skeleton
+1 -2
View File
@@ -1,4 +1,3 @@
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
@@ -50,7 +49,7 @@ export const SeasonSelectorSkeleton = () => {
/>
{Array.from(new Array(4)).map((a, index) => {
return (
<Grid xs={1} sm={1} md={1} key={index}>
<Grid xs={1} sm={1} md={1} key={a}>
<Card sx={{ background: "transparent" }} elevation={0}>
<CardMedia>
<Skeleton
+2 -2
View File
@@ -40,7 +40,7 @@ const About = () => {
useEffect(() => {
setBackdrop("", "");
}, []);
});
if (systemInfo.isPending) {
return (
<div
@@ -69,7 +69,7 @@ const About = () => {
target="_blank"
rel="noreferrer"
>
<img width="100%" height="100%" src={logo} />
<img alt="JellyPlayer" width="100%" height="100%" src={logo} />
</a>
<div
style={{
+1 -1
View File
@@ -162,7 +162,7 @@ const MusicAlbumTitlePage = () => {
item.data.Id,
);
}
}, [item.isSuccess]);
});
if (item.isPending || similarItems.isPending) {
return (
+5 -9
View File
@@ -158,11 +158,7 @@ const ArtistTitlePage = () => {
setActiveArtistTab(2);
}
}
}, [
artistDiscography.isPending,
artistSongs.isPending,
artistAppearances.isPending,
]);
});
const [animationDirection, setAnimationDirection] = useState("forward");
@@ -178,7 +174,7 @@ const ArtistTitlePage = () => {
item.data.Id,
);
}
}, [item.isSuccess]);
});
if (item.isPending) {
return (
@@ -243,7 +239,7 @@ const ArtistTitlePage = () => {
{artistTabs.map((tab, index) => {
return (
<Tab
key={index}
key={tab.title}
label={tab.title}
disabled={tab.data.data?.TotalRecordCount === 0}
/>
@@ -273,10 +269,10 @@ const ArtistTitlePage = () => {
}}
>
{artistDiscography.isSuccess &&
artistDiscography.data.Items.map((tabitem, aindex) => {
artistDiscography.data.Items.map((tabitem) => {
return (
<ArtistAlbum
key={aindex}
key={tabitem.Id}
user={user.data}
album={tabitem}
/>
+2 -1
View File
@@ -113,6 +113,7 @@ const BoxSetTitlePage = () => {
const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]);
useEffect(() => {
if (item.isSuccess) {
setAppBackdrop(
@@ -127,7 +128,7 @@ const BoxSetTitlePage = () => {
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
setWriters(writeTp);
}
}, [item.isSuccess]);
});
if (item.isPending || similarItems.isPending) {
return (
+158 -323
View File
@@ -1,21 +1,20 @@
import PropTypes from "prop-types";
import React, { useState, useLayoutEffect } from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Stack from "@mui/material/Stack";
import Typography from "@mui/material/Typography";
import CircularProgress from "@mui/material/CircularProgress";
import Chip from "@mui/material/Chip";
import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem";
import CircularProgress from "@mui/material/CircularProgress";
import Divider from "@mui/material/Divider";
import LinearProgress from "@mui/material/LinearProgress";
import { red, green, yellow } from "@mui/material/colors";
import MenuItem from "@mui/material/MenuItem";
import Stack from "@mui/material/Stack";
import TextField from "@mui/material/TextField";
import Typography from "@mui/material/Typography";
import { green, red, yellow } from "@mui/material/colors";
import { Blurhash } from "react-blurhash";
import { useParams, Link, NavLink } from "react-router-dom";
import { Link, NavLink, useParams } from "react-router-dom";
import { motion } from "framer-motion";
@@ -34,16 +33,16 @@ import { Card } from "../../components/card/card";
import { CardScroller } from "../../components/cardScroller/cardScroller";
import Hero from "../../components/layouts/item/hero";
import "./episode.module.scss";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { useBackdropStore } from "../../utils/store/backdrop";
import { useApi } from "../../utils/store/api";
import { endsAt, getRuntime } from "../../utils/date/time";
import PlayButton from "../../components/buttons/playButton";
import LikeButton from "../../components/buttons/likeButton";
import MarkPlayedButton from "../../components/buttons/markPlayedButton";
import PlayButton from "../../components/buttons/playButton";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import TextLink from "../../components/textLink";
import { getTypeIcon } from "../../components/utils/iconsCollection";
import { endsAt, getRuntime } from "../../utils/date/time";
import { useApi } from "../../utils/store/api";
import { useBackdropStore } from "../../utils/store/backdrop";
import "./episode.module.scss";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -107,7 +106,7 @@ const EpisodeTitlePage = () => {
});
return result.data;
},
enabled: item.isSuccess && item.data.Type == BaseItemKind.Episode,
enabled: item.isSuccess && item.data.Type === BaseItemKind.Episode,
networkMode: "always",
});
@@ -154,12 +153,13 @@ const EpisodeTitlePage = () => {
setAudioTracks(audios);
setSubtitleTracks(subs);
}
}, [item.isSuccess]);
});
const [directors, setDirectors] = useState([]);
const [writers, setWriters] = useState([]);
const [actors, setActors] = useState([]);
const [producers, setProducers] = useState([]);
useLayoutEffect(() => {
if (item.isSuccess) {
setAppBackdrop(
@@ -173,72 +173,57 @@ const EpisodeTitlePage = () => {
setDirectors(direTp);
const writeTp = item.data.People.filter((itm) => itm.Type === "Writer");
setWriters(writeTp);
let producerTp = item.data.People.filter(
(itm) => itm.Type == "Producer",
const producerTp = item.data.People.filter(
(itm) => itm.Type === "Producer",
);
setProducers(producerTp);
let actorTp = item.data.People.filter(
(itm) => itm.Type == "Actor",
);
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
setActors(actorTp);
}
}, [item.isSuccess]);
});
const qualityLabel = () => {
if (
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"2160p",
) ||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("2160p") ||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("4k")
) {
return <span className="material-symbols-rounded">4k</span>;
} else if (
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"1080p",
) ||
}
if (
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("1080p") ||
videoTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("hd")
) {
return <span className="material-symbols-rounded">full_hd</span>;
} else {
return <span className="material-symbols-rounded">hd</span>;
}
return <span className="material-symbols-rounded">hd</span>;
};
const atmosLabel = () => {
if (
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"atmos",
) &&
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"truehd",
)
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos") &&
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")
) {
return `TrueHD | Atmos`;
} else if (
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"atmos",
)
) {
return "Atmos";
} else if (
audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes(
"truehd",
)
) {
return "TrueHD";
} else {
return "";
return "TrueHD | Atmos";
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("atmos")) {
return "Atmos";
}
if (audioTracks[0]?.DisplayTitle.toLocaleLowerCase().includes("truehd")) {
return "TrueHD";
}
return "";
};
const surroundSoundLabel = () => {
if (audioTracks[0]?.DisplayTitle.includes("7.1")) {
return "7.1";
} else if (audioTracks[0]?.DisplayTitle.includes("5.1")) {
return "5.1";
} else {
return "2.0";
}
if (audioTracks[0]?.DisplayTitle.includes("5.1")) {
return "5.1";
}
return "2.0";
};
if (item.isPending) {
@@ -276,18 +261,18 @@ const EpisodeTitlePage = () => {
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
alt={item.data.Name}
src={api.getItemImageUrl(
item.data.ParentBackdropItemId,
"Backdrop",
{
tag: item.data
.ParentBackdropImageTags[0],
tag: item.data.ParentBackdropImageTags[0],
},
)}
className="item-hero-backdrop"
onLoad={(e) =>
(e.currentTarget.style.opacity = 1)
}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
/>
) : (
<></>
@@ -296,39 +281,28 @@ const EpisodeTitlePage = () => {
<div
className="item-hero-image-container"
style={{
aspectRatio:
item.data.PrimaryImageAspectRatio ?? 1,
aspectRatio: item.data.PrimaryImageAspectRatio ?? 1,
}}
>
{Object.keys(item.data.ImageTags).includes(
"Primary",
) ? (
{Object.keys(item.data.ImageTags).includes("Primary") ? (
<>
<Blurhash
hash={
item.data.ImageBlurHashes
.Primary[
item.data.ImageTags[
"Primary"
]
item.data.ImageBlurHashes.Primary[
item.data.ImageTags.Primary
]
}
className="item-hero-image-blurhash"
/>
<img
src={api.getItemImageUrl(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags[
"Primary"
],
},
)}
onLoad={(e) =>
(e.currentTarget.style.opacity = 1)
}
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-image"
/>
</>
@@ -337,24 +311,18 @@ const EpisodeTitlePage = () => {
)}
</div>
<div className="item-hero-detail flex flex-column">
<TextLink
variant={"h3"}
location={`/series/${item.data.SeriesId}`}
>
<TextLink variant={"h3"} location={`/series/${item.data.SeriesId}`}>
{item.data.ParentLogoItemId.length > 0 ? (
<img
src={api.getItemImageUrl(
item.data.ParentLogoItemId,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
},
)}
onLoad={(e) =>
(e.currentTarget.style.opacity = 1)
}
alt={item.data.SeriesName}
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
})}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-logo"
/>
) : (
@@ -372,8 +340,7 @@ const EpisodeTitlePage = () => {
variant="filled"
label={qualityLabel()}
sx={{
borderRadius:
"8px !important",
borderRadius: "8px !important",
"& .MuiChip-label": {
fontSize: "2.2em",
},
@@ -384,16 +351,12 @@ const EpisodeTitlePage = () => {
<Chip
variant="filled"
label={
<Typography
variant="caption"
fontWeight={600}
>
<Typography variant="caption" fontWeight={600}>
{surroundSoundLabel()}
</Typography>
}
sx={{
borderRadius:
"8px !important",
borderRadius: "8px !important",
"& .MuiChip-label": {
fontSize: "2.2em",
},
@@ -404,19 +367,12 @@ const EpisodeTitlePage = () => {
<Chip
variant="filled"
label={
<Typography
variant="caption"
fontWeight={600}
>
{
videoTracks[0]
.VideoRangeType
}
<Typography variant="caption" fontWeight={600}>
{videoTracks[0].VideoRangeType}
</Typography>
}
sx={{
borderRadius:
"8px !important",
borderRadius: "8px !important",
"& .MuiChip-label": {
fontSize: "2.2em",
},
@@ -427,16 +383,12 @@ const EpisodeTitlePage = () => {
<Chip
variant="filled"
label={
<Typography
variant="caption"
fontWeight={600}
>
<Typography variant="caption" fontWeight={600}>
{atmosLabel()}
</Typography>
}
sx={{
borderRadius:
"8px !important",
borderRadius: "8px !important",
"& .MuiChip-label": {
fontSize: "2.2em",
},
@@ -459,8 +411,7 @@ const EpisodeTitlePage = () => {
</span>
}
sx={{
borderRadius:
"8px !important",
borderRadius: "8px !important",
"& .MuiChip-label": {
fontSize: "2.2em",
},
@@ -474,17 +425,11 @@ const EpisodeTitlePage = () => {
justifyItems="flex-start"
alignItems="center"
>
<Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
{item.data.ProductionYear ?? ""}
</Typography>
{item.data.OfficialRating && (
<Chip
variant="filled"
label={item.data.OfficialRating}
/>
<Chip variant="filled" label={item.data.OfficialRating} />
)}
{item.data.CommunityRating && (
@@ -513,11 +458,7 @@ const EpisodeTitlePage = () => {
}}
variant="subtitle1"
>
{Math.round(
item.data
.CommunityRating *
10,
) / 10}
{Math.round(item.data.CommunityRating * 10) / 10}
</Typography>
</div>
)}
@@ -534,18 +475,12 @@ const EpisodeTitlePage = () => {
className="material-symbols-rounded "
style={{
color:
item.data
.CriticRating >
50
? green[400]
: red[400],
item.data.CriticRating > 50 ? green[400] : red[400],
fontVariationSettings:
'"FILL" 1, "wght" 300, "GRAD" 25, "opsz" 40',
}}
>
{item.data.CriticRating > 50
? "thumb_up"
: "thumb_down"}
{item.data.CriticRating > 50 ? "thumb_up" : "thumb_down"}
</div>
<Typography
style={{
@@ -559,32 +494,20 @@ const EpisodeTitlePage = () => {
)}
{item.data.RunTimeTicks && (
<Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
{getRuntime(
item.data.RunTimeTicks,
)}
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
{getRuntime(item.data.RunTimeTicks)}
</Typography>
)}
{item.data.RunTimeTicks && (
<Typography
style={{ opacity: "0.8" }}
variant="subtitle1"
>
<Typography style={{ opacity: "0.8" }} variant="subtitle1">
{endsAt(
item.data.RunTimeTicks -
item.data.UserData
.PlaybackPositionTicks,
item.data.UserData.PlaybackPositionTicks,
)}
</Typography>
)}
</Stack>
<Typography
variant="subtitle1"
style={{ opacity: 0.8 }}
>
<Typography variant="subtitle1" style={{ opacity: 0.8 }}>
{item.data.Genres.join(", ")}
</Typography>
@@ -594,38 +517,25 @@ const EpisodeTitlePage = () => {
itemId={item.data.Id}
itemType={item.data.Type}
itemUserData={item.data.UserData}
currentVideoTrack={
selectedVideoTrack
}
currentAudioTrack={
selectedAudioTrack
}
currentSubTrack={
selectedSubtitleTrack
}
currentVideoTrack={selectedVideoTrack}
currentAudioTrack={selectedAudioTrack}
currentSubTrack={selectedSubtitleTrack}
userId={user.data.Id}
/>
</div>
<div
className="flex flex-row"
style={{ gap: "1em" }}
>
<div className="flex flex-row" style={{ gap: "1em" }}>
<LikeButton
itemName={item.data.Name}
itemId={item.data.Id}
queryKey={["item", id]}
isFavorite={
item.data.UserData.IsFavorite
}
isFavorite={item.data.UserData.IsFavorite}
userId={user.data.Id}
/>
<MarkPlayedButton
itemName={item.data.Name}
itemId={item.data.Id}
queryKey={["item", id]}
isPlayed={
item.data.UserData.Played
}
isPlayed={item.data.UserData.Played}
userId={user.data.Id}
/>
</div>
@@ -644,29 +554,21 @@ const EpisodeTitlePage = () => {
<Typography>
{getRuntime(
item.data.RunTimeTicks -
item.data.UserData
.PlaybackPositionTicks,
item.data.UserData.PlaybackPositionTicks,
)}{" "}
left
</Typography>
<LinearProgress
color="white"
variant="determinate"
value={
item.data.UserData
.PlayedPercentage
}
value={item.data.UserData.PlayedPercentage}
style={{
borderRadius: "10px",
}}
/>
</div>
)}
<Typography
variant="h5"
fontStyle="italic"
mb={1}
>
<Typography variant="h5" fontStyle="italic" mb={1}>
{item.data.Taglines[0] ?? ""}
</Typography>
<Typography variant="subtitle1">
@@ -688,20 +590,15 @@ const EpisodeTitlePage = () => {
<>
<TextLink
key={writer.Id}
variant={
"subtitle1"
}
variant={"subtitle1"}
location={`/person/${writer.Id}`}
>
{writer.Name}
</TextLink>
{index !=
writers.length -
1 && (
{index !== writers.length - 1 && (
<span
style={{
whiteSpace:
"pre",
whiteSpace: "pre",
}}
>
,{" "}
@@ -724,35 +621,26 @@ const EpisodeTitlePage = () => {
Directed by
</Typography>
<div className="hero-text-container">
{directors.map(
(director, index) => (
<>
<TextLink
key={
director.Id
}
variant={
"subtitle1"
}
location={`/person/${director.Id}`}
{directors.map((director, index) => (
<>
<TextLink
key={director.Id}
variant={"subtitle1"}
location={`/person/${director.Id}`}
>
{director.Name}
</TextLink>
{index !== directors.length - 1 && (
<span
style={{
whiteSpace: "pre",
}}
>
{director.Name}
</TextLink>
{index !=
directors.length -
1 && (
<span
style={{
whiteSpace:
"pre",
}}
>
,{" "}
</span>
)}
</>
),
)}
,{" "}
</span>
)}
</>
))}
</div>
</div>
)}
@@ -772,17 +660,10 @@ const EpisodeTitlePage = () => {
marginBottom: "1em",
}}
value={selectedVideoTrack}
onChange={(e) =>
setSelectedVideoTrack(
e.target.value,
)
}
onChange={(e) => setSelectedVideoTrack(e.target.value)}
>
{videoTracks.map((track) => (
<MenuItem
key={track.Index}
value={track.Index}
>
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
@@ -797,17 +678,10 @@ const EpisodeTitlePage = () => {
marginBottom: "1em",
}}
value={selectedAudioTrack}
onChange={(e) =>
setSelectedAudioTrack(
e.target.value,
)
}
onChange={(e) => setSelectedAudioTrack(e.target.value)}
>
{audioTracks.map((track) => (
<MenuItem
key={track.Index}
value={track.Index}
>
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
@@ -821,20 +695,13 @@ const EpisodeTitlePage = () => {
width: "100%",
}}
value={selectedSubtitleTrack}
onChange={(e) =>
setSelectedSubtitleTrack(
e.target.value,
)
}
onChange={(e) => setSelectedSubtitleTrack(e.target.value)}
>
<MenuItem key={-1} value={-1}>
No Subtitle
</MenuItem>
{subtitleTracks.map((track) => (
<MenuItem
key={track.Index}
value={track.Index}
>
<MenuItem key={track.Index} value={track.Index}>
{track.DisplayTitle}
</MenuItem>
))}
@@ -907,28 +774,21 @@ const EpisodeTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
src={api.getItemImageUrl(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
className="item-detail-cast-card-image"
/>
) : (
<div className="item-detail-cast-card-icon">
{getTypeIcon(
"Person",
)}
{getTypeIcon("Person")}
</div>
)}
<div className="item-detail-cast-card-text">
<Typography variant="subtitle1">
{actor.Name}
</Typography>
<Typography variant="subtitle1">{actor.Name}</Typography>
<Typography
variant="subtitle2"
style={{
@@ -955,28 +815,21 @@ const EpisodeTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
src={api.getItemImageUrl(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
className="item-detail-cast-card-image"
/>
) : (
<div className="item-detail-cast-card-icon">
{getTypeIcon(
"Person",
)}
{getTypeIcon("Person")}
</div>
)}
<div className="item-detail-cast-card-text">
<Typography variant="subtitle1">
{actor.Name}
</Typography>
<Typography variant="subtitle1">{actor.Name}</Typography>
<Typography
variant="subtitle2"
style={{
@@ -993,9 +846,7 @@ const EpisodeTitlePage = () => {
)}
{directors.length > 0 && (
<div className="item-detail-cast-container">
<Typography variant="h6">
Directors
</Typography>
<Typography variant="h6">Directors</Typography>
<div className="item-detail-cast-grid">
{directors.map((actor) => (
<NavLink
@@ -1005,28 +856,21 @@ const EpisodeTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
src={api.getItemImageUrl(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
className="item-detail-cast-card-image"
/>
) : (
<div className="item-detail-cast-card-icon">
{getTypeIcon(
"Person",
)}
{getTypeIcon("Person")}
</div>
)}
<div className="item-detail-cast-card-text">
<Typography variant="subtitle1">
{actor.Name}
</Typography>
<Typography variant="subtitle1">{actor.Name}</Typography>
<Typography
variant="subtitle2"
style={{
@@ -1043,9 +887,7 @@ const EpisodeTitlePage = () => {
)}
{producers.length > 0 && (
<div className="item-detail-cast-container">
<Typography variant="h6">
Producers
</Typography>
<Typography variant="h6">Producers</Typography>
<div className="item-detail-cast-grid">
{producers.map((actor) => (
<NavLink
@@ -1055,28 +897,21 @@ const EpisodeTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
src={api.getItemImageUrl(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
className="item-detail-cast-card-image"
/>
) : (
<div className="item-detail-cast-card-icon">
{getTypeIcon(
"Person",
)}
{getTypeIcon("Person")}
</div>
)}
<div className="item-detail-cast-card-text">
<Typography variant="subtitle1">
{actor.Name}
</Typography>
<Typography variant="subtitle1">{actor.Name}</Typography>
<Typography
variant="subtitle2"
style={{
+2 -2
View File
@@ -119,9 +119,9 @@ const FavoritePage = () => {
});
useEffect(() => {
// Removing app's backdrop
setBackdrop("", "");
}, []);
});
return (
<main
className="scrollY"
-1
View File
@@ -1,4 +1,3 @@
import React, { useState } from "react";
import { useQuery } from "@tanstack/react-query";
+27 -19
View File
@@ -1,6 +1,5 @@
import PropTypes from "prop-types";
import React, { useState, useLayoutEffect } from "react";
import PropTypes from "prop-types";
import Box from "@mui/material/Box";
import Chip from "@mui/material/Chip";
@@ -15,7 +14,7 @@ import { green, red, yellow } from "@mui/material/colors";
import { Blurhash } from "react-blurhash";
import { useParams, Link, NavLink } from "react-router-dom";
import { Link, NavLink, useParams } from "react-router-dom";
import { motion } from "framer-motion";
@@ -38,14 +37,14 @@ import "./item.module.scss";
import { ErrorNotice } from "../../components/notices/errorNotice/errorNotice";
import { useBackdropStore } from "../../utils/store/backdrop";
import { useApi } from "../../utils/store/api";
import { endsAt, getRuntime } from "../../utils/date/time";
import PlayButton from "../../components/buttons/playButton";
import LikeButton from "../../components/buttons/likeButton";
import MarkPlayedButton from "../../components/buttons/markPlayedButton";
import PlayButton from "../../components/buttons/playButton";
import TextLink from "../../components/textLink";
import { getTypeIcon } from "../../components/utils/iconsCollection";
import { endsAt, getRuntime } from "../../utils/date/time";
import { useApi } from "../../utils/store/api";
import { useBackdropStore } from "../../utils/store/backdrop";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -179,7 +178,7 @@ const ItemDetail = () => {
setAudioTracks(audios);
setSubtitleTracks(subs);
}
}, [item.isSuccess]);
});
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
@@ -187,6 +186,7 @@ const ItemDetail = () => {
const [writers, setWriters] = useState([]);
const [actors, setActors] = useState([]);
const [producers, setProducers] = useState([]);
useLayoutEffect(() => {
if (item.isSuccess) {
setAppBackdrop(
@@ -207,7 +207,7 @@ const ItemDetail = () => {
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
setActors(actorTp);
}
}, [item.isSuccess]);
});
const qualityLabel = () => {
if (
@@ -287,16 +287,14 @@ const ItemDetail = () => {
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
src={api.getItemImageUrl(
item.data.Id,
"Backdrop",
{
tag: item.data
.BackdropImageTags[0],
},
)}
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
className="item-hero-backdrop"
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
/>
) : (
<></>
@@ -319,11 +317,14 @@ const ItemDetail = () => {
className="item-hero-image-blurhash"
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-image"
/>
</>
@@ -334,12 +335,15 @@ const ItemDetail = () => {
<div className="item-hero-detail flex flex-column">
{Object.keys(item.data.ImageTags).includes("Logo") ? (
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
})}
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-logo"
/>
) : (
@@ -755,6 +759,7 @@ const ItemDetail = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -795,6 +800,7 @@ const ItemDetail = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -835,6 +841,7 @@ const ItemDetail = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -875,6 +882,7 @@ const ItemDetail = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
+1 -1
View File
@@ -216,7 +216,7 @@ const LibraryView = () => {
]);
}
}
}, [currentLib.isSuccess]);
});
const [filterArray, setFilterArray] = useState([]);
+4 -10
View File
@@ -226,13 +226,7 @@ const PersonTitlePage = () => {
setActivePersonTab(4);
}
}
}, [
personMovies.isPending,
personShows.isPending,
personBooks.isPending,
personPhotos.isPending,
personEpisodes.isPending,
]);
});
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
const [animationDirection, setAnimationDirection] = useState("forward");
@@ -247,7 +241,7 @@ const PersonTitlePage = () => {
item.data.Id,
);
}
}, [item.isSuccess]);
});
if (item.isPending) {
return (
@@ -308,10 +302,10 @@ const PersonTitlePage = () => {
setActivePersonTab(newVal);
}}
>
{personTabs.map((tab, index) => {
{personTabs.map((tab) => {
return (
<Tab
key={index}
key={tab.title}
label={tab.title}
disabled={tab.data.data?.TotalRecordCount === 0}
/>
+4 -2
View File
@@ -174,7 +174,7 @@ export const VideoPlayer = () => {
playerRef.current.seekTo(timeToStart, "seconds");
setIsReady(true);
}
}, [isReady]);
});
const handleDisplayCurrentTime = () => {
let time = ticksToSec(progress * itemDuration);
@@ -249,6 +249,7 @@ export const VideoPlayer = () => {
setItemName(
<div className="video-osd-name">
<img
alt="Series Logo"
src={`${api.basePath}/Items/${
episodes.data.Items[currentEpisodeIndex + 1].SeriesId
}/Images/Logo`}
@@ -323,6 +324,7 @@ export const VideoPlayer = () => {
setItemName(
<div className="video-osd-name">
<img
alt="Series Logo"
src={`${api.basePath}/Items/${
episodes.data.Items[currentEpisodeIndex - 1].SeriesId
}/Images/Logo`}
@@ -434,7 +436,7 @@ export const VideoPlayer = () => {
return () => {
clearTimeout(timeout);
};
}, [volume]);
});
const handleExit = async () => {
// Remove app from fullscreen
+1 -1
View File
@@ -122,7 +122,7 @@ const PlaylistTitlePage = () => {
item.data.Id,
);
}
}, [item.isSuccess]);
});
if (item.isPending || similarItems.isPending) {
return (
+1 -1
View File
@@ -150,7 +150,7 @@ const SearchPage = () => {
useEffect(() => {
// Removing app's backdrop
setBackdrop("", "");
}, []);
});
return (
<div
className="scrollY"
+86 -109
View File
@@ -203,6 +203,7 @@ const SeriesTitlePage = () => {
const [writers, setWriters] = useState([]);
const [actors, setActors] = useState([]);
const [producers, setProducers] = useState([]);
useEffect(() => {
if (item.isSuccess) {
setAppBackdrop(
@@ -223,7 +224,7 @@ const SeriesTitlePage = () => {
const actorTp = item.data.People.filter((itm) => itm.Type === "Actor");
setActors(actorTp);
}
}, [item.isSuccess]);
});
if (item.isPending || similarItems.isPending) {
return (
@@ -260,16 +261,14 @@ const SeriesTitlePage = () => {
<div className="item-hero-backdrop-container">
{item.data.BackdropImageTags ? (
<img
src={api.getItemImageUrl(
item.data.Id,
"Backdrop",
{
tag: item.data
.BackdropImageTags[0],
},
)}
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
className="item-hero-backdrop"
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
/>
) : (
<></>
@@ -292,11 +291,14 @@ const SeriesTitlePage = () => {
className="item-hero-image-blurhash"
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-image"
/>
</>
@@ -307,12 +309,15 @@ const SeriesTitlePage = () => {
<div className="item-hero-detail flex flex-column">
{Object.keys(item.data.ImageTags).includes("Logo") ? (
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
})}
onLoad={(e) => (e.currentTarget.style.opacity = 1)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
className="item-hero-logo"
/>
) : (
@@ -592,6 +597,7 @@ const SeriesTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -636,6 +642,7 @@ const SeriesTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -680,6 +687,7 @@ const SeriesTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -724,6 +732,7 @@ const SeriesTitlePage = () => {
>
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
@@ -874,112 +883,80 @@ const SeriesTitlePage = () => {
<Divider />
<div className="item-detail-episodes-container">
{episodes.isPending
? Array.from(new Array(4)).map(
(a, index) => {
return (
<MuiCard
key={a}
? Array.from(new Array(4)).map((a, index) => {
return (
<MuiCard
key={a}
sx={{
background: "transparent",
width: "100%",
}}
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",
}}
/>
</CardMedia>
<CardContent
sx={{
background:
"transparent",
width: "100%",
padding: "0 0.5em",
alignItems: "flex-start",
backgroundColor: "transparent",
}}
elevation={0}
>
<CardMedia>
<Typography variant="h6">
<Skeleton
// animation="wave"
variant="rectangular"
variant="text"
sx={{
aspectRatio:
"1.777",
height: "auto",
m: 1,
borderRadius:
"10px",
animationDelay: `${
index *
0.2
}s`,
animationDuration:
"1.4s",
animationName:
"pulse",
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
}}
/>
</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",
}}
/>
</Typography>
</Typography>
<Typography variant="body2">
<Skeleton
variant="text"
sx={{
animationDelay: `${
index *
0.2
}s`,
animationDuration:
"1.4s",
animationName:
"pulse",
}}
/>
<Skeleton
variant="text"
sx={{
animationDelay: `${
index *
0.2
}s`,
animationDuration:
"1.4s",
animationName:
"pulse",
}}
/>
<Typography variant="body2">
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
}}
/>
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
}}
/>
<Skeleton
variant="text"
sx={{
animationDelay: `${
index *
0.2
}s`,
animationDuration:
"1.4s",
animationName:
"pulse",
}}
/>
</Typography>
</CardContent>
</MuiCard>
);
},
)
<Skeleton
variant="text"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
}}
/>
</Typography>
</CardContent>
</MuiCard>
);
})
: episodes.data.Items.map((episode) => {
return (
<motion.div
-1
View File
@@ -1,4 +1,3 @@
const Settings = () => {
return <h1>WIP Settings</h1>;
};
+1 -1
View File
@@ -5,7 +5,7 @@
*/
export const formateDate = (date) => {
date = new Date(date);
let date = new Date(date);
date = new Intl.DateTimeFormat().format(date);
return date;
};
-1
View File
@@ -1,4 +1,3 @@
import { useEffect, useState } from "react";
// see https://github.com/tannerlinsley/react-query/issues/293
+1 -3
View File
@@ -1,4 +1,3 @@
import { useEffect, useMemo, useState } from "react";
const useIntersecting = (ref) => {
@@ -9,13 +8,12 @@ const useIntersecting = (ref) => {
new IntersectionObserver(([entry]) =>
setIntersecting(entry.isIntersecting),
),
[ref],
);
useEffect(() => {
observer.observe(ref.current);
return () => observer.disconnect();
}, []);
});
return isIntersecting;
};
+1 -1
View File
@@ -24,7 +24,7 @@ const useKeyPress = (targetKey) => {
window.removeEventListener("keydown", downHandler);
window.removeEventListener("keyup", upHandler);
};
}, []); // Empty array ensures that effect is only run on mount and unmount
}); // Empty array ensures that effect is only run on mount and unmount
return keyPressed;
};
+19 -19
View File
@@ -2,25 +2,25 @@ import { useState } from "react";
import useKonami from "react-use-konami";
export const useKonamiEasterEgg = () => {
const [easterEgg, setEasterEgg] = useState(false);
const sixtyNine = () => {
setEasterEgg(true);
};
const [easterEgg, setEasterEgg] = useState(false);
const sixtyNine = () => {
setEasterEgg(true);
};
useKonami(sixtyNine, {
code: [
"ArrowUp",
"ArrowUp",
"ArrowDown",
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowLeft",
"ArrowRight",
"b",
"a",
],
});
useKonami(sixtyNine, {
code: [
"ArrowUp",
"ArrowUp",
"ArrowDown",
"ArrowDown",
"ArrowLeft",
"ArrowRight",
"ArrowLeft",
"ArrowRight",
"b",
"a",
],
});
return [easterEgg, setEasterEgg] as const;
return [easterEgg, setEasterEgg] as const;
};
+4 -4
View File
@@ -1,8 +1,8 @@
import { relaunch } from "@tauri-apps/api/process";
export const handleRelaunch = async (_event: unknown, reason?: string) => {
if (reason && reason === "backdropClick") {
return;
}
await relaunch();
if (reason && reason === "backdropClick") {
return;
}
await relaunch();
};
+27 -27
View File
@@ -3,12 +3,12 @@ import { Store } from "tauri-plugin-store-api";
import { v4 as uuidv4 } from "uuid";
interface ServerInfo extends RecommendedServerInfo {
id: string;
id: string;
}
export interface ServerStore {
defaultServer: string | null;
servers: ServerInfo[];
defaultServer: string | null;
servers: ServerInfo[];
}
const store = new Store(".servers.dat");
@@ -17,71 +17,71 @@ const store = new Store(".servers.dat");
* Set server in .servers.dat
*/
export const setServer = async (serverId: string, serverInfo: ServerInfo) => {
const servers = await getAllServers();
const newServers = servers.filter((server) => server.id !== serverId);
const servers = await getAllServers();
const newServers = servers.filter((server) => server.id !== serverId);
newServers.push({
...serverInfo,
id: serverId,
});
newServers.push({
...serverInfo,
id: serverId,
});
await store.set("servers", newServers);
await store.save();
await store.set("servers", newServers);
await store.save();
};
/**
* Set default server
*/
export const setDefaultServer = async (
serverId: ServerStore["defaultServer"]
serverId: ServerStore["defaultServer"],
) => {
await store.set("defaultServer", serverId);
await store.save();
await store.set("defaultServer", serverId);
await store.save();
};
/**
* Get a Server
*/
export const getServer = async (serverId: string) => {
const servers = await getAllServers();
const servers = await getAllServers();
return servers.find((server) => server.id === serverId);
return servers.find((server) => server.id === serverId);
};
/**
* Get all Servers
*/
export const getAllServers = async () => {
const servers = (await store.get<ServerStore["servers"]>("servers")) || [];
const servers = (await store.get<ServerStore["servers"]>("servers")) || [];
return servers;
return servers;
};
/**
* Get default server
*/
export const getDefaultServer = () => {
return store.get<ServerStore["defaultServer"]>("defaultServer");
return store.get<ServerStore["defaultServer"]>("defaultServer");
};
/**
* Delete the given server from client storage
*/
export const delServer = async (serverId: string) => {
const servers = await getAllServers();
const servers = await getAllServers();
const newServers = servers.filter((server) => server.id !== serverId);
const newServers = servers.filter((server) => server.id !== serverId);
await store.set("servers", newServers);
await store.save();
await store.set("servers", newServers);
await store.save();
};
/**
* Delete the all servers from client storage
*/
export const delAllServer = async () => {
await store.clear();
// remove the default server
await setDefaultServer(null);
await store.save();
await store.clear();
// remove the default server
await setDefaultServer(null);
await store.save();
};
+28 -28
View File
@@ -8,48 +8,48 @@ import axiosTauriApiAdapter from "axios-tauri-api-adapter";
import { v4 as uuidv4 } from "uuid";
export const axiosClient = axios.create({
adapter: axiosTauriApiAdapter,
headers: {
"Access-Control-Allow-Origin": "*",
},
timeout: 60000,
adapter: axiosTauriApiAdapter,
headers: {
"Access-Control-Allow-Origin": "*",
},
timeout: 60000,
});
let deviceId = localStorage.getItem("deviceId");
if (!deviceId) {
const randomId = uuidv4();
localStorage.setItem("deviceId", randomId);
const randomId = uuidv4();
localStorage.setItem("deviceId", randomId);
deviceId = randomId;
deviceId = randomId;
}
const jellyfin = new Jellyfin({
clientInfo: {
name: "JellyPlayer",
version: appVer,
},
deviceInfo: {
name: "JellyPlayer",
id: deviceId!,
},
clientInfo: {
name: "JellyPlayer",
version: appVer,
},
deviceInfo: {
name: "JellyPlayer",
id: deviceId!,
},
});
export const useApi = create<{
api: Api | null;
deviceId: string | null;
jellyfin: Jellyfin;
api: Api | null;
deviceId: string | null;
jellyfin: Jellyfin;
}>(() => ({
api: null,
deviceId: deviceId,
jellyfin: jellyfin,
api: null,
deviceId: deviceId,
jellyfin: jellyfin,
}));
export const createApi = (
serverAddress: string,
accessToken: string | undefined
serverAddress: string,
accessToken: string | undefined,
) =>
useApi.setState((state) => ({
...state,
api: jellyfin.createApi(serverAddress, accessToken, axiosClient),
}));
useApi.setState((state) => ({
...state,
api: jellyfin.createApi(serverAddress, accessToken, axiosClient),
}));
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
const initialState = {
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
export const useBackdropStore = create((set) => ({
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
export const useCarouselStore = create((set) => ({
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
import { version } from "../../../package.json";
import { getAllServers, getDefaultServer, getServer } from "../storage/servers";
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
export const useDrawerStore = create((set) => ({
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
export const usePlaybackStore = create((set) => ({
-1
View File
@@ -1,4 +1,3 @@
import { create } from "zustand";
export const useServerStore = create(() => ({