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

@@ -72,10 +72,21 @@ impl<R: Clone> Router<R> {
self.routes.push(route);
}
/// Go back, start the returning process
pub fn go_back(&mut self) -> Option<R> {
if self.returning || self.routes.len() == 1 {
return None;
}
self.returning = true;
self.routes.get(self.routes.len() - 2).cloned()
}
/// Pop a route, should only be called on a NavRespose::Returned reseponse
pub fn pop(&mut self) -> Option<R> {
if self.routes.len() == 1 {
return None;
}
self.returning = false;
self.routes.pop()
}