Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spotify_player/src/state/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ pub struct PlaylistFolderNode {
pub children: Vec<PlaylistFolderNode>,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
/// A Spotify category
pub struct Category {
pub id: String,
Expand Down
7 changes: 6 additions & 1 deletion spotify_player/src/state/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,13 @@ impl UIState {
}

pub fn new_page(&mut self, page: PageState) {
self.history.push(page);
self.popup = None;
if let Some(current_page) = self.history.last() {
if &page == current_page {
return;
}
}
self.history.push(page);
}

/// Return whether there exists a focused popup.
Expand Down
12 changes: 6 additions & 6 deletions spotify_player/src/state/ui/page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{
};
use ratatui::widgets::{ListState, TableState};

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum PageState {
Library {
state: LibraryPageUIState,
Expand Down Expand Up @@ -50,7 +50,7 @@ pub enum PageType {
Logs,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct LibraryPageUIState {
pub playlist_list: ListState,
pub saved_album_list: ListState,
Expand All @@ -59,7 +59,7 @@ pub struct LibraryPageUIState {
pub playlist_folder_id: usize,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub struct SearchPageUIState {
pub track_list: ListState,
pub album_list: ListState,
Expand All @@ -70,13 +70,13 @@ pub struct SearchPageUIState {
pub focus: SearchFocusState,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum ContextPageType {
CurrentPlaying,
Browsing(ContextId),
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum ContextPageUIState {
Playlist {
track_table: TableState,
Expand Down Expand Up @@ -123,7 +123,7 @@ pub enum SearchFocusState {
Episodes,
}

#[derive(Clone, Debug)]
#[derive(Clone, Debug, PartialEq)]
pub enum BrowsePageUIState {
CategoryList {
state: ListState,
Expand Down
2 changes: 1 addition & 1 deletion spotify_player/src/ui/single_line_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use ratatui::widgets::Widget;
use super::{Line, Modifier, Paragraph, Span, Style};
use crate::key::Key;

#[derive(Debug, Clone)]
#[derive(Debug, Clone, PartialEq)]
pub struct LineInput {
// This is less space-efficient than String, but it's easier to work with text manipulation at the
// cursor. Otherwise, you have to shuffle back and forth between String and String::chars().
Expand Down
Loading