9
9
PauseCircleIcon ,
10
10
PlayCircleIcon ,
11
11
} from "@/components/icons/listen-to"
12
+ import Tooltip from "@/components/Tooltip"
12
13
13
14
import { cn } from "@/lib/utils/cn"
14
15
import { trackCustomEvent } from "@/lib/utils/matomo"
@@ -120,21 +121,22 @@ const PlayerWidget = ({
120
121
>
121
122
< div className = "flex justify-between" >
122
123
< p className = "text-sm font-bold leading-base" > { title } </ p >
123
- < button
124
- className = "cursor-pointer text-body-medium hover:text-body"
125
- aria-label = { "Collapse" }
126
- title = { "Collapse" }
127
- onClick = { ( ) => {
128
- setIsExpanded ( ! isExpanded )
129
- trackCustomEvent ( {
130
- eventCategory : "Audio" ,
131
- eventAction : "click" ,
132
- eventName : "minimize" ,
133
- } )
134
- } }
135
- >
136
- < CollapseIcon />
137
- </ button >
124
+ < Tooltip content = { "Collapse" } >
125
+ < button
126
+ className = "cursor-pointer text-body-medium hover:text-body"
127
+ aria-label = { "Collapse" }
128
+ onClick = { ( ) => {
129
+ setIsExpanded ( ! isExpanded )
130
+ trackCustomEvent ( {
131
+ eventCategory : "Audio" ,
132
+ eventAction : "click" ,
133
+ eventName : "minimize" ,
134
+ } )
135
+ } }
136
+ >
137
+ < CollapseIcon />
138
+ </ button >
139
+ </ Tooltip >
138
140
</ div >
139
141
< div className = "flex items-center justify-between" >
140
142
< div
@@ -161,14 +163,16 @@ const PlayerWidget = ({
161
163
</ div >
162
164
< div className = "flex items-center justify-between gap-10" >
163
165
< div className = "relative" >
164
- < button
165
- className = "w-[24px] cursor-pointer text-right text-xs font-bold leading-base text-body-medium hover:text-body"
166
- onClick = { ( ) => setShowSpeedMenu ( ! showSpeedMenu ) }
167
- title = { `Playback speed` }
168
- aria-label = { "Playback speed" }
169
- >
170
- { playbackSpeed } x
171
- </ button >
166
+ < Tooltip content = { "Playback speed" } >
167
+ < button
168
+ className = "w-[24px] cursor-pointer text-right text-xs font-bold leading-base text-body-medium hover:text-body"
169
+ onClick = { ( ) => setShowSpeedMenu ( ! showSpeedMenu ) }
170
+ title = { `Playback speed` }
171
+ aria-label = { "Playback speed" }
172
+ >
173
+ { playbackSpeed } x
174
+ </ button >
175
+ </ Tooltip >
172
176
{ showSpeedMenu && (
173
177
< div
174
178
ref = { speedMenuRef }
@@ -189,42 +193,50 @@ const PlayerWidget = ({
189
193
</ div >
190
194
) }
191
195
</ div >
192
- < button
193
- className = "cursor-pointer text-2xl text-disabled hover:text-body"
194
- onClick = { handlePrevious }
195
- title = "Previous"
196
- aria-label = { "Previous" }
197
- >
198
- < ArrowIcon />
199
- </ button >
200
- < button
201
- className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
202
- onClick = { handlePlayPause }
203
- title = { isPlaying ? "Pause" : "Play" }
204
- aria-label = { isPlaying ? "Pause" : "Play" }
205
- >
206
- { isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
207
- </ button >
208
- < button
209
- className = "cursor-pointer text-2xl text-disabled hover:text-body"
210
- onClick = { handleNext }
211
- title = "Next"
212
- aria-label = { "Next" }
213
- >
214
- < ArrowIcon className = "rotate-180" />
215
- </ button >
216
- < button
217
- className = { cn (
218
- "cursor-pointer text-base" ,
219
- autoplay ? "text-primary" : "text-disabled" ,
220
- "hover:text-primary-hover"
221
- ) }
222
- onClick = { ( ) => setAutoplay ( ! autoplay ) }
223
- title = { autoplay ? "Disable autoplay" : "Enable autoplay" }
224
- aria-label = { autoplay ? "Disable autoplay" : "Enable autoplay" }
225
- >
226
- < AutoplayIcon />
227
- </ button >
196
+ < Tooltip content = { "Previous" } >
197
+ < button
198
+ className = "cursor-pointer text-2xl text-disabled hover:text-body"
199
+ onClick = { handlePrevious }
200
+ title = "Previous"
201
+ aria-label = { "Previous" }
202
+ >
203
+ < ArrowIcon />
204
+ </ button >
205
+ </ Tooltip >
206
+ < Tooltip content = { isPlaying ? "Pause" : "Play" } >
207
+ < button
208
+ className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
209
+ onClick = { handlePlayPause }
210
+ title = { isPlaying ? "Pause" : "Play" }
211
+ aria-label = { isPlaying ? "Pause" : "Play" }
212
+ >
213
+ { isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
214
+ </ button >
215
+ </ Tooltip >
216
+ < Tooltip content = { "Next" } >
217
+ < button
218
+ className = "cursor-pointer text-2xl text-disabled hover:text-body"
219
+ onClick = { handleNext }
220
+ title = "Next"
221
+ aria-label = { "Next" }
222
+ >
223
+ < ArrowIcon className = "rotate-180" />
224
+ </ button >
225
+ </ Tooltip >
226
+ < Tooltip content = { autoplay ? "Disable autoplay" : "Enable autoplay" } >
227
+ < button
228
+ className = { cn (
229
+ "cursor-pointer text-base" ,
230
+ autoplay ? "text-primary" : "text-disabled" ,
231
+ "hover:text-primary-hover"
232
+ ) }
233
+ onClick = { ( ) => setAutoplay ( ! autoplay ) }
234
+ title = { autoplay ? "Disable autoplay" : "Enable autoplay" }
235
+ aria-label = { autoplay ? "Disable autoplay" : "Enable autoplay" }
236
+ >
237
+ < AutoplayIcon />
238
+ </ button >
239
+ </ Tooltip >
228
240
</ div >
229
241
</ div >
230
242
@@ -235,45 +247,51 @@ const PlayerWidget = ({
235
247
) }
236
248
>
237
249
< div className = "flex flex-row items-center gap-2" >
238
- < button
239
- className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
240
- onClick = { handlePlayPause }
241
- title = { isPlaying ? "Pause" : "Play" }
242
- aria-label = { isPlaying ? "Pause" : "Play" }
243
- >
244
- { isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
245
- </ button >
250
+ < Tooltip content = { isPlaying ? "Pause" : "Play" } >
251
+ < button
252
+ className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
253
+ onClick = { handlePlayPause }
254
+ title = { isPlaying ? "Pause" : "Play" }
255
+ aria-label = { isPlaying ? "Pause" : "Play" }
256
+ >
257
+ { isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
258
+ </ button >
259
+ </ Tooltip >
246
260
< div className = "text-sm text-body-medium" >
247
261
{ `${ Math . floor ( timeRemaining / 60 ) } :${ String ( Math . floor ( timeRemaining % 60 ) ) . padStart ( 2 , "0" ) } ` }
248
262
</ div >
249
263
</ div >
250
264
< div className = "flex flex-row gap-6" >
251
- < button
252
- className = "cursor-pointer text-disabled hover:text-body"
253
- title = { "Expand" }
254
- aria-label = { "Expand" }
255
- onClick = { ( ) => {
256
- setIsExpanded ( ! isExpanded )
257
- trackCustomEvent ( {
258
- eventCategory : "Audio" ,
259
- eventAction : "click" ,
260
- eventName : "expand" ,
261
- } )
262
- } }
263
- >
264
- < ExpandIcon />
265
- </ button >
266
- < button
267
- className = "cursor-pointer text-disabled hover:text-body"
268
- title = { "Close" }
269
- aria-label = { "Close" }
270
- onClick = { ( ) => {
271
- setIsExpanded ( ! isExpanded )
272
- handleCloseWidget ( )
273
- } }
274
- >
275
- < IoClose />
276
- </ button >
265
+ < Tooltip content = { "Expand" } >
266
+ < button
267
+ className = "cursor-pointer text-disabled hover:text-body"
268
+ title = { "Expand" }
269
+ aria-label = { "Expand" }
270
+ onClick = { ( ) => {
271
+ setIsExpanded ( ! isExpanded )
272
+ trackCustomEvent ( {
273
+ eventCategory : "Audio" ,
274
+ eventAction : "click" ,
275
+ eventName : "expand" ,
276
+ } )
277
+ } }
278
+ >
279
+ < ExpandIcon />
280
+ </ button >
281
+ </ Tooltip >
282
+ < Tooltip content = { "Close" } >
283
+ < button
284
+ className = "cursor-pointer text-disabled hover:text-body"
285
+ title = { "Close" }
286
+ aria-label = { "Close" }
287
+ onClick = { ( ) => {
288
+ setIsExpanded ( ! isExpanded )
289
+ handleCloseWidget ( )
290
+ } }
291
+ >
292
+ < IoClose />
293
+ </ button >
294
+ </ Tooltip >
277
295
</ div >
278
296
</ div >
279
297
</ div >
0 commit comments