From 6a86331b63f8e5ac0f5fb59a21a23abdb2a90a84 Mon Sep 17 00:00:00 2001 From: waldo121 <17034517+waldo121@users.noreply.github.com> Date: Tue, 17 Sep 2024 18:10:13 -0400 Subject: [PATCH 1/2] Add error handling on image loading for album covers & thumbnails --- packages/ui/lib/components/ContextPopup/index.tsx | 7 ++++++- packages/ui/lib/components/Cover/index.tsx | 6 +++++- .../lib/components/GridTrackTable/Cells/ThumbnailCell.tsx | 8 +++++++- .../ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx | 6 +++++- packages/ui/lib/components/QueueItem/index.tsx | 7 ++++++- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/packages/ui/lib/components/ContextPopup/index.tsx b/packages/ui/lib/components/ContextPopup/index.tsx index 3eada32d3b..dc86ffaaa8 100644 --- a/packages/ui/lib/components/ContextPopup/index.tsx +++ b/packages/ui/lib/components/ContextPopup/index.tsx @@ -1,5 +1,7 @@ import React, { useState } from 'react'; import { Popup, PopupProps } from 'semantic-ui-react'; +import Img from 'react-image'; +import artPlaceholder from '../../../resources/media/art_placeholder.png'; import styles from './styles.scss'; @@ -38,7 +40,10 @@ const ContextPopup: React.FC = ({
{thumb &&
- + } + />
}
diff --git a/packages/ui/lib/components/Cover/index.tsx b/packages/ui/lib/components/Cover/index.tsx index 82d70a5c97..ac383485f8 100644 --- a/packages/ui/lib/components/Cover/index.tsx +++ b/packages/ui/lib/components/Cover/index.tsx @@ -1,4 +1,5 @@ import React from 'react'; +import Img from 'react-image'; import cx from 'classnames'; import artPlaceholder from '../../../resources/media/art_placeholder.png'; @@ -15,7 +16,10 @@ const Cover: React.FC = ({ cover = String(artPlaceholder) }) => ( common.nuclear, styles.cover_container )}> - + } + />
); diff --git a/packages/ui/lib/components/GridTrackTable/Cells/ThumbnailCell.tsx b/packages/ui/lib/components/GridTrackTable/Cells/ThumbnailCell.tsx index da4385493a..128f0fac92 100644 --- a/packages/ui/lib/components/GridTrackTable/Cells/ThumbnailCell.tsx +++ b/packages/ui/lib/components/GridTrackTable/Cells/ThumbnailCell.tsx @@ -4,6 +4,8 @@ import cx from 'classnames'; import { Track } from '../../../types'; import styles from '../styles.scss'; +import Img from 'react-image'; +import artPlaceholder from '../../../../resources/media/art_placeholder.png'; export const ThumbnailCell: React.FC> = ({ cell, @@ -12,5 +14,9 @@ export const ThumbnailCell: React.FC> = ({ className={cx(styles.grid_track_table_cell, styles.thumbnail_cell)} {...cell.getCellProps()} > - + } + />
; diff --git a/packages/ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx b/packages/ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx index 2c21a3f86a..788a622da7 100644 --- a/packages/ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx +++ b/packages/ui/lib/components/MiniPlayer/MiniTrackInfo/index.tsx @@ -3,6 +3,7 @@ import { Icon } from 'semantic-ui-react'; import styles from './styles.scss'; import artPlaceholder from '../../../../resources/media/art_placeholder.png'; +import Img from 'react-image'; import { TrackInfoProps } from '../../TrackInfo'; @@ -19,7 +20,10 @@ const MiniTrackInfo: React.FC = ({ }) => (
- + } + />
{ hasTracks && diff --git a/packages/ui/lib/components/QueueItem/index.tsx b/packages/ui/lib/components/QueueItem/index.tsx index 443c7bc456..7892bdd421 100644 --- a/packages/ui/lib/components/QueueItem/index.tsx +++ b/packages/ui/lib/components/QueueItem/index.tsx @@ -10,6 +10,8 @@ import styles from './styles.scss'; import artPlaceholder from '../../../resources/media/art_placeholder.png'; import { getTrackArtist, getTrackTitle } from '../../utils'; import { Track } from '../../types'; +import Img from 'react-image'; + export type QueueItemProps = { isCurrent: boolean; @@ -46,7 +48,10 @@ export const QueueItem: React.FC = ({
{track.loading ? - : } + : } + />}
Date: Tue, 17 Sep 2024 18:10:22 -0400 Subject: [PATCH 2/2] update snapshots --- .../AlbumViewContainer.test.tsx.snap | 12 +---- .../ArtistViewContainer.test.tsx.snap | 21 ++------ .../DashboardContainer.test.tsx.snap | 14 +---- .../DeezerPlaylistAdapter.test.tsx.snap | 14 +---- .../FavoritesContainer.tracks.test.tsx.snap | 52 +++---------------- .../LibraryViewContainer.test.tsx.snap | 21 ++------ .../PlayQueueContainer.test.tsx.snap | 27 ---------- .../PlaylistViewContainer.test.tsx.snap | 14 +---- .../SpotifyPlaylistAdapter.test.tsx.snap | 14 +---- .../ui/test/__snapshots__/cover.test.tsx.snap | 6 +-- .../gridTrackTable.test.tsx.snap | 21 ++------ .../__snapshots__/miniPlayer.test.tsx.snap | 6 +-- .../__snapshots__/playerBar.test.tsx.snap | 6 +-- 13 files changed, 30 insertions(+), 198 deletions(-) diff --git a/packages/app/app/containers/AlbumViewContainer/__snapshots__/AlbumViewContainer.test.tsx.snap b/packages/app/app/containers/AlbumViewContainer/__snapshots__/AlbumViewContainer.test.tsx.snap index ec13fc34f1..8e76c40a0d 100644 --- a/packages/app/app/containers/AlbumViewContainer/__snapshots__/AlbumViewContainer.test.tsx.snap +++ b/packages/app/app/containers/AlbumViewContainer/__snapshots__/AlbumViewContainer.test.tsx.snap @@ -580,11 +580,7 @@ exports[`Album view container should display an album 1`] = ` >
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
- -
+ />
+ />