@@ -4,6 +4,8 @@ import { CustomAudioPlayer } from '@/components/ocodo-ui/custom-audio-component'
44import { useEffect , type FC } from 'react' ;
55import { UvxYtdlpIcon } from '@/components/branding/uvxytdlp-icon' ;
66import { useAudioPlayerContext } from '@/contexts/audio-player-context-provider' ;
7+ import { PauseIcon , PlayIcon } from 'lucide-react' ;
8+ import { thinIconStyle } from '@/lib/icon-style' ;
79
810interface AudioPlayerProps {
911 fileName : string ;
@@ -13,9 +15,9 @@ const fileToTitle = (fileName: string): string => fileName.replace(/\.[^/.]+$/,
1315
1416export const AudioPlayer : FC < AudioPlayerProps > = ( { fileName } ) => {
1517 const title = fileToTitle ( fileName )
16- const ext = fileName . replace ( `${ title } .` , '' )
18+ const ext = fileName . replace ( `${ title } .` , '' )
1719 const { apiBase } = useApiBase ( )
18- const { setSrc } = useAudioPlayerContext ( )
20+ const { setSrc, toggleAudioPlayPause , isPlaying } = useAudioPlayerContext ( )
1921
2022 useEffect ( ( ) => {
2123 if ( apiBase && fileName ) {
@@ -26,19 +28,41 @@ export const AudioPlayer: FC<AudioPlayerProps> = ({ fileName }) => {
2628
2729 return (
2830 < div className = { `select-none grid grid-cols-1 md:grid-cols-[auto_1fr] gap-4 p-4
29- justify-center items-center sm:border sm:rounded-xl` } >
30- < div className = 'flex flex-row items-center justify-center' >
31- < Img
32- className = "h-[15em] bg-background/20 rounded-xl object-cover"
33- src = { `${ apiBase } /thumbnail/${ fileName } ` }
34- unloader = { < UvxYtdlpIcon
35- size = { 301 }
36- colors = { [ "#6004" , "#0604" , "#0064" ] }
37- strokeWidth = { 6 }
38- totalDuration = { 10000 }
39- fadeDuration = { 3000 }
40- /> }
41- />
31+ justify-center items-center sm:border sm:rounded-x relative` } >
32+ < div
33+ onClick = { ( ) => toggleAudioPlayPause ( ) }
34+ className = 'group flex flex-row items-center justify-center'
35+ >
36+ < div
37+ className = { `absolute cursor-pointer opacity-10
38+ group-hover:opacity-100
39+ transition-opacity duration-500
40+ rounded-full bg-background/30
41+ w-20 h-20 mb-[22px]
42+ flex flex-row items-center justify-center` } >
43+ { isPlaying
44+ ? < PauseIcon
45+ style = { { stroke : '#fff' , ...thinIconStyle } }
46+ className = "w-12 h-12 ml-[3px]" />
47+ : < PlayIcon
48+ style = { { stroke : '#fff' , ...thinIconStyle } }
49+ className = "w-12 h-12 ml-[3px]" />
50+ }
51+ </ div >
52+ < div className = 'flex flex-row items-center justify-center' >
53+ < Img
54+ className = "h-[15em] bg-background/20 rounded-xl object-cover"
55+ src = { `${ apiBase } /thumbnail/${ fileName } ` }
56+ unloader = { < UvxYtdlpIcon
57+ size = { 301 }
58+ colors = { [ "#6004" , "#0604" , "#0064" ] }
59+ strokeWidth = { 6 }
60+ totalDuration = { 10000 }
61+ fadeDuration = { 3000 }
62+ /> }
63+ />
64+ </ div >
65+
4266 </ div >
4367 { /* Col 2 */ }
4468 < div className = "grid grid-rows-[1fr_auto] h-full gap-4" >
0 commit comments