ui: update account management to design

Closes: https://github.com/damus-io/notedeck/issues/486
Fixes: https://github.com/damus-io/notedeck/issues/444
Signed-off-by: kernelkind <kernelkind@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
kernelkind
2024-11-26 23:40:33 -05:00
committed by William Casarin
parent 409e8c2e3a
commit 0ac131ef06
5 changed files with 105 additions and 78 deletions

View File

@@ -131,7 +131,16 @@ impl Accounts {
self.select_account(selected_index - 1);
}
Ordering::Equal => {
self.clear_selected_account();
if self.accounts.is_empty() {
// If no accounts remain, clear the selection
self.clear_selected_account();
} else if index >= self.accounts.len() {
// If the removed account was the last one, select the new last account
self.select_account(self.accounts.len() - 1);
} else {
// Otherwise, select the account at the same position
self.select_account(index);
}
}
Ordering::Less => {}
}