From 10a9ca166cf2685ea0c8e87576284573f772122d Mon Sep 17 00:00:00 2001 From: Uncle Stretch Date: Wed, 25 Dec 2024 13:18:08 +0300 Subject: [PATCH] inverse the logs queue, ascending order for events Signed-off-by: Uncle Stretch --- src/components/wallet/event_logs.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/wallet/event_logs.rs b/src/components/wallet/event_logs.rs index d772f12..f50c324 100644 --- a/src/components/wallet/event_logs.rs +++ b/src/components/wallet/event_logs.rs @@ -39,18 +39,15 @@ impl EventLogs { const MAX_LOGS: usize = 50; fn add_new_log(&mut self, message: String, level: ActionLevel) { - self.logs.push_back(WalletLog { + self.logs.push_front(WalletLog { time: chrono::Local::now(), level, message, }); 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) {