Modify playstatus to keep track of queue status and derive Clone for songdata

This commit is contained in:
Connor Wittman 2024-02-02 17:17:16 -05:00
parent 7ed5561262
commit c924b5613f
2 changed files with 4 additions and 1 deletions

View File

@ -9,6 +9,8 @@ use crate::songdata::SongData;
pub struct PlayStatus { pub struct PlayStatus {
/// Whether or not the audio player is currently playing /// Whether or not the audio player is currently playing
pub playing: bool, pub playing: bool,
/// Whether or not the queue is open
pub queue_open: bool,
/// A reference to the HTML audio element /// A reference to the HTML audio element
pub audio_player: Option<NodeRef<Audio>>, pub audio_player: Option<NodeRef<Audio>>,
/// A queue of songs that have been played, ordered from oldest to newest /// A queue of songs that have been played, ordered from oldest to newest
@ -53,6 +55,7 @@ impl Default for PlayStatus {
fn default() -> Self { fn default() -> Self {
Self { Self {
playing: false, playing: false,
queue_open: false,
audio_player: None, audio_player: None,
history: VecDeque::new(), history: VecDeque::new(),
queue: VecDeque::new(), queue: VecDeque::new(),

View File

@ -1,5 +1,5 @@
/// Holds information about a song /// Holds information about a song
#[derive(Debug)] #[derive(Debug, Clone)]
pub struct SongData { pub struct SongData {
/// Song name /// Song name
pub name: String, pub name: String,