Skip to content

Commit f2dbd3a

Browse files
committed
fix: hide featured songs section if the weekly timespan is empty
1 parent e7e82d4 commit f2dbd3a

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

web/src/modules/browse/components/HomePageComponent.tsx

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,33 +31,37 @@ export const HomePageComponent = () => {
3131
<WelcomeBanner />
3232

3333
{/* FEATURED SONGS */}
34-
<div className='flex flex-wrap justify-between gap-6 text-nowrap'>
35-
<h2 className='flex-1 text-xl uppercase'>Featured songs</h2>
36-
<TimespanButtonGroup />
37-
</div>
38-
<div className='h-6' />
39-
<Carousel
40-
opts={{
41-
align: 'start',
42-
loop: false,
43-
duration: 15,
44-
}}
45-
>
46-
<CarouselContent className='-ml-4'>
47-
{featuredSongsPage.map((song, i) => (
48-
<CarouselItem
49-
className='basis-full md:basis-1/2 lg:basis-1/3 min-w-0 shrink-0 grow-0 pl-4'
50-
key={i}
51-
>
52-
<SongCard song={song} />
53-
</CarouselItem>
54-
))}
55-
</CarouselContent>
56-
<CarouselPrevious />
57-
<CarouselNext />
58-
<CarouselDots />
59-
</Carousel>
60-
<hr className='my-8 border-none bg-zinc-700 h-[3px]' />
34+
{featuredSongsPage.length > 0 && (
35+
<>
36+
<div className='flex flex-wrap justify-between gap-6 text-nowrap'>
37+
<h2 className='flex-1 text-xl uppercase'>Featured songs</h2>
38+
<TimespanButtonGroup />
39+
</div>
40+
<div className='h-6' />
41+
<Carousel
42+
opts={{
43+
align: 'start',
44+
loop: false,
45+
duration: 15,
46+
}}
47+
>
48+
<CarouselContent className='-ml-4'>
49+
{featuredSongsPage.map((song, i) => (
50+
<CarouselItem
51+
className='basis-full md:basis-1/2 lg:basis-1/3 min-w-0 shrink-0 grow-0 pl-4'
52+
key={i}
53+
>
54+
<SongCard song={song} />
55+
</CarouselItem>
56+
))}
57+
</CarouselContent>
58+
<CarouselPrevious />
59+
<CarouselNext />
60+
<CarouselDots />
61+
</Carousel>
62+
<hr className='my-8 border-none bg-zinc-700 h-[3px]' />
63+
</>
64+
)}
6165

6266
{/* RECENT SONGS */}
6367
<div className='flex flex-row flex-wrap justify-between items-center gap-4 mb-2'>

0 commit comments

Comments
 (0)