43 lines
927 B
Rust
43 lines
927 B
Rust
|
use iced::{
|
||
|
Alignment::Center,
|
||
|
Element, Task, Theme,
|
||
|
widget::{button, column, text},
|
||
|
};
|
||
|
|
||
|
use crate::{ClientConfig, stream::connect};
|
||
|
|
||
|
#[derive(Debug, Clone)]
|
||
|
pub enum Message {
|
||
|
JoinRoom,
|
||
|
LeaveRoom,
|
||
|
MuteMicrophone,
|
||
|
UnmuteMicrophone,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug, Default)]
|
||
|
pub struct Data {
|
||
|
client_config: Option<ClientConfig>,
|
||
|
}
|
||
|
|
||
|
impl Data {
|
||
|
pub fn update(&mut self, message: Message) -> Task<Message> {
|
||
|
match message {
|
||
|
Message::JoinRoom => Task::none(),
|
||
|
Message::LeaveRoom => Task::none(),
|
||
|
Message::MuteMicrophone => Task::none(),
|
||
|
Message::UnmuteMicrophone => Task::none(),
|
||
|
}
|
||
|
}
|
||
|
|
||
|
pub fn view(&self) -> Element<'_, Message> {
|
||
|
column![button("Join Room"), text("Hello").size(50)]
|
||
|
.padding(10)
|
||
|
.align_x(Center)
|
||
|
.into()
|
||
|
}
|
||
|
|
||
|
pub fn theme(&self) -> Theme {
|
||
|
Theme::Dark
|
||
|
}
|
||
|
}
|