11import { useNavigate } from '@tanstack/react-router' ;
2- import { EllipsisVerticalIcon , PlayIcon , Trash2Icon } from 'lucide-react' ;
2+ import {
3+ EllipsisVerticalIcon ,
4+ PlayIcon ,
5+ ShareIcon ,
6+ Trash2Icon ,
7+ } from 'lucide-react' ;
38import { useState , type FC } from 'react' ;
49
510import { useTranslation } from '@nuclearplayer/i18n' ;
611import type { Track } from '@nuclearplayer/model' ;
712import { Button , Dialog , Popover } from '@nuclearplayer/ui' ;
813
14+ import { usePlaylistExport } from '../../../hooks/usePlaylistExport' ;
915import { useQueueActions } from '../../../hooks/useQueueActions' ;
1016import { usePlaylistStore } from '../../../stores/playlistStore' ;
1117import { useSoundStore } from '../../../stores/soundStore' ;
@@ -24,6 +30,7 @@ export const PlaylistDetailActions: FC<PlaylistDetailActionsProps> = ({
2430 const { addToQueue, clearQueue } = useQueueActions ( ) ;
2531 const deletePlaylist = usePlaylistStore ( ( state ) => state . deletePlaylist ) ;
2632 const [ isDeleteDialogOpen , setIsDeleteDialogOpen ] = useState ( false ) ;
33+ const { exportAsJson } = usePlaylistExport ( playlistId ) ;
2734
2835 const handlePlayAll = ( ) => {
2936 clearQueue ( ) ;
@@ -50,31 +57,37 @@ export const PlaylistDetailActions: FC<PlaylistDetailActionsProps> = ({
5057 </ Button >
5158 < Popover
5259 className = "relative"
53- panelClassName = "bg-background px-0 py-1 "
60+ panelClassName = "bg-background px-0 py-0 "
5461 trigger = {
5562 < Button size = "icon" data-testid = "playlist-actions-button" >
5663 < EllipsisVerticalIcon size = { 16 } />
5764 </ Button >
5865 }
5966 anchor = "bottom start"
6067 >
61- < div className = "flex flex-col" >
62- < button
63- className = "hover:border-border hover:bg-background-secondary flex w-full cursor-pointer items-center gap-3 border-t border-transparent px-3 py-2 text-left text-sm not-last:border-b"
68+ < Popover . Menu >
69+ < Popover . Item
6470 onClick = { handleAddToQueue }
6571 data-testid = "add-to-queue-action"
6672 >
6773 { t ( 'addToQueue' ) }
68- </ button >
69- < button
70- className = "text-accent-red hover:border-border hover:bg-background-secondary flex w-full cursor-pointer items-center gap-3 border-t border-transparent px-3 py-2 text-left text-sm not-last:border-b"
74+ </ Popover . Item >
75+ < Popover . Item
76+ icon = { < ShareIcon size = { 16 } /> }
77+ onClick = { exportAsJson }
78+ data-testid = "export-json-action"
79+ >
80+ { t ( 'exportJson' ) }
81+ </ Popover . Item >
82+ < Popover . Item
83+ intent = "danger"
84+ icon = { < Trash2Icon size = { 16 } /> }
7185 onClick = { ( ) => setIsDeleteDialogOpen ( true ) }
7286 data-testid = "delete-playlist-action"
7387 >
74- < Trash2Icon size = { 16 } />
7588 { t ( 'delete' ) }
76- </ button >
77- </ div >
89+ </ Popover . Item >
90+ </ Popover . Menu >
7891 </ Popover >
7992 </ div >
8093 < Dialog . Root
0 commit comments