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
+348
-287
No files matched your search
@@ -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