26 lines
784 B
Rust
26 lines
784 B
Rust
use egui::{ComboBox, Label, SidePanel, Ui, Widget};
|
|
|
|
use crate::ctx::ClientCTX;
|
|
|
|
#[derive(Default)]
|
|
pub struct ChatsScreen {
|
|
chats: Vec<String>,
|
|
selected_chat: Option<String>,
|
|
}
|
|
|
|
impl ChatsScreen {
|
|
pub fn update(&mut self, egui_ctx: &egui::Context, ctx: &mut ClientCTX, ui: &mut Ui) {
|
|
SidePanel::new(egui::panel::Side::Left, "chats_list")
|
|
.resizable(false)
|
|
.show_inside(ui, |ui| {
|
|
for chat in &self.chats {
|
|
let label = Label::new(format!("{}", chat)).ui(ui);
|
|
if label.clicked() {
|
|
self.selected_chat = Some(format!("Chat {}", chat));
|
|
}
|
|
}
|
|
});
|
|
ui.label(&format!("Chat : {:?}", self.selected_chat));
|
|
}
|
|
}
|