default select for the nominator tab
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
parent
22db763d31
commit
9dad47210b
@ -2,7 +2,7 @@
|
||||
name = "ghost-eye"
|
||||
authors = ["str3tch <stretch@ghostchain.io>"]
|
||||
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
|
||||
version = "0.3.35"
|
||||
version = "0.3.36"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
@ -66,9 +66,14 @@ impl CurrentValidators {
|
||||
|
||||
fn update_choosen_details(&self, index: usize) {
|
||||
if let Some(action_tx) = &self.action_tx {
|
||||
let (selected_account_id, selected_points) = self.individual
|
||||
.get(index)
|
||||
.map(|data| (data.account_id, data.points))
|
||||
.unwrap_or_default();
|
||||
|
||||
let _ = action_tx.send(Action::SetChoosenValidator(
|
||||
self.individual[index].account_id,
|
||||
self.individual[index].points,
|
||||
selected_account_id,
|
||||
selected_points,
|
||||
self.total_points));
|
||||
}
|
||||
}
|
||||
@ -183,13 +188,13 @@ impl CurrentValidators {
|
||||
.position(|item| item.account_id == account_id) {
|
||||
self.individual.swap(0, index);
|
||||
}
|
||||
let current_index = self.table_state.selected().unwrap_or_default();
|
||||
self.table_state.select(Some(current_index));
|
||||
self.update_choosen_details(current_index);
|
||||
}
|
||||
}
|
||||
|
||||
self.scroll_state = self.scroll_state.content_length(self.individual.len());
|
||||
if let Some(index) = self.table_state.selected() {
|
||||
self.update_choosen_details(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user