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