File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
src/components/ListenToPlayer Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ interface PlayerWidgetProps {
30
30
handleCloseWidget : ( ) => void
31
31
isExpanded : boolean
32
32
setIsExpanded : ( isExpanded : boolean ) => void
33
+ currentTrackIndex : number
34
+ totalTracks : number
33
35
}
34
36
35
37
const PlayerWidget = ( {
@@ -48,6 +50,8 @@ const PlayerWidget = ({
48
50
handleCloseWidget,
49
51
isExpanded,
50
52
setIsExpanded,
53
+ currentTrackIndex,
54
+ totalTracks,
51
55
} : PlayerWidgetProps ) => {
52
56
const [ isDragging , setIsDragging ] = useState ( false )
53
57
const scrubBarRef = useRef < HTMLDivElement > ( null )
@@ -195,7 +199,10 @@ const PlayerWidget = ({
195
199
</ div >
196
200
< Tooltip content = { "Previous" } >
197
201
< button
198
- className = "cursor-pointer text-2xl text-disabled hover:text-body"
202
+ className = { cn (
203
+ "cursor-pointer text-2xl hover:text-primary" ,
204
+ currentTrackIndex === 0 ? "text-disabled" : "text-body-medium"
205
+ ) }
199
206
onClick = { handlePrevious }
200
207
title = "Previous"
201
208
aria-label = { "Previous" }
@@ -215,7 +222,12 @@ const PlayerWidget = ({
215
222
</ Tooltip >
216
223
< Tooltip content = { "Next" } >
217
224
< button
218
- className = "cursor-pointer text-2xl text-disabled hover:text-body"
225
+ className = { cn (
226
+ "cursor-pointer text-2xl hover:text-primary" ,
227
+ currentTrackIndex === totalTracks - 1
228
+ ? "text-disabled"
229
+ : "text-body-medium"
230
+ ) }
219
231
onClick = { handleNext }
220
232
title = "Next"
221
233
aria-label = { "Next" }
Original file line number Diff line number Diff line change @@ -245,6 +245,8 @@ const ListenToPlayer = ({ slug }: { slug: string }) => {
245
245
playbackSpeed = { playbackSpeed }
246
246
handlePlaybackSpeed = { handlePlaybackSpeed }
247
247
handleCloseWidget = { handleCloseWidget }
248
+ currentTrackIndex = { currentTrackIndex }
249
+ totalTracks = { playlist . length }
248
250
/>
249
251
</ div >
250
252
</ div >
You can’t perform that action at this time.
0 commit comments