From b3b8c6b2060b7773d1e6ca23b140a7244b195a59 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Mon, 24 Oct 2022 01:53:49 +0200 Subject: Client->Frontend: Create yew frontend skeleton We have replaced the client with a yew frontend. --- .gitignore | 1 + Cargo.lock | 219 ++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 2 +- client/Cargo.toml | 12 --- client/src/main.rs | 3 - flake.nix | 3 +- frontend/Cargo.toml | 9 +++ frontend/index.html | 5 ++ frontend/src/main.rs | 12 +++ 9 files changed, 245 insertions(+), 21 deletions(-) delete mode 100644 client/Cargo.toml delete mode 100644 client/src/main.rs create mode 100644 frontend/Cargo.toml create mode 100644 frontend/index.html create mode 100644 frontend/src/main.rs diff --git a/.gitignore b/.gitignore index 2190428..d8c7f14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .direnv/ +frontend/dist/ /target diff --git a/Cargo.lock b/Cargo.lock index 8a36c19..723880c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,6 +260,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "boolinator" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfa8873f51c92e232f9bac4065cddef41b714152812bfc5f7672ba16d6ef8cd9" + [[package]] name = "brotli" version = "3.3.4" @@ -341,10 +347,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "client" -version = "0.1.0" - [[package]] name = "concurrent-queue" version = "1.2.4" @@ -354,6 +356,16 @@ dependencies = [ "cache-padded", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -568,6 +580,13 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frontend" +version = "0.1.0" +dependencies = [ + "yew", +] + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -692,6 +711,115 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "gloo" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23947965eee55e3e97a5cd142dd4c10631cc349b48cecca0ed230fd296f568cd" +dependencies = [ + "gloo-console", + "gloo-dialogs", + "gloo-events", + "gloo-file", + "gloo-render", + "gloo-storage", + "gloo-timers", + "gloo-utils", +] + +[[package]] +name = "gloo-console" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82b7ce3c05debe147233596904981848862b068862e9ec3e34be446077190d3f" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-dialogs" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67062364ac72d27f08445a46cab428188e2e224ec9e37efdba48ae8c289002e6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-events" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b107f8abed8105e4182de63845afcc7b69c098b7852a813ea7462a320992fc" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-file" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d5564e570a38b43d78bdc063374a0c3098c4f0d64005b12f9bbe87e869b6d7" +dependencies = [ + "gloo-events", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-render" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd9306aef67cfd4449823aadcd14e3958e0800aa2183955a309112a84ec7764" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-storage" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" +dependencies = [ + "gloo-utils", + "js-sys", + "serde", + "serde_json", + "thiserror", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "gloo-timers" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb7d06c1c8cc2a29bee7ec961009a0b2caa0793ee4900c2ffb348734ba1c8f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "gloo-utils" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40913a05c8297adca04392f707b1e73b12ba7b8eab7244a4961580b1fd34063c" +dependencies = [ + "js-sys", + "serde", + "serde_json", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "h2" version = "0.3.14" @@ -1406,6 +1534,30 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro-hack" version = "0.5.19" @@ -1608,6 +1760,12 @@ dependencies = [ "windows-sys 0.36.1", ] +[[package]] +name = "scoped-tls-hkt" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" + [[package]] name = "scopeguard" version = "1.1.0" @@ -1857,6 +2015,26 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" +[[package]] +name = "thiserror" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "time" version = "0.3.15" @@ -2325,6 +2503,39 @@ dependencies = [ "markup5ever 0.11.0", ] +[[package]] +name = "yew" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a1ccb53e57d3f7d847338cf5758befa811cabe207df07f543c06f502f9998cd" +dependencies = [ + "console_error_panic_hook", + "gloo", + "gloo-utils", + "indexmap", + "js-sys", + "scoped-tls-hkt", + "slab", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "yew-macro", +] + +[[package]] +name = "yew-macro" +version = "0.19.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fab79082b556d768d6e21811869c761893f0450e1d550a67892b9bce303b7bb" +dependencies = [ + "boolinator", + "lazy_static", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zstd" version = "0.11.2+zstd.1.5.2" diff --git a/Cargo.toml b/Cargo.toml index 36b7c3f..7a2596a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,4 @@ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [workspace] -members = [ "crawler", "indexer", "client" ] +members = [ "crawler", "indexer", "frontend" ] diff --git a/client/Cargo.toml b/client/Cargo.toml deleted file mode 100644 index 1cd3c2a..0000000 --- a/client/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "client" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] - -[[bin]] -name = "client" -path = "src/main.rs" diff --git a/client/src/main.rs b/client/src/main.rs deleted file mode 100644 index ccf0d30..0000000 --- a/client/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world! Im the client!"); -} diff --git a/flake.nix b/flake.nix index e21c25b..439cb07 100644 --- a/flake.nix +++ b/flake.nix @@ -23,8 +23,9 @@ pkgconfig (rust-bin.beta.latest.default.override { extensions = [ "rust-src" ]; - targets = [ "x86_64-unknown-linux-gnu" ]; + targets = [ "x86_64-unknown-linux-gnu" "wasm32-unknown-unknown" ]; }) + trunk ]; }; } diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml new file mode 100644 index 0000000..2f2715c --- /dev/null +++ b/frontend/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "frontend" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +yew = "0.19" diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..79497a0 --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,5 @@ + + + + + diff --git a/frontend/src/main.rs b/frontend/src/main.rs new file mode 100644 index 0000000..22b1599 --- /dev/null +++ b/frontend/src/main.rs @@ -0,0 +1,12 @@ +use yew::prelude::*; + +#[function_component(App)] +fn app() -> Html { + html! { +

{ "Hello World" }

+ } +} + +fn main() { + yew::start_app::(); +} -- cgit 1.4.1