Skip to content

Commit

Permalink
Fallback Image added for Plays (#1510)
Browse files Browse the repository at this point in the history
Co-authored-by: Priyankar Pal <88102392+priyankarpal@users.noreply.github.com>
  • Loading branch information
Abhishek-90 and priyankarpal authored Sep 8, 2024
1 parent f924541 commit 9734b82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common/utils/coverImageUtil.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import FallbackImage from 'images/play-fallback-cover.png';

export async function loadCoverImage(playSlug) {
const acceptedImgExtensions = [`png`, `jpg`, `jpeg`];
const imgPromises = acceptedImgExtensions.map((ext) => import(`plays/${playSlug}/cover.${ext}`));
Expand All @@ -8,5 +10,5 @@ export async function loadCoverImage(playSlug) {
(result) => result.status === 'fulfilled' && result.value.default
);

return fulfilledResult?.value.default;
return fulfilledResult?.value.default || FallbackImage;
}
Binary file added src/images/play-fallback-cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9734b82

Please sign in to comment.