Skip to content

Commit

Permalink
removed the addRoute prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Angryman18 committed Jul 23, 2022
1 parent 29644ab commit 160457e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/common/playlists/FeaturedPlays.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const FeaturedPlays = () => {
{loading && <p>Loading...</p>}
{error && <p>{error?.message ?? "Something went wrong"}</p>}
{success && data?.map((play, index) => (
<PlayThumbnail addRoute={true} key={play.id} play={play} />
<PlayThumbnail key={play.id} play={play} />
))}
</ul>
</>
Expand Down
9 changes: 2 additions & 7 deletions src/common/playlists/PlayThumbnail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ const Author = ({ user }) => {
);
};

const PlayThumbnail = ({ play, addRoute }) => {
const PlayThumbnail = ({ play }) => {
const [cover, setCover] = useState(null);

const getRoute = addRoute ? `plays/${play.id}` : play.id

useEffect(() => {
// Set the cover image
Expand Down Expand Up @@ -57,7 +56,7 @@ const PlayThumbnail = ({ play, addRoute }) => {

return (
<li key={play.id}>
<Link to={getRoute} state={{ id: play.id }}>
<Link to={`/plays/${play.id}`} state={{ id: play.id }}>
<div className='play-thumb'>
<Shimmer>
<img src={cover} alt='' className='play-thumb-img' />
Expand All @@ -78,8 +77,4 @@ const PlayThumbnail = ({ play, addRoute }) => {
);
};

PlayThumbnail.defaultProps = {
addRoute: false
}

export default PlayThumbnail;

0 comments on commit 160457e

Please sign in to comment.