@@ -4,18 +4,20 @@ import PlaylistIcon from "../../components/PlaylistIcon";
44import { RotatingBorderBox } from "../../components/RotatingBorderBox" ;
55import Modal from "../../components/Modal" ;
66import { Playlist } from "../../interfaces/Playlist" ;
7- import { addAlbumToPlaylist } from "../../api" ;
7+ import { addAlbumToPlaylist , startPlayback } from "../../api" ;
88import { useModal } from "../../hooks/useModal" ;
99import Button from "../../components/Button" ;
1010
1111interface AlbumContainerProps {
1212 album : Album ;
13+ contextPlaylist : Playlist
1314 associatedPlaylists : Playlist [ ] ;
1415 active ?: boolean ;
1516}
1617
1718export const AlbumContainer : FC < AlbumContainerProps > = ( {
1819 album,
20+ contextPlaylist,
1921 associatedPlaylists,
2022 active,
2123} ) => {
@@ -31,6 +33,7 @@ export const AlbumContainer: FC<AlbumContainerProps> = ({
3133 < >
3234 < Modal isModalOpen = { isModalOpen } closeModal = { closeModal } >
3335 < AlbumActionsModalContent
36+ contextPlaylist = { contextPlaylist }
3437 associatedPlaylists = { associatedPlaylists }
3538 album = { album }
3639 closeModal = { closeModal }
@@ -80,11 +83,13 @@ export const AlbumContainer: FC<AlbumContainerProps> = ({
8083
8184interface AlbumActionsModalContentProps {
8285 album : Album ;
86+ contextPlaylist : Playlist
8387 associatedPlaylists : Playlist [ ] ;
8488 closeModal : ( ) => void ;
8589}
8690const AlbumActionsModalContent : FC < AlbumActionsModalContentProps > = ( {
8791 album,
92+ contextPlaylist,
8893 associatedPlaylists,
8994 closeModal,
9095} ) => {
@@ -98,7 +103,7 @@ const AlbumActionsModalContent: FC<AlbumActionsModalContentProps> = ({
98103 < h2 className = "my-auto text-m" > Actions:</ h2 >
99104 < button onClick = { closeModal } > X</ button >
100105 </ div >
101- < div className = "my-2 space-y-2" >
106+ < div className = "flex flex-col my-2 space-y-2" >
102107 { associatedPlaylists . map ( ( associatedPlaylist ) => (
103108 < Button
104109 onClick = { ( ) => addAlbumToAssociatedPlaylist ( associatedPlaylist ) }
@@ -107,6 +112,11 @@ const AlbumActionsModalContent: FC<AlbumActionsModalContentProps> = ({
107112 Add to { associatedPlaylist . name }
108113 </ Button >
109114 ) ) }
115+ < Button
116+ onClick = { ( ) => ( startPlayback ( { context_uri : contextPlaylist . uri , offset : { album_id : album . id } } ) ) }
117+ >
118+ Play Album
119+ </ Button >
110120 </ div >
111121 </ div >
112122 ) ;
0 commit comments