Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/common/playlists/PlayCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { BiLogoTypescript, BiLogoJavascript } from 'react-icons/bi';
import PlayShare from './PlayShare.jsx';
import Like from 'common/components/Like/Like';
import userImage from 'images/user.png';
import PlayThumbnailFallBack from './PlayThumbnailFallBack';

const formatDate = (dateString) => dateString || '';

Expand Down Expand Up @@ -41,17 +42,19 @@ function PlayCard({ play, cover, likeObject }) {
return (
<Link className="group block" to={linkTo}>
<div className="play-card-container max-w-sm bg-white rounded-xl overflow-hidden flex flex-col h-full">
{cover && (
<div className="relative h-48">
<div className="relative h-48">
{cover ? (
<img alt={play.name} className="w-full h-full object-cover" src={cover} />
<div className="absolute inset-0 thumb-overlay pointer-events-none" />
<BsPlayCircleFill
className="absolute inset-0 m-auto z-10 opacity-0 transition-opacity duration-200 pointer-events-none"
color="white"
size={80}
/>
</div>
)}
) : (
<PlayThumbnailFallBack playName={play?.name} />
)}
<div className="absolute inset-0 thumb-overlay pointer-events-none" />
<BsPlayCircleFill
className="absolute inset-0 m-auto z-10 opacity-0 transition-opacity duration-200 pointer-events-none"
color="white"
size={80}
/>
</div>

<div className="p-5 flex flex-col flex-grow">
<LanguageBadge />
Expand Down
12 changes: 12 additions & 0 deletions src/common/playlists/PlayThumbnailFallBack.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import ImgLogo from 'images/img-logo-light-sm.svg';

const PlayThumbnailFallBack = ({ playName }) => {
return (
<div className="w-full h-full flex flex-col justify-center items-center">
<img alt={playName} src={ImgLogo} />
<span>{playName}</span>
</div>
);
};

export default PlayThumbnailFallBack;
3 changes: 1 addition & 2 deletions src/common/utils/coverImageUtil.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import FallbackImage from 'images/play-fallback-cover.png';
import { IMAGE_EXTENSIONS, FULFILLED_STATUS } from './utilsConstants';

/**
Expand Down Expand Up @@ -30,5 +29,5 @@ export const loadCoverImage = async (playSlug) => {
(result) => result.status === FULFILLED_STATUS && result.value?.default
);

return image?.value.default || FallbackImage;
return image?.value.default || null;
};
7 changes: 7 additions & 0 deletions src/images/img-logo-light-sm.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading