Skip to content

Commit

Permalink
restoring simple artist choice when there are less than 25 artists
Browse files Browse the repository at this point in the history
  • Loading branch information
sam9116 committed May 25, 2024
1 parent 80cb7e6 commit 09069fa
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/YourSpotifyArtistsWithShows.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useEffect } from 'react';
import { Grid, CircularProgress } from '@mui/material';
import { Grid, Chip, Box, CircularProgress } from '@mui/material';
import SwipeableTextMobileStepper from './ArtistsCarrousel'

function YourSpotifyArtistsWithShows({ artists, onChildClick, isRequestTriggered }) {
Expand All @@ -20,8 +20,8 @@ function YourSpotifyArtistsWithShows({ artists, onChildClick, isRequestTriggered
}, {});
setGroupedNames(grouped);
}, [artists]);
useEffect(()=>{

useEffect(() => {
setIsLoading(isRequestTriggered);
}, [isRequestTriggered])

Expand All @@ -30,10 +30,27 @@ function YourSpotifyArtistsWithShows({ artists, onChildClick, isRequestTriggered
onChildClick(artistName);
};

const commaSeparatedfollowedArtists = artists.map((artist, index) => {
return (
<Grid item key={index}>
<Chip sx={{ background: "limegreen" }} label={artist.name} color="success" onClick={() => handleClick(artist)} />
</Grid>
);
});

return (
<Grid>
<p>Artists from your playlist</p>
{!!artists && <SwipeableTextMobileStepper groupedNames={groupedNames} handleArtistClick={handleClick} />}

{artists.length > 25 ? (<SwipeableTextMobileStepper groupedNames={groupedNames} handleArtistClick={handleClick} />) : (<Box
display="flex"
justifyContent="center"
alignItems="center"
>
<Grid xs={10} md={10} container spacing={1} direction="row" justifyContent="center">
{commaSeparatedfollowedArtists}
</Grid>
</Box>)}
{isLoading && <CircularProgress />}
</Grid>
);
Expand Down

0 comments on commit 09069fa

Please sign in to comment.