diff --git a/Cargo.lock b/Cargo.lock index dd928cd..10e9b06 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -264,6 +264,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "console_log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501a375961cef1a0d44767200e66e4a559283097e91d0730b1d75dfb2f8a1494" +dependencies = [ + "log", + "web-sys", +] + [[package]] name = "cookie" version = "0.16.0" @@ -770,6 +780,26 @@ dependencies = [ "web-sys", ] +[[package]] +name = "gloo-net" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2899cb1a13be9020b010967adc6b2a8a343b6f1428b90238c9d53ca24decc6db" +dependencies = [ + "futures-channel", + "futures-core", + "futures-sink", + "gloo-utils", + "js-sys", + "pin-project", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "gloo-render" version = "0.1.1" @@ -916,6 +946,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "html-escape" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e7479fa1ef38eb49fb6a42c426be515df2d063f06cb8efd3e50af073dbc26c" +dependencies = [ + "utf8-width", +] + [[package]] name = "http" version = "0.2.8" @@ -1109,11 +1148,16 @@ name = "lan_party_web" version = "0.1.0" dependencies = [ "anyhow", + "console_log", "js-sys", "lan_party_core", + "log", "paste", + "reqwasm", "serde", "serde_json", + "sycamore", + "sycamore-router", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -1706,6 +1750,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "reqwasm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05b89870d729c501fa7a68c43bf4d938bbb3a8c156d333d90faa0e8b3e3212fb" +dependencies = [ + "gloo-net", +] + [[package]] name = "resolv-conf" version = "0.7.0" @@ -2178,6 +2231,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slotmap" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" +dependencies = [ + "version_check", +] + [[package]] name = "smallvec" version = "1.9.0" @@ -2349,6 +2411,116 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +[[package]] +name = "sycamore" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a7d42f5f04604dfee0076676ec1763d26eeb7c6704139913bee6651fe0cbe1" +dependencies = [ + "ahash", + "futures", + "indexmap", + "js-sys", + "paste", + "sycamore-core", + "sycamore-futures", + "sycamore-macro", + "sycamore-reactive", + "sycamore-web", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "sycamore-core" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62c65f176ac1e7e83f9b9848a5c8b33f19d90fd20cba03e6b118bcdf2857145f" +dependencies = [ + "ahash", + "sycamore-reactive", +] + +[[package]] +name = "sycamore-futures" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69e4f2b65a22059f711cb36adc454791248e9abdc0b6b04c5dda396098674f2" +dependencies = [ + "futures", + "sycamore-reactive", + "tokio", + "wasm-bindgen-futures", +] + +[[package]] +name = "sycamore-macro" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "648b65d7362cb4c0ea969f2c387dcd88d26c3b73b852fa01b167bb36ab336b56" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sycamore-reactive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6376b578ad32f5f3ab6943bccec906fb0e1f0258a8bedf811afdec8c3330ef80" +dependencies = [ + "ahash", + "bumpalo", + "indexmap", + "serde", + "slotmap", + "smallvec", +] + +[[package]] +name = "sycamore-router" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "123b34a150dac877d7bfae82dadfb0c586fd35a8f5fcdf1721dafa079fdc4c40" +dependencies = [ + "sycamore", + "sycamore-router-macro", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "sycamore-router-macro" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92914a2f809b636d245b28d8a734801ecb8ff9c4996bbe6ea4176582e12503eb" +dependencies = [ + "nom", + "proc-macro2", + "quote", + "syn", + "unicode-xid", +] + +[[package]] +name = "sycamore-web" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c29a5344ccd47e9b7d18acb810f7d9200bbf0bed90543be58ffe6e1eee132b5" +dependencies = [ + "html-escape", + "indexmap", + "js-sys", + "once_cell", + "sycamore-core", + "sycamore-reactive", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "syn" version = "1.0.99" @@ -2781,6 +2953,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8-width" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5190c9442dcdaf0ddd50f37420417d219ae5261bbf5db120d0f9bab996c9cba1" + [[package]] name = "uuid" version = "0.8.2" diff --git a/core/src/user.rs b/core/src/user.rs index 8cc38d4..9480cd6 100644 --- a/core/src/user.rs +++ b/core/src/user.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; /// # User /// /// A user that represents a person participating in the LAN party -#[derive(Clone, Debug, Default)] +#[derive(Clone, Debug, Default, PartialEq)] #[cfg_attr(feature = "openapi", derive(JsonSchema))] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct User { diff --git a/web/Cargo.toml b/web/Cargo.toml index dad1bc1..3eeaf6b 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -7,7 +7,9 @@ edition = "2021" [dependencies] yew = "0.19" +#yew = { git = "https://github.com/yewstack/yew" } yew-router = "0.16" +#yew-router = { git = "https://github.com/yewstack/yew" } web-sys = { version = "0.3", features = ["Request", "RequestInit", "RequestMode", "Response", "Headers", "HtmlSelectElement"] } lan_party_core = { path = "../core", features = ["serde"] } wasm-bindgen = { version = "0.2", features = ["serde-serialize"] } @@ -16,6 +18,15 @@ serde = "1" serde_json = "1" thiserror = "1" yew-hooks = "0.1" +#yew-hooks = { git = "https://github.com/jetli/yew-hooks.git" } anyhow = "1.0" js-sys = "0.3" paste = "1" +sycamore = { version = "0.8.1", features = ["serde", "suspense"] } +sycamore-router = "0.8.0" +reqwasm = "0.5" +console_log = "0.2" +log = "0.4" + + + diff --git a/web/dist/index.html b/web/dist/index.html index b091628..aac155c 100644 --- a/web/dist/index.html +++ b/web/dist/index.html @@ -4,9 +4,9 @@