nav: fix accounts nav animations

also make nav go backward when clicking the account switch button if we
already are navigating to accounts

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-09-16 16:53:37 -07:00
parent 79a447239a
commit fce82b2b6d
3 changed files with 24 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
use egui::{Button, Layout, SidePanel, Vec2, Widget};
use crate::{
account_manager::AccountsRoute,
column::Column,
route::{Route, Router},
ui::profile_preview_controller,
@@ -89,8 +90,16 @@ impl<'a> DesktopSidePanel<'a> {
match action {
SidePanelAction::Panel => {} // TODO
SidePanelAction::Account => {
router.route_to(Route::accounts());
//app.show_account_switcher = !app.show_account_switcher,
if router
.routes()
.iter()
.any(|&r| r == Route::Accounts(AccountsRoute::Accounts))
{
// return if we are already routing to accounts
router.go_back();
} else {
router.route_to(Route::accounts());
}
}
SidePanelAction::Settings => {} // TODO
SidePanelAction::Columns => (), // TODO