mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
adjust bg loading on album detail page
This commit is contained in:
@@ -17,9 +17,10 @@ import { LibraryHeaderBar } from '/@/renderer/features/shared/components/library
|
|||||||
import { PageErrorBoundary } from '/@/renderer/features/shared/components/page-error-boundary';
|
import { PageErrorBoundary } from '/@/renderer/features/shared/components/page-error-boundary';
|
||||||
import { useFastAverageColor } from '/@/renderer/hooks';
|
import { useFastAverageColor } from '/@/renderer/hooks';
|
||||||
import { useAlbumBackground, useCurrentServer } from '/@/renderer/store';
|
import { useAlbumBackground, useCurrentServer } from '/@/renderer/store';
|
||||||
import { Spinner } from '/@/shared/components/spinner/spinner';
|
|
||||||
import { LibraryItem } from '/@/shared/types/domain-types';
|
import { LibraryItem } from '/@/shared/types/domain-types';
|
||||||
|
|
||||||
|
const ALBUM_DETAIL_BG_FALLBACK = 'var(--theme-colors-foreground-muted)';
|
||||||
|
|
||||||
const AlbumDetailRoute = () => {
|
const AlbumDetailRoute = () => {
|
||||||
const scrollAreaRef = useRef<HTMLDivElement>(null);
|
const scrollAreaRef = useRef<HTMLDivElement>(null);
|
||||||
const headerRef = useRef<HTMLDivElement>(null);
|
const headerRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -42,25 +43,21 @@ const AlbumDetailRoute = () => {
|
|||||||
type: 'itemCard',
|
type: 'itemCard',
|
||||||
}) || '';
|
}) || '';
|
||||||
|
|
||||||
const { background: backgroundColor, isLoading: isColorLoading } = useFastAverageColor({
|
const { background: backgroundColor } = useFastAverageColor({
|
||||||
id: albumId,
|
id: albumId,
|
||||||
src: imageUrl,
|
src: imageUrl,
|
||||||
srcLoaded: true,
|
srcLoaded: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
const background = backgroundColor;
|
const background = backgroundColor ?? ALBUM_DETAIL_BG_FALLBACK;
|
||||||
|
|
||||||
const showBlurredImage = albumBackground;
|
const showBlurredImage = albumBackground;
|
||||||
|
|
||||||
if (isColorLoading) {
|
|
||||||
return <Spinner container />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AnimatedPage key={`album-detail-${albumId}`}>
|
<AnimatedPage key={`album-detail-${albumId}`}>
|
||||||
<NativeScrollArea
|
<NativeScrollArea
|
||||||
pageHeaderProps={{
|
pageHeaderProps={{
|
||||||
backgroundColor: backgroundColor || undefined,
|
backgroundColor: backgroundColor ?? ALBUM_DETAIL_BG_FALLBACK,
|
||||||
children: (
|
children: (
|
||||||
<LibraryHeaderBar>
|
<LibraryHeaderBar>
|
||||||
<LibraryHeaderBar.PlayButton
|
<LibraryHeaderBar.PlayButton
|
||||||
|
|||||||
@@ -341,5 +341,5 @@ export const AppRouter = () => {
|
|||||||
</HashRouter>
|
</HashRouter>
|
||||||
);
|
);
|
||||||
|
|
||||||
return <Suspense fallback={<></>}>{router}</Suspense>;
|
return <Suspense fallback={<Spinner container />}>{router}</Suspense>;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user