@@ -91,14 +91,25 @@ export type ContextMenuProps = {
9191 onClose : ( ) => void ;
9292 item ?: Artist | Album | Track ;
9393 type : 'artist' | 'album' | 'track' | '' ;
94+ onPlayNext : ( item : Album | Track ) => void ;
95+ onAddToPlaylist : ( item : Album | Track ) => void ;
96+ onDownload : ( item : Album | Track ) => void ;
97+ onGoToArtist : ( item : Album | Track ) => void ;
98+ onGoToAlbum : ( item : Album | Track ) => void ;
9499} ;
95100
96- const ContextMenu : FC < ContextMenuProps > = ( {
97- isVisible,
98- onClose,
99- item,
100- type,
101- } ) => {
101+ const ContextMenu : FC < ContextMenuProps > = props => {
102+ const {
103+ isVisible,
104+ onClose,
105+ onAddToPlaylist,
106+ onDownload,
107+ onGoToAlbum,
108+ onGoToArtist,
109+ onPlayNext,
110+ item,
111+ type,
112+ } = props ;
102113 const itemCover = {
103114 artist : ( item as Artist ) ?. picture ,
104115 album : ( item as Album ) ?. cover ,
@@ -136,7 +147,7 @@ const ContextMenu: FC<ContextMenuProps> = ({
136147 </ MediaInfo >
137148 </ MetadataRow >
138149 < Separator />
139- < Action >
150+ < Action onPress = { ( ) => onPlayNext ( item as Album | Track ) } >
140151 < ActionWrapper >
141152 < IconWrapper >
142153 < MaterialIcons name = "playlist-play" size = { 31 } color = "#ab28fc" />
@@ -146,7 +157,7 @@ const ContextMenu: FC<ContextMenuProps> = ({
146157 </ Action >
147158 { ( type === 'track' || type === 'album' ) && (
148159 < >
149- < Action >
160+ < Action onPress = { ( ) => onDownload ( item as Album | Track ) } >
150161 < ActionWrapper >
151162 < IconWrapper >
152163 < MaterialCommunity
@@ -158,7 +169,7 @@ const ContextMenu: FC<ContextMenuProps> = ({
158169 < ActionTitle > Download</ ActionTitle >
159170 </ ActionWrapper >
160171 </ Action >
161- < Action >
172+ < Action onPress = { ( ) => onAddToPlaylist ( item as Album | Track ) } >
162173 < ActionWrapper >
163174 < IconWrapper >
164175 < MaterialIcons
@@ -170,15 +181,15 @@ const ContextMenu: FC<ContextMenuProps> = ({
170181 < ActionTitle > Add to playlist</ ActionTitle >
171182 </ ActionWrapper >
172183 </ Action >
173- < Action >
184+ < Action onPress = { ( ) => onGoToAlbum ( item as Album | Track ) } >
174185 < ActionWrapper >
175186 < IconWrapper >
176187 < Feather name = "disc" size = { 24 } color = "#ab28fc" />
177188 </ IconWrapper >
178189 < ActionTitle > Go to Album</ ActionTitle >
179190 </ ActionWrapper >
180191 </ Action >
181- < Action >
192+ < Action onPress = { ( ) => onGoToArtist ( item as Album | Track ) } >
182193 < ActionWrapper >
183194 < IconWrapper >
184195 < SvgMic height = { 26 } width = { 26 } fill = "#ab28fc" />
0 commit comments