//! View for a logged in session use std::collections::HashMap; use iced::{Element, Row, Space}; use matrix_sdk::{ruma::RoomId, Client}; /// The main view, for a logged in session #[derive(Clone, Debug)] pub struct View { client: matrix_sdk::Client, /// List of known rooms room_list: RoomList, /// Widget state state: State, } /// Widget state. #[derive(Clone, Debug, Default)] struct State {} /// The list of rooms #[derive(Clone, Debug, Default)] pub struct RoomList { names: HashMap, } impl RoomList { fn view(&mut self) -> Element { Space::new(0.into(), 0.into()).into() } } /// State change notification #[derive(Debug)] pub enum Message { /// The name for a room has been recalculated. RoomName(RoomId, String), } impl View { /// Create a new view. pub fn with_client(client: Client) -> Self { Self { client, room_list: RoomList::default(), state: State::default() } } /// Generate widgets pub fn view(&mut self) -> Element { Row::new().push(self.room_list.view()).into() } }