@@ -12,8 +12,23 @@ import {
12
12
import Tooltip from "@/components/Tooltip"
13
13
14
14
import { cn } from "@/lib/utils/cn"
15
+ import { isMobile } from "@/lib/utils/isMobile"
15
16
import { trackCustomEvent } from "@/lib/utils/matomo"
16
17
18
+ const PlayerButton = ( {
19
+ children,
20
+ tooltipContent,
21
+ } : {
22
+ children : React . ReactNode
23
+ tooltipContent : string
24
+ } ) => {
25
+ return isMobile ( ) ? (
26
+ children
27
+ ) : (
28
+ < Tooltip content = { tooltipContent } > { children } </ Tooltip >
29
+ )
30
+ }
31
+
17
32
interface PlayerWidgetProps {
18
33
title : string
19
34
duration : number
@@ -167,7 +182,7 @@ const PlayerWidget = ({
167
182
</ div >
168
183
< div className = "flex items-center justify-between gap-10" >
169
184
< div className = "relative" >
170
- < Tooltip content = { "Playback speed" } >
185
+ < PlayerButton tooltipContent = { "Playback speed" } >
171
186
< button
172
187
className = "w-[24px] cursor-pointer text-right text-xs font-bold leading-base text-body-medium hover:text-body"
173
188
onClick = { ( ) => setShowSpeedMenu ( ! showSpeedMenu ) }
@@ -176,7 +191,7 @@ const PlayerWidget = ({
176
191
>
177
192
{ playbackSpeed } x
178
193
</ button >
179
- </ Tooltip >
194
+ </ PlayerButton >
180
195
{ showSpeedMenu && (
181
196
< div
182
197
ref = { speedMenuRef }
@@ -197,7 +212,7 @@ const PlayerWidget = ({
197
212
</ div >
198
213
) }
199
214
</ div >
200
- < Tooltip content = { "Previous" } >
215
+ < PlayerButton tooltipContent = { "Previous" } >
201
216
< button
202
217
className = { cn (
203
218
"cursor-pointer text-2xl hover:text-primary" ,
@@ -209,8 +224,8 @@ const PlayerWidget = ({
209
224
>
210
225
< ArrowIcon />
211
226
</ button >
212
- </ Tooltip >
213
- < Tooltip content = { isPlaying ? "Pause" : "Play" } >
227
+ </ PlayerButton >
228
+ < PlayerButton tooltipContent = { isPlaying ? "Pause" : "Play" } >
214
229
< button
215
230
className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
216
231
onClick = { handlePlayPause }
@@ -219,8 +234,8 @@ const PlayerWidget = ({
219
234
>
220
235
{ isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
221
236
</ button >
222
- </ Tooltip >
223
- < Tooltip content = { "Next" } >
237
+ </ PlayerButton >
238
+ < PlayerButton tooltipContent = { "Next" } >
224
239
< button
225
240
className = { cn (
226
241
"cursor-pointer text-2xl hover:text-primary" ,
@@ -234,8 +249,10 @@ const PlayerWidget = ({
234
249
>
235
250
< ArrowIcon className = "rotate-180" />
236
251
</ button >
237
- </ Tooltip >
238
- < Tooltip content = { autoplay ? "Disable autoplay" : "Enable autoplay" } >
252
+ </ PlayerButton >
253
+ < PlayerButton
254
+ tooltipContent = { autoplay ? "Disable autoplay" : "Enable autoplay" }
255
+ >
239
256
< button
240
257
className = { cn (
241
258
"cursor-pointer text-base" ,
@@ -248,7 +265,7 @@ const PlayerWidget = ({
248
265
>
249
266
< AutoplayIcon />
250
267
</ button >
251
- </ Tooltip >
268
+ </ PlayerButton >
252
269
</ div >
253
270
</ div >
254
271
@@ -259,7 +276,7 @@ const PlayerWidget = ({
259
276
) }
260
277
>
261
278
< div className = "flex flex-row items-center gap-2" >
262
- < Tooltip content = { isPlaying ? "Pause" : "Play" } >
279
+ < PlayerButton tooltipContent = { isPlaying ? "Pause" : "Play" } >
263
280
< button
264
281
className = "cursor-pointer text-[32px] text-primary hover:text-primary-hover"
265
282
onClick = { handlePlayPause }
@@ -268,13 +285,13 @@ const PlayerWidget = ({
268
285
>
269
286
{ isPlaying ? < PauseCircleIcon /> : < PlayCircleIcon /> }
270
287
</ button >
271
- </ Tooltip >
288
+ </ PlayerButton >
272
289
< div className = "text-sm text-body-medium" >
273
290
{ `${ Math . floor ( timeRemaining / 60 ) } :${ String ( Math . floor ( timeRemaining % 60 ) ) . padStart ( 2 , "0" ) } ` }
274
291
</ div >
275
292
</ div >
276
293
< div className = "flex flex-row gap-6" >
277
- < Tooltip content = { "Expand" } >
294
+ < PlayerButton tooltipContent = { "Expand" } >
278
295
< button
279
296
className = "cursor-pointer text-disabled hover:text-body"
280
297
title = { "Expand" }
@@ -290,8 +307,8 @@ const PlayerWidget = ({
290
307
>
291
308
< ExpandIcon />
292
309
</ button >
293
- </ Tooltip >
294
- < Tooltip content = { "Close" } >
310
+ </ PlayerButton >
311
+ < PlayerButton tooltipContent = { "Close" } >
295
312
< button
296
313
className = "cursor-pointer text-disabled hover:text-body"
297
314
title = { "Close" }
@@ -303,7 +320,7 @@ const PlayerWidget = ({
303
320
>
304
321
< IoClose />
305
322
</ button >
306
- </ Tooltip >
323
+ </ PlayerButton >
307
324
</ div >
308
325
</ div >
309
326
</ div >
0 commit comments