fix(ui): match loading skeletons to real pages
Continuous Integration / build_web (push) Failing after 1s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 1s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Measure the library grid instead of guessing from the viewport, reuse the card scroller for search and latest rows, mirror item/music page structure, and add skeleton sections to the home placeholder.
This commit is contained in:
1 parent
497b9a2fc5
commit
2a0478fc16
14 files changed
+298
-237
No files matched your search
@@ -26,7 +26,7 @@ export const LatestMediaSection = ({
|
||||
getLibraryLatestQueryOptions(api, user?.Id, latestMediaLib.Id),
|
||||
);
|
||||
if (data.isPending) {
|
||||
return <CardsSkeleton />;
|
||||
return <CardsSkeleton title={`Latest ${latestMediaLib.Name}`} />;
|
||||
}
|
||||
if (data.isSuccess && (data.data?.length ?? 0) >= 1) {
|
||||
return (
|
||||
|
||||
@@ -1,34 +1,38 @@
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React from "react";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
|
||||
export const CardsSkeleton = () => {
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
flexFlow: "column",
|
||||
marginBottom: "2em",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3" sx={{ mb: "0.15em" }}>
|
||||
<Skeleton width="35%" />
|
||||
</Typography>
|
||||
<div className="flex flex-align-center" style={{ height: "17em" }}>
|
||||
{Array.from({ length: 12 }).map((_, index) => (
|
||||
<Skeleton
|
||||
height="26em"
|
||||
sx={{
|
||||
flex: "1 0 12.45%",
|
||||
marginRight: "1.5em",
|
||||
borderRadius: "10px",
|
||||
animationDelay: `${index * 0.25}s`,
|
||||
}}
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: This is a skeleton component
|
||||
key={index}
|
||||
export const CardsSkeleton = ({
|
||||
title = "Загрузка",
|
||||
displayCards = 7,
|
||||
}: {
|
||||
title?: string;
|
||||
displayCards?: number;
|
||||
}) => (
|
||||
<CardScroller title={title} displayCards={displayCards} disableDecoration>
|
||||
{Array.from({ length: displayCards }, (_, index) => (
|
||||
<CardSkeleton
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: static skeleton slides
|
||||
key={`card-skeleton-${index}`}
|
||||
/>
|
||||
))}
|
||||
</CardScroller>
|
||||
);
|
||||
|
||||
|
||||
export const CardSkeleton = ({
|
||||
cardType = "portrait",
|
||||
}: {
|
||||
cardType?: "portrait" | "square" | "thumb";
|
||||
}) => (
|
||||
<div className="card skeleton-card">
|
||||
<div className={`card-image-container ${cardType}`}>
|
||||
<Skeleton
|
||||
variant="rectangular"
|
||||
sx={{ width: "100%", height: "100%", position: "absolute", inset: 0 }}
|
||||
/>
|
||||
</div>
|
||||
<Skeleton variant="text" sx={{ width: "78%", height: 18, mt: "8px" }} />
|
||||
<Skeleton variant="text" sx={{ width: "46%", height: 14 }} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
);
|
||||
@@ -1,123 +1,76 @@
|
||||
import React from "react";
|
||||
|
||||
import { Skeleton } from "@mui/material";
|
||||
import { motion } from "motion/react";
|
||||
import React from "react";
|
||||
|
||||
import "@/components/itemDetail/itemDetail.scss";
|
||||
import "@/components/itemHeader/itemHeader.scss";
|
||||
|
||||
const ItemSkeleton = () => {
|
||||
return (
|
||||
<motion.div
|
||||
className="item item-detail-page item-default scrollY padded-top flex flex-column"
|
||||
style={{
|
||||
width: "100vw",
|
||||
}}
|
||||
initial={{
|
||||
opacity: 0,
|
||||
}}
|
||||
animate={{
|
||||
opacity: 1,
|
||||
}}
|
||||
exit={{
|
||||
opacity: 0,
|
||||
}}
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
exit={{ opacity: 0 }}
|
||||
>
|
||||
<div className="item-hero">
|
||||
<div
|
||||
className="item-hero-image-container"
|
||||
style={{
|
||||
aspectRatio: 0.6666,
|
||||
boxShadow: "0 0 black",
|
||||
}}
|
||||
>
|
||||
<div className="item-hero-image-container">
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
style={{
|
||||
height: "50vh",
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "auto",
|
||||
aspectRatio: "2 / 3",
|
||||
borderRadius: "8px",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="item-hero-detail flex flex-column"
|
||||
style={
|
||||
{
|
||||
// width: "50vw",
|
||||
}
|
||||
}
|
||||
>
|
||||
<Skeleton variant="text" sx={{ fontSize: "4rem" }} width="50%" />
|
||||
{/* </Typography> */}
|
||||
|
||||
<div className="item-hero-detail flex flex-column">
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{
|
||||
fontSize: "clamp(2rem, 4vw, 3.4rem)",
|
||||
width: "72%",
|
||||
maxWidth: "34rem",
|
||||
}}
|
||||
/>
|
||||
<div
|
||||
className="item-hero-buttons-container flex flex-row"
|
||||
style={{
|
||||
width: "70%",
|
||||
gap: "1em",
|
||||
justifyContent: "flex-start",
|
||||
}}
|
||||
style={{ width: "100%", gap: "0.8em", flexWrap: "wrap" }}
|
||||
>
|
||||
<Skeleton
|
||||
width="10rem"
|
||||
variant="rounded"
|
||||
width="12rem"
|
||||
height="3rem"
|
||||
sx={{
|
||||
fontSize: "3rem",
|
||||
borderRadius: "3em",
|
||||
transform: "scale(1)",
|
||||
}}
|
||||
/>
|
||||
<div className="flex flex-row" style={{ gap: "1em" }}>
|
||||
<Skeleton
|
||||
width="3rem"
|
||||
height="3rem"
|
||||
sx={{
|
||||
fontSize: "3rem",
|
||||
borderRadius: "3em",
|
||||
transform: "scale(1)",
|
||||
aspectRatio: "1",
|
||||
}}
|
||||
/>
|
||||
<Skeleton
|
||||
width="3rem"
|
||||
height="3rem"
|
||||
sx={{
|
||||
fontSize: "3rem",
|
||||
borderRadius: "3em",
|
||||
transform: "scale(1)",
|
||||
aspectRatio: "1",
|
||||
}}
|
||||
sx={{ borderRadius: "999px" }}
|
||||
/>
|
||||
<div className="flex flex-row" style={{ gap: "0.8em" }}>
|
||||
<Skeleton variant="circular" width="3rem" height="3rem" />
|
||||
<Skeleton variant="circular" width="3rem" height="3rem" />
|
||||
<Skeleton variant="circular" width="3rem" height="3rem" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="item-detail">
|
||||
<div style={{ width: "100%" }}>
|
||||
<Skeleton variant="text" />
|
||||
<Skeleton variant="text" />
|
||||
<Skeleton variant="text" />
|
||||
<Skeleton variant="text" width="92%" />
|
||||
<Skeleton variant="text" width="100%" />
|
||||
<Skeleton variant="text" width="84%" />
|
||||
<Skeleton variant="text" width="58%" />
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<div style={{ width: "100%" }}>
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
sx={{
|
||||
fontSize: "2.4rem",
|
||||
mb: 1,
|
||||
}}
|
||||
sx={{ width: "100%", height: "2.8rem", mb: 1, borderRadius: "8px" }}
|
||||
/>
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
sx={{
|
||||
fontSize: "2.4rem",
|
||||
mb: 1,
|
||||
}}
|
||||
sx={{ width: "100%", height: "2.8rem", mb: 1, borderRadius: "8px" }}
|
||||
/>
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
sx={{
|
||||
fontSize: "2.4rem",
|
||||
}}
|
||||
sx={{ width: "100%", height: "2.8rem", borderRadius: "8px" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Skeleton } from "@mui/material";
|
||||
import React from "react";
|
||||
import React, { useLayoutEffect, useRef, useState } from "react";
|
||||
|
||||
type LibraryItemsSkeletonProps = {
|
||||
/** Square artwork (music, playlists, genres) instead of portrait posters. */
|
||||
@@ -7,32 +7,42 @@ type LibraryItemsSkeletonProps = {
|
||||
};
|
||||
|
||||
/**
|
||||
* Placeholder that matches the virtualized library grid: same card width,
|
||||
* gap and text block. A mismatched skeleton was making the real cards resize
|
||||
* when the first page of items arrived.
|
||||
* Placeholder that matches the virtualized library grid: measured against the
|
||||
* real grid container, the same gap and the same three rows of cards. Keeping
|
||||
* the width measured instead of derived from the viewport means the mobile
|
||||
* page margins cannot turn the two-column grid into one giant card.
|
||||
*/
|
||||
const LibraryItemsSkeleton = ({
|
||||
square = false,
|
||||
}: LibraryItemsSkeletonProps) => {
|
||||
const viewportWidth =
|
||||
typeof window === "undefined"
|
||||
? 1200
|
||||
: document.documentElement.clientWidth || window.innerWidth;
|
||||
// Same inset as `.library-items` (4em on each side) used by the real grid.
|
||||
const width = Math.max(0, viewportWidth - 128);
|
||||
const ref = useRef<HTMLDivElement | null>(null);
|
||||
const [width, setWidth] = useState(0);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
const element = ref.current;
|
||||
if (!element) return;
|
||||
|
||||
const update = () => setWidth(element.clientWidth);
|
||||
update();
|
||||
const observer = new ResizeObserver(update);
|
||||
observer.observe(element);
|
||||
return () => observer.disconnect();
|
||||
}, []);
|
||||
|
||||
const minCardWidth = width < 700 ? 140 : 180;
|
||||
const columns = Math.max(1, Math.floor(width / minCardWidth));
|
||||
const columns = width > 0 ? Math.max(1, Math.floor(width / minCardWidth)) : 0;
|
||||
const gap = 16;
|
||||
const cardWidth = Math.max(
|
||||
1,
|
||||
Math.floor((width - (columns - 1) * gap) / columns),
|
||||
);
|
||||
const count = columns * 3;
|
||||
const placeholders = Array.from({ length: count }, (_, index) => ({
|
||||
const cardWidth =
|
||||
columns > 0
|
||||
? Math.max(1, Math.floor((width - (columns - 1) * gap) / columns))
|
||||
: 0;
|
||||
const placeholders = Array.from({ length: columns * 3 }, (_, index) => ({
|
||||
id: `library-skeleton-${index}`,
|
||||
}));
|
||||
|
||||
return (
|
||||
<div ref={ref} style={{ width: "100%" }}>
|
||||
{columns > 0 && (
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
@@ -67,6 +77,8 @@ const LibraryItemsSkeleton = ({
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import { Skeleton } from "@mui/material";
|
||||
import React from "react";
|
||||
|
||||
import "@/components/albumMusicTrack/albumMusicTrack.scss";
|
||||
|
||||
type MusicPageSkeletonProps = {
|
||||
/** Artist pages open on a round portrait and a discography grid. */
|
||||
artist?: boolean;
|
||||
};
|
||||
|
||||
const ALBUM_SKELETONS = ["one", "two", "three", "four", "five"];
|
||||
const TRACK_SKELETONS = [
|
||||
"one",
|
||||
"two",
|
||||
"three",
|
||||
"four",
|
||||
"five",
|
||||
"six",
|
||||
"seven",
|
||||
"eight",
|
||||
];
|
||||
|
||||
const AlbumCardSkeleton = () => (
|
||||
<div>
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
sx={{ width: "100%", aspectRatio: "1", borderRadius: "10px" }}
|
||||
/>
|
||||
<Skeleton variant="text" sx={{ width: "76%", height: 18, mt: "8px" }} />
|
||||
<Skeleton variant="text" sx={{ width: "42%", height: 14 }} />
|
||||
</div>
|
||||
);
|
||||
|
||||
const MusicPageSkeleton = ({ artist = false }: MusicPageSkeletonProps) => (
|
||||
<div className="scrollY padded-top music-page" aria-busy="true">
|
||||
<header className={`music-hero${artist ? " music-hero-artist" : ""}`}>
|
||||
<div className={artist ? "music-portrait" : "music-cover"}>
|
||||
<Skeleton
|
||||
variant={artist ? "circular" : "rounded"}
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
aspectRatio: "1",
|
||||
borderRadius: artist ? "50%" : "6px",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="music-hero-info">
|
||||
<Skeleton variant="text" sx={{ width: 110, height: 14 }} />
|
||||
<Skeleton
|
||||
variant="text"
|
||||
sx={{
|
||||
width: "68%",
|
||||
maxWidth: 620,
|
||||
height: "clamp(2.7rem, 5vw, 4.2rem)",
|
||||
my: "0.35em",
|
||||
}}
|
||||
/>
|
||||
<Skeleton variant="text" sx={{ width: 180 }} />
|
||||
<Skeleton variant="text" sx={{ width: 230, mt: "0.4em" }} />
|
||||
<div className="music-actions">
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
width={172}
|
||||
height={48}
|
||||
sx={{ borderRadius: "999px" }}
|
||||
/>
|
||||
<Skeleton variant="circular" width={44} height={44} />
|
||||
<Skeleton variant="circular" width={44} height={44} />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
{artist ? (
|
||||
<>
|
||||
<div className="music-tabs">
|
||||
<Skeleton variant="rounded" width={120} height={34} sx={{ borderRadius: 999 }} />
|
||||
<Skeleton variant="rounded" width={96} height={34} sx={{ borderRadius: 999 }} />
|
||||
<Skeleton variant="rounded" width={100} height={34} sx={{ borderRadius: 999 }} />
|
||||
</div>
|
||||
<div className="music-album-grid">
|
||||
{ALBUM_SKELETONS.map((id) => (
|
||||
<AlbumCardSkeleton key={`artist-album-${id}`} />
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<section className="music-tracks" aria-label="Загрузка треков">
|
||||
<div className="music-tracks-head">
|
||||
<Skeleton variant="text" width={24} />
|
||||
<Skeleton variant="text" width={120} />
|
||||
<Skeleton variant="text" width={60} />
|
||||
<Skeleton variant="text" width={32} />
|
||||
</div>
|
||||
{TRACK_SKELETONS.map((id) => (
|
||||
<div className="album-track" key={`music-track-${id}`}>
|
||||
<Skeleton variant="text" width={16} />
|
||||
<div className="album-track-info">
|
||||
<Skeleton variant="text" sx={{ width: "52%", height: 18 }} />
|
||||
<Skeleton variant="text" sx={{ width: "34%", height: 14 }} />
|
||||
</div>
|
||||
<Skeleton variant="text" width={38} />
|
||||
<Skeleton variant="circular" width={24} height={24} />
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
export default MusicPageSkeleton;
|
||||
@@ -1,52 +1,44 @@
|
||||
import Divider from "@mui/material/Divider";
|
||||
import Grid2 from "@mui/material/Grid";
|
||||
import Skeleton from "@mui/material/Skeleton";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import React from "react";
|
||||
import EpisodeSkeleton from "./episode";
|
||||
|
||||
export const SeasonSelectorSkeleton = () => {
|
||||
return (
|
||||
<Grid2
|
||||
container
|
||||
columns={{
|
||||
xs: 2,
|
||||
sm: 3,
|
||||
md: 4,
|
||||
}}
|
||||
sx={{ width: "100%" }}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
gap: "1em",
|
||||
justifyContent: "space-between",
|
||||
width: "100%",
|
||||
}}
|
||||
>
|
||||
<Typography variant="h3">
|
||||
<Skeleton width={320} variant="text" animation="wave" />
|
||||
</Typography>
|
||||
<Skeleton animation="wave" height={64} width={128} />
|
||||
</div>
|
||||
<Divider
|
||||
style={{
|
||||
display: "block",
|
||||
width: "100%",
|
||||
}}
|
||||
/>
|
||||
export const SeasonSelectorSkeleton = () => (
|
||||
<div className="item-series-seasons-container" aria-busy="true">
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
width: "100%",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
paddingBottom: " 0.5em",
|
||||
paddingBottom: "0.5em",
|
||||
}}
|
||||
>
|
||||
<div style={{ display: "flex", gap: "1em", alignItems: "center" }}>
|
||||
<Skeleton variant="text" width={220} sx={{ fontSize: "1.5rem" }} />
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
width={36}
|
||||
height={24}
|
||||
sx={{ borderRadius: 999 }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "flex", gap: "0.75em", alignItems: "center" }}>
|
||||
<Skeleton variant="circular" width={32} height={32} />
|
||||
<Skeleton variant="circular" width={32} height={32} />
|
||||
<Skeleton
|
||||
variant="rounded"
|
||||
width={110}
|
||||
height={36}
|
||||
sx={{ borderRadius: "8px" }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<Divider />
|
||||
<div className="item-detail-episode-container">
|
||||
<EpisodeSkeleton />
|
||||
</div>
|
||||
</Grid2>
|
||||
);
|
||||
};
|
||||
</div>
|
||||
);
|
||||
|
||||
export default SeasonSelectorSkeleton;
|
||||
@@ -124,6 +124,7 @@ body.has-player-bar .home-sections {
|
||||
.home-skeleton-cards {
|
||||
display: flex;
|
||||
gap: 0.75rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.home-skeleton-cards span {
|
||||
@@ -180,3 +181,17 @@ body.has-player-bar .home-sections {
|
||||
padding: 2rem 1.1rem calc(8rem + var(--safe-bottom));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.home-skeleton-sections {
|
||||
gap: 1.8em;
|
||||
}
|
||||
|
||||
.home-skeleton-row {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.home-skeleton-row .home-skeleton-heading {
|
||||
margin-bottom: 0.9em;
|
||||
}
|
||||
@@ -200,6 +200,18 @@ function HomeContent({ api, user }: { api: Api; user: UserDto }) {
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div className="home-sections home-skeleton-sections">
|
||||
{[0, 1, 2].map((row) => (
|
||||
<div className="home-skeleton-row" key={`home-skeleton-row-${row}`}>
|
||||
<span className="home-skeleton-heading" />
|
||||
<div className="home-skeleton-cards">
|
||||
{[0, 1, 2, 3].map((card) => (
|
||||
<span key={`home-skeleton-card-${row}-${card}`} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ function Library() {
|
||||
>
|
||||
<Suspense
|
||||
fallback={
|
||||
<div className="library-items">
|
||||
<LibraryItemsSkeleton
|
||||
square={
|
||||
currentViewType === BaseItemKind.MusicAlbum ||
|
||||
@@ -119,6 +120,7 @@ function Library() {
|
||||
currentViewType === BaseItemKind.Playlist
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="library-items">
|
||||
|
||||
@@ -227,7 +227,6 @@
|
||||
}
|
||||
|
||||
.library-items {
|
||||
padding-top: 0.5rem !important;
|
||||
padding-bottom: calc(7.5em + var(--safe-bottom)) !important;
|
||||
padding: 0.5rem 0.75rem calc(7.5em + var(--safe-bottom)) !important;
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
import { BaseItemKind, SortOrder } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute, Link } from "@tanstack/react-router";
|
||||
import React, { useLayoutEffect, useMemo } from "react";
|
||||
@@ -13,6 +11,7 @@ import RatingControl from "@/components/buttons/ratingControl";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import MusicPageSkeleton from "@/components/skeleton/musicPage";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import TagChip from "@/components/tagChip";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
@@ -130,19 +129,7 @@ function MusicAlbumTitlePage() {
|
||||
}, [item.isSuccess, item.data, setBackdrop]);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
return <MusicPageSkeleton />;
|
||||
}
|
||||
|
||||
if (item.isError) {
|
||||
|
||||
@@ -6,8 +6,6 @@ import {
|
||||
SortOrder,
|
||||
} from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import IconButton from "@mui/material/IconButton";
|
||||
import Tooltip from "@mui/material/Tooltip";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
@@ -21,6 +19,7 @@ import RatingControl from "@/components/buttons/ratingControl";
|
||||
import { Card } from "@/components/card/card";
|
||||
import IconLink from "@/components/iconLink";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import MusicPageSkeleton from "@/components/skeleton/musicPage";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import getImageUrlsApi from "@/utils/methods/getImageUrlsApi";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
@@ -195,19 +194,7 @@ function ArtistTitlePage() {
|
||||
].filter(Boolean);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
return <MusicPageSkeleton artist />;
|
||||
}
|
||||
|
||||
if (item.isError) {
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { BaseItemKind } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { getLibraryApi } from "@jellyfin/sdk/lib/utils/api/library-api";
|
||||
import { getPlaylistApi } from "@jellyfin/sdk/lib/utils/api/playlist-api";
|
||||
import Box from "@mui/material/Box";
|
||||
import CircularProgress from "@mui/material/CircularProgress";
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import React, { useEffect } from "react";
|
||||
@@ -13,6 +11,7 @@ import RatingControl from "@/components/buttons/ratingControl";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { ErrorNotice } from "@/components/notices/errorNotice/errorNotice";
|
||||
import MusicPageSkeleton from "@/components/skeleton/musicPage";
|
||||
import ShowMoreText from "@/components/showMoreText";
|
||||
import TagChip from "@/components/tagChip";
|
||||
import { getTypeIcon } from "@/components/utils/iconsCollection";
|
||||
@@ -100,19 +99,7 @@ function PlaylistTitlePage() {
|
||||
}, [item.isSuccess, setAppBackdrop]);
|
||||
|
||||
if (item.isPending) {
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
width: "100%",
|
||||
height: "100vh",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<CircularProgress />
|
||||
</Box>
|
||||
);
|
||||
return <MusicPageSkeleton />;
|
||||
}
|
||||
|
||||
if (item.isError) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import { useQuery } from "@tanstack/react-query";
|
||||
import React, { useEffect, useMemo, useState } from "react";
|
||||
import { Card } from "@/components/card/card";
|
||||
import CardScroller from "@/components/cardScroller/cardScroller";
|
||||
import { CardSkeleton } from "@/components/skeleton/cards";
|
||||
import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import "./search.scss";
|
||||
import {
|
||||
@@ -424,7 +425,7 @@ function CategorySection({ category, query, api, user, onResult }: any) {
|
||||
}
|
||||
}, [data, isLoading, onResult]);
|
||||
|
||||
if (isLoading) return <CategorySkeleton />;
|
||||
if (isLoading) return <CategorySkeleton category={category} />;
|
||||
if (!data?.items || data.items.length === 0) return null;
|
||||
|
||||
// ... (Card mapping logic same as before) ...
|
||||
@@ -477,31 +478,30 @@ function CategorySection({ category, query, api, user, onResult }: any) {
|
||||
);
|
||||
}
|
||||
|
||||
function CategorySkeleton() {
|
||||
function CategorySkeleton({ category }: { category: any }) {
|
||||
const displayCards = category.value === "Episode" ? 4 : 7;
|
||||
const cardType =
|
||||
category.value === "Episode"
|
||||
? "thumb"
|
||||
: ["MusicAlbum", "MusicArtist", "Person"].includes(category.value)
|
||||
? "square"
|
||||
: "portrait";
|
||||
|
||||
return (
|
||||
<Box sx={{ mb: 4, ml: 2, mr: 2 }}>
|
||||
<Box
|
||||
sx={{
|
||||
height: 32,
|
||||
width: 200,
|
||||
bgcolor: "rgba(255,255,255,0.05)",
|
||||
borderRadius: 2,
|
||||
mb: 2,
|
||||
}}
|
||||
/>
|
||||
<Box sx={{ display: "flex", gap: 2, overflow: "hidden" }}>
|
||||
{[1, 2, 3, 4, 5, 6].map((i) => (
|
||||
<Box
|
||||
key={i}
|
||||
sx={{
|
||||
height: 260,
|
||||
minWidth: 170,
|
||||
bgcolor: "rgba(255,255,255,0.03)",
|
||||
borderRadius: 3,
|
||||
}}
|
||||
<div aria-busy="true">
|
||||
<CardScroller
|
||||
title={category.label}
|
||||
displayCards={displayCards}
|
||||
disableDecoration
|
||||
>
|
||||
{Array.from({ length: displayCards }, (_, index) => (
|
||||
<CardSkeleton
|
||||
// biome-ignore lint/suspicious/noArrayIndexKey: static skeleton slides
|
||||
key={`${category.value}-skeleton-${index}`}
|
||||
cardType={cardType}
|
||||
/>
|
||||
))}
|
||||
</Box>
|
||||
</Box>
|
||||
</CardScroller>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user