mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-10 04:30:25 +02:00
fix image url generation on album detail header
This commit is contained in:
@@ -2,6 +2,7 @@ import { useQuery } from '@tanstack/react-query';
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import { useLocation, useParams } from 'react-router';
|
import { useLocation, useParams } from 'react-router';
|
||||||
|
|
||||||
|
import { useItemImageUrl } from '/@/renderer/components/item-image/item-image';
|
||||||
import { NativeScrollArea } from '/@/renderer/components/native-scroll-area/native-scroll-area';
|
import { NativeScrollArea } from '/@/renderer/components/native-scroll-area/native-scroll-area';
|
||||||
import { albumQueries } from '/@/renderer/features/albums/api/album-api';
|
import { albumQueries } from '/@/renderer/features/albums/api/album-api';
|
||||||
import { AlbumDetailContent } from '/@/renderer/features/albums/components/album-detail-content';
|
import { AlbumDetailContent } from '/@/renderer/features/albums/components/album-detail-content';
|
||||||
@@ -34,9 +35,16 @@ const AlbumDetailRoute = () => {
|
|||||||
staleTime: 0,
|
staleTime: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const imageUrl =
|
||||||
|
useItemImageUrl({
|
||||||
|
id: albumId,
|
||||||
|
itemType: LibraryItem.ALBUM,
|
||||||
|
type: 'itemCard',
|
||||||
|
}) || '';
|
||||||
|
|
||||||
const { background: backgroundColor, isLoading: isColorLoading } = useFastAverageColor({
|
const { background: backgroundColor, isLoading: isColorLoading } = useFastAverageColor({
|
||||||
id: albumId,
|
id: albumId,
|
||||||
src: detailQuery.data?.imageUrl,
|
src: imageUrl,
|
||||||
srcLoaded: !detailQuery.isLoading,
|
srcLoaded: !detailQuery.isLoading,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -45,7 +53,7 @@ const AlbumDetailRoute = () => {
|
|||||||
const showBlurredImage = albumBackground;
|
const showBlurredImage = albumBackground;
|
||||||
|
|
||||||
const { isReady } = useWaitForColorCalculation({
|
const { isReady } = useWaitForColorCalculation({
|
||||||
hasImage: !!detailQuery.data?.imageUrl,
|
hasImage: !!imageUrl,
|
||||||
isLoading: isColorLoading,
|
isLoading: isColorLoading,
|
||||||
routeId: albumId,
|
routeId: albumId,
|
||||||
showBlurredImage,
|
showBlurredImage,
|
||||||
@@ -81,7 +89,7 @@ const AlbumDetailRoute = () => {
|
|||||||
<LibraryBackgroundImage
|
<LibraryBackgroundImage
|
||||||
blur={albumBackgroundBlur}
|
blur={albumBackgroundBlur}
|
||||||
headerRef={headerRef}
|
headerRef={headerRef}
|
||||||
imageUrl={detailQuery.data?.imageUrl}
|
imageUrl={imageUrl}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<LibraryBackgroundOverlay backgroundColor={background} headerRef={headerRef} />
|
<LibraryBackgroundOverlay backgroundColor={background} headerRef={headerRef} />
|
||||||
|
|||||||
Reference in New Issue
Block a user