working chat!

This commit is contained in:
2024-09-28 15:54:11 -06:00
parent 8f420e6efa
commit 58a7ecd88b
2 changed files with 47 additions and 21 deletions
+4 -3
View File
@@ -14,6 +14,7 @@ pub enum ConnectionState {
Connected,
}
#[derive(Debug)]
pub enum Command {
Connect {
address: String,
@@ -106,9 +107,9 @@ pub fn Channel(id: ChannelId) -> Element {
#[component]
pub fn ChatView() -> Element {
let net: Coroutine<Command> = use_coroutine_handle();
let server = STATE.server.read();
let mut draft = use_signal(|| "".to_string());
//let net: Coroutine<Command> = use_coroutine_handle();
rsx!(
div {
style: "margin: 16px; padding: 16px; border: solid black 1px;",
@@ -132,12 +133,12 @@ pub fn ChatView() -> Element {
}
button {
onclick: move |_| {
/*if let Some(user) = server.this_user() {
if let Some(user) = STATE.server.read().this_user() {
net.send(SendChat {
markdown: draft.write().split_off(0),
channels: vec![user.channel],
});
}*/
}
},
"Send"
}