diff --git a/src/app.rs b/src/app.rs index 05c0256d..89cfe67b 100644 --- a/src/app.rs +++ b/src/app.rs @@ -244,7 +244,7 @@ impl MatchEvent for App { } if matches!( - action.as_widget_action().cast(), + action.cast(), DownloadNotificationPopupAction::ActionLinkClicked | DownloadNotificationPopupAction::CloseButtonClicked ) { diff --git a/src/chat/chat_history_card.rs b/src/chat/chat_history_card.rs index 470f0c73..121c34ff 100644 --- a/src/chat/chat_history_card.rs +++ b/src/chat/chat_history_card.rs @@ -346,7 +346,7 @@ impl WidgetMatchEvent for ChatHistoryCard { for action in actions { if matches!( - action.as_widget_action().cast(), + action.cast(), DeleteChatModalAction::Cancelled | DeleteChatModalAction::CloseButtonClicked | DeleteChatModalAction::ChatDeleted diff --git a/src/chat/delete_chat_modal.rs b/src/chat/delete_chat_modal.rs index ae08efe8..85176b5c 100644 --- a/src/chat/delete_chat_modal.rs +++ b/src/chat/delete_chat_modal.rs @@ -181,27 +181,26 @@ impl Widget for DeleteChatModal { impl WidgetMatchEvent for DeleteChatModal { fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions, scope: &mut Scope) { - let widget_uid = self.widget_uid(); if self.button(id!(close_button)).clicked(actions) { - cx.widget_action(widget_uid, &scope.path, DeleteChatModalAction::CloseButtonClicked); + cx.action(DeleteChatModalAction::CloseButtonClicked); } if self - .button(id!(wrapper.body.actions.delete_button)) + .button(id!(delete_button)) .clicked(actions) { let store = scope.data.get_mut::().unwrap(); store.delete_chat(self.chat_id); - cx.widget_action(widget_uid, &scope.path, DeleteChatModalAction::ChatDeleted); + cx.action(DeleteChatModalAction::ChatDeleted); cx.redraw_all(); } if self - .button(id!(wrapper.body.actions.cancel_button)) + .button(id!(cancel_button)) .clicked(actions) { - cx.widget_action(widget_uid, &scope.path, DeleteChatModalAction::Cancelled); + cx.action(DeleteChatModalAction::Cancelled); } } } diff --git a/src/landing/landing_screen.rs b/src/landing/landing_screen.rs index fb9e7081..d82458b4 100644 --- a/src/landing/landing_screen.rs +++ b/src/landing/landing_screen.rs @@ -147,7 +147,7 @@ impl Widget for LandingScreen { impl WidgetMatchEvent for LandingScreen { fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions, scope: &mut Scope) { for action in actions.iter() { - match action.as_widget_action().cast() { + match action.cast() { ModelListAction::ScrolledAtTop => { if self.search_bar_state == SearchBarState::CollapsedWithoutFilters { self.search_bar_state = SearchBarState::ExpandedWithoutFilters; diff --git a/src/landing/model_card.rs b/src/landing/model_card.rs index 85f71ba2..ad1b0e33 100644 --- a/src/landing/model_card.rs +++ b/src/landing/model_card.rs @@ -415,7 +415,7 @@ impl WidgetMatchEvent for ModelCard { } for action in actions { - if let ModelCardViewAllModalAction::CloseButtonClicked = action.as_widget_action().cast() { + if let ModelCardViewAllModalAction::CloseButtonClicked = action.cast() { self.modal(id!(modal)).close(cx); self.redraw(cx); } @@ -457,10 +457,9 @@ impl Widget for ModelCardViewAllModal { impl WidgetMatchEvent for ModelCardViewAllModal { fn handle_actions(&mut self, cx: &mut Cx, actions: &Actions, scope: &mut Scope) { - let widget_uid = self.widget_uid(); if self.button(id!(close_button)).clicked(actions) { - cx.widget_action(widget_uid, &scope.path, ModelCardViewAllModalAction::CloseButtonClicked); + cx.action(ModelCardViewAllModalAction::CloseButtonClicked); } } } diff --git a/src/landing/model_list.rs b/src/landing/model_list.rs index 6c15a4cc..6bed50e4 100644 --- a/src/landing/model_list.rs +++ b/src/landing/model_list.rs @@ -137,13 +137,12 @@ impl WidgetMatchEvent for ModelList { } if portal_list.scrolled(actions) { - let widget_uid = self.widget_uid(); if portal_list.first_id() == 0 && portal_list.scroll_position() > SCROLLING_AT_TOP_THRESHOLD { - cx.widget_action(widget_uid, &scope.path, ModelListAction::ScrolledAtTop); + cx.action(ModelListAction::ScrolledAtTop); } else { - cx.widget_action(widget_uid, &scope.path, ModelListAction::ScrolledNotAtTop); + cx.action(ModelListAction::ScrolledNotAtTop); } } } diff --git a/src/shared/download_notification_popup.rs b/src/shared/download_notification_popup.rs index 96c6231d..35dd6e5a 100644 --- a/src/shared/download_notification_popup.rs +++ b/src/shared/download_notification_popup.rs @@ -250,7 +250,7 @@ impl WidgetMatchEvent for DownloadNotificationPopup { let widget_uid = self.widget_uid(); if self.button(id!(close_button)).clicked(actions) { - cx.widget_action(widget_uid, &scope.path, DownloadNotificationPopupAction::CloseButtonClicked); + cx.action(DownloadNotificationPopupAction::CloseButtonClicked); } if self @@ -259,7 +259,7 @@ impl WidgetMatchEvent for DownloadNotificationPopup { { // TODO: Abstract the navigation actions on a single enum for the whole app. cx.action(PopupAction::NavigateToMyModels); - cx.widget_action(widget_uid, &scope.path, DownloadNotificationPopupAction::ActionLinkClicked); + cx.action(DownloadNotificationPopupAction::ActionLinkClicked); } if self.link_label(id!(retry_link)).clicked(actions) { @@ -269,7 +269,7 @@ impl WidgetMatchEvent for DownloadNotificationPopup { &scope.path, DownloadAction::Play(file_id.clone()), ); - cx.widget_action(widget_uid, &scope.path, DownloadNotificationPopupAction::ActionLinkClicked); + cx.action(DownloadNotificationPopupAction::ActionLinkClicked); } if self.link_label(id!(cancel_link)).clicked(actions) { @@ -279,7 +279,7 @@ impl WidgetMatchEvent for DownloadNotificationPopup { &scope.path, DownloadAction::Cancel(file_id.clone()), ); - cx.widget_action(widget_uid, &scope.path, DownloadNotificationPopupAction::ActionLinkClicked); + cx.action(DownloadNotificationPopupAction::ActionLinkClicked); } } }