@@ -4,18 +4,20 @@ import PlaylistIcon from "../../components/PlaylistIcon";
4
4
import { RotatingBorderBox } from "../../components/RotatingBorderBox" ;
5
5
import Modal from "../../components/Modal" ;
6
6
import { Playlist } from "../../interfaces/Playlist" ;
7
- import { addAlbumToPlaylist } from "../../api" ;
7
+ import { addAlbumToPlaylist , startPlayback } from "../../api" ;
8
8
import { useModal } from "../../hooks/useModal" ;
9
9
import Button from "../../components/Button" ;
10
10
11
11
interface AlbumContainerProps {
12
12
album : Album ;
13
+ contextPlaylist : Playlist
13
14
associatedPlaylists : Playlist [ ] ;
14
15
active ?: boolean ;
15
16
}
16
17
17
18
export const AlbumContainer : FC < AlbumContainerProps > = ( {
18
19
album,
20
+ contextPlaylist,
19
21
associatedPlaylists,
20
22
active,
21
23
} ) => {
@@ -31,6 +33,7 @@ export const AlbumContainer: FC<AlbumContainerProps> = ({
31
33
< >
32
34
< Modal isModalOpen = { isModalOpen } closeModal = { closeModal } >
33
35
< AlbumActionsModalContent
36
+ contextPlaylist = { contextPlaylist }
34
37
associatedPlaylists = { associatedPlaylists }
35
38
album = { album }
36
39
closeModal = { closeModal }
@@ -80,11 +83,13 @@ export const AlbumContainer: FC<AlbumContainerProps> = ({
80
83
81
84
interface AlbumActionsModalContentProps {
82
85
album : Album ;
86
+ contextPlaylist : Playlist
83
87
associatedPlaylists : Playlist [ ] ;
84
88
closeModal : ( ) => void ;
85
89
}
86
90
const AlbumActionsModalContent : FC < AlbumActionsModalContentProps > = ( {
87
91
album,
92
+ contextPlaylist,
88
93
associatedPlaylists,
89
94
closeModal,
90
95
} ) => {
@@ -98,7 +103,7 @@ const AlbumActionsModalContent: FC<AlbumActionsModalContentProps> = ({
98
103
< h2 className = "my-auto text-m" > Actions:</ h2 >
99
104
< button onClick = { closeModal } > X</ button >
100
105
</ div >
101
- < div className = "my-2 space-y-2" >
106
+ < div className = "flex flex-col my-2 space-y-2" >
102
107
{ associatedPlaylists . map ( ( associatedPlaylist ) => (
103
108
< Button
104
109
onClick = { ( ) => addAlbumToAssociatedPlaylist ( associatedPlaylist ) }
@@ -107,6 +112,11 @@ const AlbumActionsModalContent: FC<AlbumActionsModalContentProps> = ({
107
112
Add to { associatedPlaylist . name }
108
113
</ Button >
109
114
) ) }
115
+ < Button
116
+ onClick = { ( ) => ( startPlayback ( { context_uri : contextPlaylist . uri , offset : { album_id : album . id } } ) ) }
117
+ >
118
+ Play Album
119
+ </ Button >
110
120
</ div >
111
121
</ div >
112
122
) ;
0 commit comments