Compare commits

..

No commits in common. "0bf9a626362301e8cc6773615402a4302939e492" and "a54c56331dbca221cb03e78d0377b06b2d957f33" have entirely different histories.

2 changed files with 1 additions and 26 deletions

View file

@ -1,25 +1,9 @@
use crate::components::websocket::WebSocketContext;
use html::Input;
use leptos::*;
use lib::models::*;
use serde_json::to_string;
#[component]
pub fn Auth() -> impl IntoView {
let websocket = expect_context::<WebSocketContext>();
let (username, _set_username) = create_signal("Anonymous");
let username_input_ref = create_node_ref::<Input>();
let send_login = move |_| {
websocket.send(
&to_string(&UserLogIn {
username: username_input_ref.get().unwrap().value(),
})
.unwrap(),
);
logging::log!("sent");
};
view! {
<div class="p-1">
<h2 class="text-2xl">Sign in:</h2>
@ -27,14 +11,6 @@ pub fn Auth() -> impl IntoView {
<input
class="w-96 font-mono rounded-sm bg-slate-900 text-slate-200"
placeholder=move || username.get()
node_ref=username_input_ref
on:change=send_login.clone()
/>
<input
class="py-2 px-4 pl-4 font-bold text-white rounded border-b-4 bg-slate-600 border-slate-800 hover:bg-slate-700 hover:border-slate-500"
type="submit"
value="Send"
on:change=send_login.clone()
/>
</div>
}

View file

@ -3,7 +3,6 @@ use html::{Input, Textarea};
use leptos::*;
use leptos_use::core::ConnectionReadyState;
use lib::models::*;
use serde_json::to_string;
#[component]
pub fn Chat() -> impl IntoView {
@ -52,7 +51,7 @@ pub fn Chat() -> impl IntoView {
// Handle sending messages
let send_message = move |_| {
websocket.send(
&to_string(&ChatMessage {
&serde_json::to_string(&ChatMessage {
text: chat_input_ref.get().unwrap().value(),
})
.unwrap(),