Simplify watched status toggling in film details modal
This commit is contained in:
parent
e1fbc92e08
commit
ebf777a73b
1 changed files with 4 additions and 5 deletions
|
|
@ -15,7 +15,7 @@ pub struct FilmDetails {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub enum FilmDetailsInput {
|
||||
WatchedStatusChanged(bool),
|
||||
ToggleWatchedStatus,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -59,9 +59,7 @@ impl Component for FilmDetails {
|
|||
#[watch]
|
||||
set_label: if model.film_overview.watched { "Watched" } else { "Watch" },
|
||||
set_active: model.film_overview.watched,
|
||||
connect_toggled[sender] => move |watch_button| {
|
||||
sender.input(FilmDetailsInput::WatchedStatusChanged(watch_button.is_active()));
|
||||
},
|
||||
connect_toggled => FilmDetailsInput::ToggleWatchedStatus,
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -96,7 +94,8 @@ impl Component for FilmDetails {
|
|||
_root: >k4::Box,
|
||||
) {
|
||||
match message {
|
||||
FilmDetailsInput::WatchedStatusChanged(watched) => {
|
||||
FilmDetailsInput::ToggleWatchedStatus => {
|
||||
let watched = !self.film_overview.watched;
|
||||
self.film_overview.watched = watched;
|
||||
sender.emit_output(FilmDetailsOutput::WatchedStatusChanged(watched));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue