inverse the logs queue, ascending order for events

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2024-12-25 13:18:08 +03:00
parent 9704af3978
commit 10a9ca166c
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA

View File

@ -39,18 +39,15 @@ impl EventLogs {
const MAX_LOGS: usize = 50; const MAX_LOGS: usize = 50;
fn add_new_log(&mut self, message: String, level: ActionLevel) { fn add_new_log(&mut self, message: String, level: ActionLevel) {
self.logs.push_back(WalletLog { self.logs.push_front(WalletLog {
time: chrono::Local::now(), time: chrono::Local::now(),
level, level,
message, message,
}); });
if self.logs.len() > Self::MAX_LOGS { if self.logs.len() > Self::MAX_LOGS {
let _ = self.logs.pop_front(); let _ = self.logs.pop_back();
} }
self.table_state.select(Some(self.logs.len() - 1));
self.scroll_state = self.scroll_state.content_length(self.logs.len());
} }
fn first_row(&mut self) { fn first_row(&mut self) {