fix: blink not launching or rendering on opening

This commit is contained in:
Prayag Prajapati committed 2024-11-09 18:31:31 +05:30
1 parent 61441b918c
commit d586c3e38d
31 files changed
+546 -279

No files matched your search

+17 -8
View File
@@ -13,6 +13,7 @@ import { getTypeIcon } from "../utils/iconsCollection";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useMutation, useQuery } from "@tanstack/react-query";
import "./queueButton.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
const QueueButton = () => {
const api = useApiInContext((s) => s.api);
@@ -96,7 +97,7 @@ const QueueButton = () => {
{queueItems[currentItemIndex].ImageTags?.Primary ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
queueItems[currentItemIndex]?.Id,
"Primary",
{
@@ -109,7 +110,7 @@ const QueueButton = () => {
?.length ?? -1) > 0 ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
queueItems[currentItemIndex]?.AlbumId,
"Primary",
{
@@ -190,17 +191,25 @@ const QueueButton = () => {
{item.ImageTags?.Primary ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(item?.Id, "Primary", {
tag: item.ImageTags?.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item?.Id,
"Primary",
{
tag: item.ImageTags?.Primary,
},
)}
alt={item.Name ?? "image"}
/>
) : (item.AlbumPrimaryImageTag?.length ?? -1) > 0 ? (
<img
className="queue-item-image"
src={api?.getItemImageUrl(item?.AlbumId, "Primary", {
tag: item.AlbumPrimaryImageTag[0],
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item?.AlbumId,
"Primary",
{
tag: item.AlbumPrimaryImageTag[0],
},
)}
alt={item.Name ?? "image"}
/>
) : (
+2 -1
View File
@@ -8,6 +8,7 @@ import Typography from "@mui/material/Typography";
import { Blurhash } from "react-blurhash";
import { useApi } from "../../utils/store/api";
import "./card.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
/**
* @typedef {Object} Props
@@ -70,7 +71,7 @@ export const ActorCard = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
seriesId ? item.SeriesId : item.Id,
"Primary",
{
+2 -1
View File
@@ -17,6 +17,7 @@ import PlayButton from "../buttons/playButton";
import ErrorBoundary from "../errorBoundary";
import { getTypeIcon } from "../utils/iconsCollection";
import "./card.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
const CardComponent = ({
@@ -116,7 +117,7 @@ const CardComponent = ({
src={
overrideIcon === "User"
? `${api.basePath}/Users/${item.Id}/Images/Primary`
: api.getItemImageUrl(
: getImageUrlsApi(api).getItemImageUrlById(
(seriesId ? item.SeriesId : (item.AlbumId ?? item.Id)) ?? "",
imageType,
{
+2 -1
View File
@@ -10,6 +10,7 @@ import { Blurhash } from "react-blurhash";
import "./card.scss";
import { getRuntimeCompact } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useNavigate, useRouteContext } from "@tanstack/react-router";
import LikeButton from "../buttons/likeButton";
@@ -87,7 +88,7 @@ export const EpisodeCard = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(item.Id, "Primary", {
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
quality: 90,
fillHeight: 512,
fillWidth: 512,
+47 -42
View File
@@ -9,6 +9,7 @@ import { useApiInContext } from "@/utils/store/api";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import CarouselSlide from "../carouselSlide";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import ReactMultiCarousel from "react-multi-carousel";
import Slider from "../Slider";
import { getTypeIcon } from "../utils/iconsCollection";
@@ -63,51 +64,55 @@ const Carousel = ({
},
};
// Memoize the content mapping
const sliderContent = useMemo(() => {
return content.map((item, index) => (
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
return content.map((item, index) => {
return (
<motion.div
className={
currentSlide === index
? "carousel-indicator active"
: "carousel-indicator"
}
setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={api.getItemImageUrl(item.Id, "Thumb", {
tag: item.ImageTags.Primary,
fillWidth: 300,
})}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type)}
</div>
)}
</motion.div>
));
layout
initial={{
height: "4.6em",
}}
whileHover={{
height: "5.5em",
}}
transition={{
duration: 0.05,
}}
key={item.Id}
onClick={() => {
if (currentSlide > index) {
setDirection("left");
} else if (currentSlide <= index) {
setDirection("right");
}
setCurrentSlide(index);
}}
>
{item.ImageTags?.Thumb ? (
<img
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Thumb", {
tag: item.ImageTags.Primary,
fillWidth: 300,
})}
alt={item.Name ?? "item-image"}
className="carousel-indicator-image"
/>
) : (
<div className="carousel-indicator-icon">
{getTypeIcon(item.Type)}
</div>
)}
</motion.div>
);
});
}, [content, currentSlide, api, setDirection]);
const handleDragEnd = useCallback(
+2 -1
View File
@@ -6,6 +6,7 @@ import LikeButton from "../buttons/likeButton";
import PlayButton from "../buttons/playButton";
import TextLink from "../textLink";
import "./musicTrack.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import type { BaseItemDto } from "@jellyfin/sdk/lib/generated-client";
import type { QueryKey } from "@tanstack/react-query";
@@ -60,7 +61,7 @@ const MusicTrack = ({
</div>
<img
alt={item.Name}
src={api.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
Object.keys(item.ImageTags).length === 0 ? item.AlbumId : item.Id,
"Primary",
{
+2 -1
View File
@@ -6,6 +6,7 @@ import React from "react";
import { getTypeIcon } from "../utils/iconsCollection";
import "./outroCard.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getUserApi } from "@jellyfin/sdk/lib/utils/api/user-api";
import { useMutation, useQuery } from "@tanstack/react-query";
@@ -36,7 +37,7 @@ const OutroCard = (props: { handleShowCredits: () => void }) => {
<img
className="outro-card-content-image"
alt={item.Name ?? "Cover"}
src={api.getItemImageUrl(item.Id, "Primary", {
src={getImageUrlsApi(api).getItemImageUrlById(item.Id, "Primary", {
tag: item.ImageTags.Primary,
quality: 80,
})}
+67 -39
View File
@@ -18,6 +18,7 @@ import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueButton from "@/components/buttons/queueButton";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { playItemFromQueue } from "@/utils/store/playback";
@@ -80,56 +81,80 @@ const AudioPlayer = () => {
album: currentTrackItem.Album ?? "",
artwork: [
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 96,
height: 96,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 96,
height: 96,
},
),
sizes: "96x96",
type: "image/jpeg",
},
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 128,
height: 128,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 128,
height: 128,
},
),
sizes: "128x128",
type: "image/jpeg",
},
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 192,
height: 192,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 192,
height: 192,
},
),
sizes: "192x192",
type: "image/jpeg",
},
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 256,
height: 256,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 256,
height: 256,
},
),
sizes: "256x256",
type: "image/jpeg",
},
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 384,
height: 384,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 384,
height: 384,
},
),
sizes: "384x384",
type: "image/jpeg",
},
{
src: api.getItemImageUrl(currentTrackItem.Id, "Primary", {
tag: currentTrackItem.ImageTags?.Primary,
width: 512,
height: 512,
}),
src: getImageUrlsApi(api).getItemImageUrlById(
currentTrackItem.Id,
"Primary",
{
tag: currentTrackItem.ImageTags?.Primary,
width: 512,
height: 512,
},
),
sizes: "512x512",
type: "image/jpeg",
},
@@ -199,15 +224,18 @@ const AudioPlayer = () => {
<img
alt={tracks[currentTrack]?.Name ?? "track"}
className="audio-player-image"
src={api?.getItemImageUrl(
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
"Primary",
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)}
src={
!!api?.configuration?.apiKey &&
getImageUrlsApi(api).getItemImageUrlById(
!item?.ImageTags.Primary ? item?.AlbumId : item?.Id,
"Primary",
{
quality: 85,
fillHeight: 462,
fillWidth: 462,
},
)
}
/>
<span className="material-symbols-rounded audio-player-image-icon">
music_note
+28 -5
View File
@@ -1,12 +1,12 @@
/* prettier-ignore-start */
/* eslint-disable */
// @ts-nocheck
// noinspection JSUnusedGlobalSymbols
// This file is auto-generated by TanStack Router
// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
// Import Routes
@@ -46,126 +46,151 @@ const ApiRoute = ApiImport.update({
} as any)
const IndexRoute = IndexImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRoute,
} as any)
const ErrorCodeRoute = ErrorCodeImport.update({
id: '/error/$code',
path: '/error/$code',
getParentRoute: () => rootRoute,
} as any)
const ApiSearchRoute = ApiSearchImport.update({
id: '/search',
path: '/search',
getParentRoute: () => ApiRoute,
} as any)
const ApiLoginRoute = ApiLoginImport.update({
id: '/login',
path: '/login',
getParentRoute: () => ApiRoute,
} as any)
const ApiSearchIndexRoute = ApiSearchIndexImport.update({
id: '/',
path: '/',
getParentRoute: () => ApiSearchRoute,
} as any)
const ApiPlayerIndexRoute = ApiPlayerIndexImport.update({
id: '/player/',
path: '/player/',
getParentRoute: () => ApiRoute,
} as any)
const ApiHomeIndexRoute = ApiHomeIndexImport.update({
id: '/home/',
path: '/home/',
getParentRoute: () => ApiRoute,
} as any)
const ApiFavoriteIndexRoute = ApiFavoriteIndexImport.update({
id: '/favorite/',
path: '/favorite/',
getParentRoute: () => ApiRoute,
} as any)
const SetupServerListRoute = SetupServerListImport.update({
id: '/setup/server/list',
path: '/setup/server/list',
getParentRoute: () => rootRoute,
} as any)
const SetupServerErrorRoute = SetupServerErrorImport.update({
id: '/setup/server/error',
path: '/setup/server/error',
getParentRoute: () => rootRoute,
} as any)
const SetupServerAddRoute = SetupServerAddImport.update({
id: '/setup/server/add',
path: '/setup/server/add',
getParentRoute: () => rootRoute,
} as any)
const ApiSeriesIdRoute = ApiSeriesIdImport.update({
id: '/series/$id',
path: '/series/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiPlaylistIdRoute = ApiPlaylistIdImport.update({
id: '/playlist/$id',
path: '/playlist/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiPlayerPhotosRoute = ApiPlayerPhotosImport.update({
id: '/player/photos',
path: '/player/photos',
getParentRoute: () => ApiRoute,
} as any)
const ApiPlayerAudioRoute = ApiPlayerAudioImport.update({
id: '/player/audio',
path: '/player/audio',
getParentRoute: () => ApiRoute,
} as any)
const ApiPersonIdRoute = ApiPersonIdImport.update({
id: '/person/$id',
path: '/person/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiLoginManualRoute = ApiLoginManualImport.update({
id: '/manual',
path: '/manual',
getParentRoute: () => ApiLoginRoute,
} as any)
const ApiLoginListRoute = ApiLoginListImport.update({
id: '/list',
path: '/list',
getParentRoute: () => ApiLoginRoute,
} as any)
const ApiLibraryIdRoute = ApiLibraryIdImport.update({
id: '/library/$id',
path: '/library/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiItemIdRoute = ApiItemIdImport.update({
id: '/item/$id',
path: '/item/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiEpisodeIdRoute = ApiEpisodeIdImport.update({
id: '/episode/$id',
path: '/episode/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiBoxsetIdRoute = ApiBoxsetIdImport.update({
id: '/boxset/$id',
path: '/boxset/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiArtistIdRoute = ApiArtistIdImport.update({
id: '/artist/$id',
path: '/artist/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiAlbumIdRoute = ApiAlbumIdImport.update({
id: '/album/$id',
path: '/album/$id',
getParentRoute: () => ApiRoute,
} as any)
const ApiLoginUserIdUserNameRoute = ApiLoginUserIdUserNameImport.update({
id: '/$userId/$userName',
path: '/$userId/$userName',
getParentRoute: () => ApiLoginRoute,
} as any)
@@ -625,8 +650,6 @@ export const routeTree = rootRoute
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()
/* prettier-ignore-end */
/* ROUTE_MANIFEST_START
{
"routes": {
+1 -1
View File
@@ -266,7 +266,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
<AudioPlayer />
<Outlet />
<ReactQueryDevtools />
{/* <TanStackRouterDevtools /> */}
<TanStackRouterDevtools />
</SnackbarProvider>
</ThemeProvider>
</Suspense>
+17 -8
View File
@@ -50,9 +50,10 @@ import { useBackdropStore } from "@/utils/store/backdrop";
import "./album.scss";
import TagChip from "@/components/tagChip";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { Link, createFileRoute } from "@tanstack/react-router";
import lyricsIcon from "../../../assets/icons/lyrics.svg";
import { useCentralStore } from "@/utils/store/central";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -302,10 +303,14 @@ function MusicAlbumTitlePage() {
<img
className="item-info-sidebar-image"
alt={item.data.Name ?? "Album"}
src={api.getItemImageUrl(item.data.Id, "Primary", {
tag: item.data.ImageTags.Primary,
quality: 90,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
tag: item.data.ImageTags.Primary,
quality: 90,
},
)}
/>
) : (
<div className="item-info-sidebar-icon">
@@ -333,9 +338,13 @@ function MusicAlbumTitlePage() {
<img
className="item-info-sidebar-artist-image"
alt={artist.Name ?? "Artist"}
src={api.getItemImageUrl(artist.Id, "Primary", {
quality: 90,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
artist.Id,
"Primary",
{
quality: 90,
},
)}
/>
<span className="material-symbols-rounded">artist</span>
</div>
+26 -13
View File
@@ -36,8 +36,9 @@ import "./artist.scss";
import IconLink from "@/components/iconLink";
import { getTypeIcon } from "@/components/utils/iconsCollection";
import { createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -219,9 +220,13 @@ function ArtistTitlePage() {
<div className="item-hero-backdrop-container">
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Backdrop",
{
tag: item.data.BackdropImageTags[0],
},
)}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
@@ -249,10 +254,14 @@ function ArtistTitlePage() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -269,11 +278,15 @@ function ArtistTitlePage() {
{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,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
+26 -13
View File
@@ -39,8 +39,9 @@ import "./boxset.scss";
import IconLink from "@/components/iconLink";
import { getTypeIcon } from "@/components/utils/iconsCollection";
import { createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -179,9 +180,13 @@ function BoxSetTitlePage() {
{item.data.BackdropImageTags?.length ? (
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Backdrop",
{
tag: item.data.BackdropImageTags[0],
},
)}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
@@ -222,10 +227,14 @@ function BoxSetTitlePage() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -242,11 +251,15 @@ function BoxSetTitlePage() {
{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,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
+56 -31
View File
@@ -64,8 +64,9 @@ import sdrIcon from "@/assets/icons/sdr.svg";
import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
import IconLink from "@/components/iconLink";
import { Link, createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { Link, createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -350,7 +351,7 @@ function EpisodeTitlePage() {
{item.data.ParentBackdropImageTags?.length ? (
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.ParentBackdropItemId,
"Backdrop",
{
@@ -397,10 +398,14 @@ function EpisodeTitlePage() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -428,11 +433,15 @@ function EpisodeTitlePage() {
{item.data.ParentLogoItemId?.length > 0 ? (
<img
alt={item.data.SeriesName}
src={api.getItemImageUrl(item.data.ParentLogoItemId, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.ParentLogoItemId,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -838,11 +847,15 @@ function EpisodeTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -884,11 +897,15 @@ function EpisodeTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -930,11 +947,15 @@ function EpisodeTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -976,11 +997,15 @@ function EpisodeTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
+3 -2
View File
@@ -23,6 +23,7 @@ import { createFileRoute, useNavigate } from "@tanstack/react-router";
import { useBackdropStore } from "@/utils/store/backdrop";
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import {
@@ -176,7 +177,7 @@ function Home() {
if (latestMedia.isSuccess && latestMedia.data.length > 0) {
if (latestMedia.data[now]?.ParentBackdropImageTags) {
setBackdrop(
api.getItemImageUrl(
getImageUrlsApi(api).getItemImageUrlById(
latestMedia.data[now].Id,
"Backdrop",
{
@@ -189,7 +190,7 @@ function Home() {
);
} else {
setBackdrop(
api.getItemImageUrl(
getImageUrlsApi(api).getItemImageUrlById(
latestMedia.data[now].Id,
"Backdrop",
{
+63 -34
View File
@@ -68,8 +68,9 @@ import type MediaQualityInfo from "@/utils/types/mediaQualityInfo";
import IconLink from "@/components/iconLink";
import { queryClient } from "@/main";
import { Link, createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { Link, createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -372,9 +373,13 @@ function ItemDetail() {
{item.data.BackdropImageTags?.length ? (
<motion.img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags[0],
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Backdrop",
{
tag: item.data.BackdropImageTags[0],
},
)}
className="item-hero-backdrop"
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
@@ -415,10 +420,14 @@ function ItemDetail() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -435,12 +444,16 @@ function ItemDetail() {
{item.data.ImageTags?.Logo ? (
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Logo", {
quality: 90,
fillWidth: 592,
fillHeight: 592,
tag: item.data.ImageTags.Logo,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
tag: item.data.ImageTags.Logo,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -829,11 +842,15 @@ function ItemDetail() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -872,11 +889,15 @@ function ItemDetail() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -918,11 +939,15 @@ function ItemDetail() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -964,11 +989,15 @@ function ItemDetail() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
+10 -5
View File
@@ -50,9 +50,10 @@ import { useWindowVirtualizer } from "@tanstack/react-virtual";
import type { AxiosResponse } from "axios";
import "./library.scss";
import LibraryItemsSkeleton from "@/components/skeleton/libraryItems";
import { createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useApiInContext } from "@/utils/store/api";
import { useCentralStore } from "@/utils/store/central";
import { createFileRoute } from "@tanstack/react-router";
type SortByObject = { title: string; value: ItemSortBy };
type ViewObject = { title: string; value: BaseItemKind | "Artist" };
@@ -692,7 +693,7 @@ function LibraryView() {
);
if (temp?.[0]?.Id) {
setBackdrop(
api.getItemImageUrl(temp?.[0]?.Id, "Backdrop", {
getImageUrlsApi(api).getItemImageUrlById(temp?.[0]?.Id, "Backdrop", {
tag: temp?.[0]?.BackdropImageTags?.[0],
}),
temp?.[0]?.BackdropImageTags?.[0] ?? "none",
@@ -709,9 +710,13 @@ function LibraryView() {
const backdropItem = backdropItems[itemIndex];
// enqueueSnackbar("Running");
setBackdrop(
api?.getItemImageUrl(backdropItem.Id ?? "", "Backdrop", {
tag: backdropItem.BackdropImageTags?.[0],
}),
getImageUrlsApi(api).getItemImageUrlById(
backdropItem.Id ?? "",
"Backdrop",
{
tag: backdropItem.BackdropImageTags?.[0],
},
),
backdropItem.BackdropImageTags?.[0] ?? "none",
);
}, 14000); // Update backdrop every 14s
+10 -5
View File
@@ -34,8 +34,9 @@ import ShowMoreText from "@/components/showMoreText";
import "./person.scss";
import IconLink from "@/components/iconLink";
import { createFileRoute } from "@tanstack/react-router";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { createFileRoute } from "@tanstack/react-router";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -311,10 +312,14 @@ function PersonTitlePage() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
+8 -3
View File
@@ -17,6 +17,7 @@ import PlayNextButton from "@/components/buttons/playNextButton";
import PlayPreviousButton from "@/components/buttons/playPreviousButtom";
import QueueTrack from "@/components/queueTrack";
import { getRuntimeMusic, secToTicks, ticksToSec } from "@/utils/date/time";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { getLyricsApi } from "@jellyfin/sdk/lib/utils/api/lyrics-api";
import { useQuery } from "@tanstack/react-query";
@@ -84,9 +85,13 @@ function AudioPlayerRoute() {
{item?.ImageTags?.Primary ? (
<img
alt={item.Name ?? "Music"}
src={api.getItemImageUrl(item.Id, "Primary", {
tag: item.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.Id,
"Primary",
{
tag: item.ImageTags.Primary,
},
)}
className="audio-info-image"
/>
) : (
+3 -4
View File
@@ -10,6 +10,7 @@ import brokenImage from "/assetsStatic/broken-image.png?url";
import { save } from "@tauri-apps/plugin-dialog";
import "./photos.scss";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import {
Button,
CircularProgress,
@@ -48,7 +49,7 @@ function PhotosPlayer() {
<img
src={
item.Id
? api.getItemImageUrl(item.Id, "Primary", {
? getImageUrlsApi(api).getItemImageUrl(item.Id, "Primary", {
// width: 250,
fillWidth: 250,
quality: 70,
@@ -90,8 +91,6 @@ function PhotosPlayer() {
setContextMenu(null);
}, []);
const [downloadProgress, setDownloadProgress] = useState(0);
const handleImageDownload = useCallback(async () => {
const pathToSave = await save({
filters: [
@@ -107,7 +106,7 @@ function PhotosPlayer() {
`${api.basePath}/Items/${currentPhoto?.Id}/Download?api_key=${api.accessToken}`,
pathToSave,
);
enqueueSnackbar("Image downloaded!", { variant: "success" });
enqueueSnackbar("Image download queued.", { variant: "info" });
}
}, [currentIndex]);
+95 -50
View File
@@ -59,9 +59,10 @@ import { setBackdrop, useBackdropStore } from "@/utils/store/backdrop";
import IconLink from "@/components/iconLink";
import EpisodeSkeleton from "@/components/skeleton/episode";
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
import { useCentralStore } from "@/utils/store/central";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
import { Link } from "@tanstack/react-router";
import { useCentralStore } from "@/utils/store/central";
function TabPanel(props) {
const { children, value, index, ...other } = props;
@@ -228,13 +229,13 @@ function SeriesTitlePage() {
useLayoutEffect(() => {
if (item.isSuccess) {
// setBackdropImage({
// url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
// url: getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
// tag: item.data?.BackdropImageTags[0],
// }),
// key: item.data?.BackdropImageTags[0],
// });
// setBackdrop(
// api.getItemImageUrl(item.data?.Id, "Backdrop", {
// getImageUrlsApi(api).getItemImageUrlById(item.data?.Id, "Backdrop", {
// tag: item.data?.BackdropImageTags[0],
// }),
// item.data.Id,
@@ -275,31 +276,43 @@ function SeriesTitlePage() {
) {
sessionStorage.setItem(
`backdrop-${item.data?.Id}`,
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
tag: currentSeasonItem.data.BackdropImageTags?.[0],
}),
getImageUrlsApi(api).getItemImageUrlById(
currentSeasonItem.data.Id,
"Backdrop",
{
tag: currentSeasonItem.data.BackdropImageTags?.[0],
},
),
);
sessionStorage.setItem(
`backdrop-${item.data?.Id}-key`,
currentSeasonItem.data.BackdropImageTags?.[0],
);
setBackdropImage({
url: api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
tag: currentSeasonItem.data.BackdropImageTags?.[0],
}),
url: getImageUrlsApi(api).getItemImageUrlById(
currentSeasonItem.data.Id,
"Backdrop",
{
tag: currentSeasonItem.data.BackdropImageTags?.[0],
},
),
key: currentSeasonItem.data.BackdropImageTags?.[0],
});
setBackdrop(
api.getItemImageUrl(currentSeasonItem.data.Id, "Backdrop", {
tag: currentSeasonItem.data.BackdropImageTags?.[0],
}),
getImageUrlsApi(api).getItemImageUrlById(
currentSeasonItem.data.Id,
"Backdrop",
{
tag: currentSeasonItem.data.BackdropImageTags?.[0],
},
),
currentSeasonItem.data.BackdropImageTags?.[0],
);
setBackdropImageLoaded(false);
} else if (item.isSuccess && item.data?.BackdropImageTags?.length > 0) {
sessionStorage.setItem(
`backdrop-${item.data?.Id}`,
api.getItemImageUrl(item.data.Id, "Backdrop", {
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags?.[0],
}),
);
@@ -311,13 +324,17 @@ function SeriesTitlePage() {
setBackdropImageLoaded(false); // Reset Backdrop image load status if previous image is diff then new image
}
setBackdropImage({
url: api.getItemImageUrl(item.data?.Id, "Backdrop", {
tag: item.data?.BackdropImageTags?.[0],
}),
url: getImageUrlsApi(api).getItemImageUrlById(
item.data?.Id,
"Backdrop",
{
tag: item.data?.BackdropImageTags?.[0],
},
),
key: item.data?.BackdropImageTags?.[0],
});
setBackdrop(
api.getItemImageUrl(item.data.Id, "Backdrop", {
getImageUrlsApi(api).getItemImageUrlById(item.data.Id, "Backdrop", {
tag: item.data.BackdropImageTags?.[0],
}),
item.data.BackdropImageTags?.[0],
@@ -430,10 +447,14 @@ function SeriesTitlePage() {
/>
<img
alt={item.data.Name}
src={api.getItemImageUrl(item.data.Id, "Primary", {
quality: 90,
tag: item.data.ImageTags.Primary,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Primary",
{
quality: 90,
tag: item.data.ImageTags.Primary,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -450,11 +471,15 @@ function SeriesTitlePage() {
{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,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
item.data.Id,
"Logo",
{
quality: 90,
fillWidth: 592,
fillHeight: 592,
},
)}
onLoad={(e) => {
e.currentTarget.style.opacity = 1;
}}
@@ -664,11 +689,15 @@ function SeriesTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -712,11 +741,15 @@ function SeriesTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -760,11 +793,15 @@ function SeriesTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -808,11 +845,15 @@ function SeriesTitlePage() {
{actor.PrimaryImageTag ? (
<img
alt={actor.Name}
src={api.getItemImageUrl(actor.Id, "Primary", {
quality: 80,
fillWidth: 200,
fillHeight: 200,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
actor.Id,
"Primary",
{
quality: 80,
fillWidth: 200,
fillHeight: 200,
},
)}
className="item-detail-cast-card-image"
/>
) : (
@@ -1035,10 +1076,14 @@ function SeriesTitlePage() {
</div>
<img
alt={episode.Name}
src={api.getItemImageUrl(episode.Id, "Primary", {
tag: episode.ImageTags.Primary,
fillHeight: 300,
})}
src={getImageUrlsApi(api).getItemImageUrlById(
episode.Id,
"Primary",
{
tag: episode.ImageTags.Primary,
fillHeight: 300,
},
)}
className="item-detail-episode-image"
onLoad={(e) => {
e.target.style.opacity = 1;
+1
View File
@@ -6,6 +6,7 @@ import React from "react";
export const Route = createFileRoute("/")({
beforeLoad: async () => {
console.log("Hello");
const currentServerId = await getDefaultServer();
const userOnDisk = await getUser();
if (currentServerId) {
+6
View File
@@ -0,0 +1,6 @@
import type { Api } from "@jellyfin/sdk";
import { ImageUrlsApi } from "@jellyfin/sdk/lib/utils/api/image-urls-api";
const getImageUrlsApi = (api: Api) => new ImageUrlsApi(api.configuration);
export default getImageUrlsApi;
+2 -2
View File
@@ -1,5 +1,5 @@
import type { RecommendedServerInfo } from "@jellyfin/sdk";
import { Store } from "@tauri-apps/plugin-store";
import { load } from "@tauri-apps/plugin-store";
export interface ServerInfo extends RecommendedServerInfo {
id: string;
@@ -10,7 +10,7 @@ export interface ServerStore {
servers: ServerInfo[];
}
const store = new Store(".servers.dat");
const store = await load(".servers.dat", { autoSave: true });
/**
* Set server in .servers.dat
+2 -2
View File
@@ -1,6 +1,6 @@
import { Store } from "@tauri-apps/plugin-store";
import { load } from "@tauri-apps/plugin-store";
const SettingsStore = new Store(".settings.dat");
const SettingsStore = await load(".settings.dat", { autoSave: true });
/**
* settingKey should be of type:
+2 -2
View File
@@ -1,4 +1,4 @@
import { Store } from "@tauri-apps/plugin-store";
import { load } from "@tauri-apps/plugin-store";
export interface UserStore {
user: {
@@ -7,7 +7,7 @@ export interface UserStore {
};
}
const user = new Store(".user.dat");
const user = await load(".user.dat", { autoSave: true });
/**
* Set User details to .user.dat