File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,22 @@ export default function Podcasts(): ReactElement {
120120 window . scrollTo ( { top : 0 , behavior : 'smooth' } ) ;
121121 } ;
122122
123+ const handleShare = async ( podcast : PodcastData ) => {
124+ if ( navigator . share ) {
125+ try {
126+ await navigator . share ( {
127+ title : `Check out this ${ podcast . type } ` ,
128+ url : podcast . spotifyUrl ,
129+ } ) ;
130+ } catch ( err ) {
131+ // Fallback to clipboard
132+ navigator . clipboard . writeText ( podcast . spotifyUrl ) ;
133+ }
134+ } else {
135+ navigator . clipboard . writeText ( podcast . spotifyUrl ) ;
136+ }
137+ } ;
138+
123139 const handlePodcastClick = ( podcast : PodcastData , event : React . MouseEvent | React . KeyboardEvent ) => {
124140 const target = event . target as HTMLElement ;
125141 if ( target . tagName === 'IFRAME' || target . closest ( '.podcast-embed' ) ) {
@@ -236,7 +252,10 @@ export default function Podcasts(): ReactElement {
236252 < button className = "action-btn favorite" title = "Add to favorites" >
237253 ❤️
238254 </ button >
239- < button className = "action-btn share" title = "Share podcast" >
255+ < button className = "action-btn share" title = "Share podcast" onClick = { ( e ) => {
256+ e . stopPropagation ( ) ;
257+ handleShare ( podcast ) ;
258+ } } >
240259 🔗
241260 </ button >
242261 </ div >
You can’t perform that action at this time.
0 commit comments