fix incorrect imageId assignments (#1456)

This commit is contained in:
jeffvli
2025-12-30 15:18:03 -08:00
parent 6ddaf0366c
commit 4a025f82e4
13 changed files with 28 additions and 23 deletions
@@ -32,7 +32,7 @@ export const DragPreview = memo(({ data }: DragPreviewProps) => {
const itemName = firstItem ? getItemName(firstItem) : 'Item';
const itemImage = useItemImageUrl({
id: (firstItem as { id: string })?.id,
id: (firstItem as { imageId: string })?.imageId,
itemType: data.itemType || LibraryItem.SONG,
type: 'table',
});
@@ -119,7 +119,7 @@ const CarouselItem = ({ album }: CarouselItemProps) => {
<ItemImage
className={styles.albumImage}
containerClassName={styles.albumImageContainer}
id={album.id}
id={album.imageId}
itemType={LibraryItem.ALBUM}
src={imageUrl}
/>
@@ -314,7 +314,7 @@ const CompactItemCard = ({
className={clsx(styles.image, {
[styles.isRound]: isRound,
})}
id={data?.id}
id={data?.imageId}
itemType={itemType}
src={(data as Album | AlbumArtist | Playlist | Song)?.imageUrl}
/>
@@ -532,7 +532,7 @@ const DefaultItemCard = ({
<>
<ItemImage
className={clsx(styles.image, { [styles.isRound]: isRound })}
id={data?.id}
id={data?.imageId}
itemType={itemType}
src={(data as Album | AlbumArtist | Playlist | Song)?.imageUrl}
/>
@@ -31,7 +31,7 @@ const getUnloaderIcon = (itemType: LibraryItem) => {
};
const BaseItemImage = (
props: Omit<ImageProps, 'src'> & {
props: Omit<ImageProps, 'id' | 'src'> & {
id?: null | string;
itemType: LibraryItem;
src?: null | string;
@@ -46,13 +46,20 @@ const BaseItemImage = (
size: 300,
});
return <BaseImage src={imageUrl} unloaderIcon={getUnloaderIcon(props.itemType)} {...rest} />;
return (
<BaseImage
src={imageUrl}
unloaderIcon={getUnloaderIcon(props.itemType)}
{...rest}
id={props.id || undefined}
/>
);
};
export const ItemImage = memo(BaseItemImage);
interface UseItemImageUrlProps {
id?: string;
id?: null | string;
imageUrl?: null | string;
itemType: LibraryItem;
serverId?: string;
@@ -83,7 +83,7 @@ export const ImageColumn = (props: ItemTableListInnerColumn) => {
[styles.imageContainerWithAspectRatio]:
props.size === 'default' || props.size === 'large',
})}
id={item?.id}
id={item?.imageId}
itemType={item?._itemType}
src={item?.imageUrl}
/>
@@ -100,7 +100,7 @@ export const DefaultTitleCombinedColumn = (props: ItemTableListInnerColumn) => {
>
<ItemImage
containerClassName={styles.image}
id={item?.id}
id={item?.imageId}
itemType={item?._itemType}
src={item?.imageUrl}
/>
@@ -236,7 +236,7 @@ export const QueueSongTitleCombinedColumn = (props: ItemTableListInnerColumn) =>
>
<ItemImage
containerClassName={styles.image}
id={item?.id}
id={item?.imageId}
itemType={item?._itemType}
src={item?.imageUrl}
/>
@@ -121,7 +121,7 @@ export const LeftControls = () => {
styles.playerbarImage,
PlaybackSelectors.playerCoverArt,
)}
id={currentSong?.id}
id={currentSong?.imageId}
itemType={LibraryItem.SONG}
loading="eager"
/>
@@ -92,7 +92,7 @@ export const MobilePlayerbar = () => {
styles.playerbarImage,
PlaybackSelectors.playerCoverArt,
)}
id={currentSong.id}
id={currentSong.imageId}
itemType={LibraryItem.SONG}
loading="eager"
/>
@@ -556,7 +556,7 @@ const PlaylistTableItem = memo(
<Grid.Col span="content">
<Flex align="center" justify="center" px="sm">
<ItemImage
id={item.id}
id={item.imageId}
imageContainerProps={{
className: styles.imageContainer,
}}
@@ -167,6 +167,7 @@ export const CommandPalette = ({ modalProps }: CommandPaletteProps) => {
{({ isHighlighted }) => (
<LibraryCommandItem
id={album.id}
imageId={album.imageId}
imageUrl={album.imageUrl}
isHighlighted={isHighlighted}
itemType={LibraryItem.ALBUM}
@@ -200,6 +201,7 @@ export const CommandPalette = ({ modalProps }: CommandPaletteProps) => {
<LibraryCommandItem
disabled={artist?.albumCount === 0}
id={artist.id}
imageId={artist.imageId}
imageUrl={artist.imageUrl}
isHighlighted={isHighlighted}
itemType={LibraryItem.ALBUM_ARTIST}
@@ -237,6 +239,7 @@ export const CommandPalette = ({ modalProps }: CommandPaletteProps) => {
{({ isHighlighted }) => (
<LibraryCommandItem
id={song.id}
imageId={song.imageId}
imageUrl={song.imageUrl}
isHighlighted={isHighlighted}
itemType={LibraryItem.SONG}
@@ -19,6 +19,7 @@ import { Play } from '/@/shared/types/types';
interface LibraryCommandItemProps {
disabled?: boolean;
id: string;
imageId: null | string;
imageUrl: null | string;
isHighlighted?: boolean;
itemType: LibraryItem;
@@ -30,6 +31,7 @@ interface LibraryCommandItemProps {
export const LibraryCommandItem = ({
disabled,
id,
imageId,
imageUrl,
isHighlighted,
itemType,
@@ -99,7 +101,7 @@ export const LibraryCommandItem = ({
alt="cover"
className={styles.image}
height={40}
id={id}
id={imageId}
itemType={itemType}
src={imageUrl}
width={40}
@@ -232,7 +232,7 @@ const normalizeAlbum = (
_itemType: LibraryItem.ALBUM,
_serverId: server?.id || '',
_serverType: ServerType.JELLYFIN,
albumArtistName: item.AlbumArtist || '',
albumArtistName: item.AlbumArtist,
albumArtists:
item.AlbumArtists.map((entry) => ({
id: entry.Id,
+1 -8
View File
@@ -225,15 +225,8 @@ export type AlbumArtist = {
userRating: null | number;
};
export type Artist = {
export type Artist = Omit<AlbumArtist, '_itemType'> & {
_itemType: LibraryItem.ARTIST;
_serverId: string;
_serverType: ServerType;
biography: null | string;
createdAt: string;
id: string;
name: string;
updatedAt: string;
};
export type AuthenticationResponse = {