This commit is contained in:
Mikhail Kilin
2026-01-22 15:26:15 +03:00
parent 1ef341d907
commit c18f43664e
10 changed files with 436 additions and 87 deletions

View File

@@ -28,6 +28,8 @@ pub struct App {
// Search state
pub is_searching: bool,
pub search_query: String,
/// Флаг для оптимизации рендеринга - перерисовывать только при изменениях
pub needs_redraw: bool,
}
impl App {
@@ -53,9 +55,15 @@ impl App {
is_loading: true,
is_searching: false,
search_query: String::new(),
needs_redraw: true,
}
}
/// Помечает UI как требующий перерисовки
pub fn mark_dirty(&mut self) {
self.needs_redraw = true;
}
pub fn next_chat(&mut self) {
let filtered = self.get_filtered_chats();
if filtered.is_empty() {
@@ -106,7 +114,9 @@ impl App {
self.current_messages.clear();
self.message_input.clear();
self.message_scroll_offset = 0;
// Очищаем данные в TdClient
self.td_client.current_chat_id = None;
self.td_client.current_chat_messages.clear();
}
pub fn select_first_chat(&mut self) {