Web API, Web UI #86

Merged
projectmoon merged 37 commits from web-api into master 2021-07-15 15:04:54 +00:00
3 changed files with 105 additions and 55 deletions
Showing only changes of commit aeef9533ea - Show all commits

126
Cargo.lock generated
View File

@ -384,12 +384,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg-match"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8100e46ff92eb85bf6dc2930c73f2a4f7176393c84a9446b3d501e1b354e7b34"
[[package]] [[package]]
name = "chacha20" name = "chacha20"
version = "0.6.0" version = "0.6.0"
@ -1472,7 +1466,7 @@ dependencies = [
[[package]] [[package]]
name = "juniper" name = "juniper"
version = "0.15.5" version = "0.15.5"
source = "git+https://github.com/graphql-rust/juniper?branch=master#92ad8b46ff4d34cf10925f0a86b56950a354d2ec" source = "git+https://github.com/graphql-rust/juniper?branch=master#84a07c4a93f96d4352a9a6a23732c46eae486be6"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"bson", "bson",
@ -1493,7 +1487,7 @@ dependencies = [
[[package]] [[package]]
name = "juniper_codegen" name = "juniper_codegen"
version = "0.15.5" version = "0.15.5"
source = "git+https://github.com/graphql-rust/juniper?branch=master#92ad8b46ff4d34cf10925f0a86b56950a354d2ec" source = "git+https://github.com/graphql-rust/juniper?branch=master#84a07c4a93f96d4352a9a6a23732c46eae486be6"
dependencies = [ dependencies = [
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
@ -1504,7 +1498,7 @@ dependencies = [
[[package]] [[package]]
name = "juniper_rocket_async" name = "juniper_rocket_async"
version = "0.5.1" version = "0.5.1"
source = "git+https://github.com/graphql-rust/juniper?branch=master#92ad8b46ff4d34cf10925f0a86b56950a354d2ec" source = "git+https://github.com/graphql-rust/juniper?branch=master#84a07c4a93f96d4352a9a6a23732c46eae486be6"
dependencies = [ dependencies = [
"futures", "futures",
"juniper", "juniper",
@ -2654,6 +2648,12 @@ dependencies = [
"uncased", "uncased",
] ]
[[package]]
name = "route-recognizer"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "824172f0afccf3773c3905f5550ac94572144efe0deaf49a1f22bbca188d193e"
[[package]] [[package]]
name = "ruma" name = "ruma"
version = "0.1.2" version = "0.1.2"
@ -2934,6 +2934,12 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]]
name = "scoped-tls-hkt"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -3486,7 +3492,9 @@ dependencies = [
"wasm-bindgen-futures", "wasm-bindgen-futures",
"web-sys", "web-sys",
"yew", "yew",
"yew-functional",
"yew-router", "yew-router",
"yew-services",
"yewdux", "yewdux",
"yewtil", "yewtil",
] ]
@ -4094,6 +4102,28 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "weblog"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6eec0958e0181982bc8b4577b1363f21300a670603615c58643f172c92c47357"
dependencies = [
"wasm-bindgen",
"web-sys",
"weblog-proc-macro",
]
[[package]]
name = "weblog-proc-macro"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d9abb8ee84ede5408a346721d72fb216a27f53a539ff3c83ed1bf7625af7104"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "which" name = "which"
version = "4.1.0" version = "4.1.0"
@ -4187,24 +4217,17 @@ checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71"
[[package]] [[package]]
name = "yew" name = "yew"
version = "0.17.4" version = "0.17.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "2d8703eb5b883e816cd74c65e2f6dd4144eeedb77c1b3e0284e8f3f593b80ab1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"anymap", "anymap",
"bincode", "bincode",
"cfg-if 0.1.10",
"cfg-match",
"console_error_panic_hook", "console_error_panic_hook",
"futures",
"gloo", "gloo",
"http", "http",
"indexmap", "indexmap",
"js-sys", "js-sys",
"log", "log",
"proc-macro-hack",
"proc-macro-nested",
"ryu",
"serde", "serde",
"serde_json", "serde_json",
"slab", "slab",
@ -4215,15 +4238,34 @@ dependencies = [
"yew-macro", "yew-macro",
] ]
[[package]]
name = "yew-functional"
version = "0.13.0"
source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
dependencies = [
"scoped-tls-hkt",
"wasm-bindgen",
"yew",
"yew-functional-macro",
]
[[package]]
name = "yew-functional-macro"
version = "0.1.0"
source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]] [[package]]
name = "yew-macro" name = "yew-macro"
version = "0.17.0" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "61a9a452e63b6222b28b426dafbc6b207192e0127cdb93324cc7407b8c7e1768"
dependencies = [ dependencies = [
"boolinator", "boolinator",
"lazy_static", "lazy_static",
"proc-macro-hack",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
@ -4232,62 +4274,64 @@ dependencies = [
[[package]] [[package]]
name = "yew-router" name = "yew-router"
version = "0.14.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "20f46279cd28a50e0e9271352ce6d7be7f10e6ba449c76544985e64222f5e999"
dependencies = [ dependencies = [
"cfg-if 0.1.10",
"cfg-match",
"gloo", "gloo",
"js-sys", "js-sys",
"log", "route-recognizer",
"nom 5.1.2",
"serde", "serde",
"serde_json", "serde_urlencoded",
"wasm-bindgen", "wasm-bindgen",
"web-sys", "web-sys",
"weblog",
"yew", "yew",
"yew-router-macro", "yew-router-macro",
"yew-router-route-parser",
] ]
[[package]] [[package]]
name = "yew-router-macro" name = "yew-router-macro"
version = "0.14.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "768693f16c930d8a8742c2e5f62f258d5a6f0392e8c9265a45c550fac4cbe5a7"
dependencies = [ dependencies = [
"heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn", "syn",
"yew-router-route-parser",
] ]
[[package]] [[package]]
name = "yew-router-route-parser" name = "yew-services"
version = "0.14.0" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "49bf2f66f0e61d65d1637523fa1faedd5aa291cf9cb8d8fb200678472279b672"
dependencies = [ dependencies = [
"nom 5.1.2", "anyhow",
"gloo",
"http",
"js-sys",
"serde",
"serde_json",
"thiserror",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"yew",
] ]
[[package]] [[package]]
name = "yewdux" name = "yewdux"
version = "0.6.1" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/deftsp/yewdux?rev=dbda686#dbda686dea05c0efaef0cd3af46012033071f40e"
checksum = "223ffe9ac0d8ef83429ed639fc2cd159d747080eacbc1d8bc4955d37757509d1"
dependencies = [ dependencies = [
"serde", "serde",
"yew", "yew",
"yew-services",
] ]
[[package]] [[package]]
name = "yewtil" name = "yewtil"
version = "0.3.2" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/yewstack/yew?rev=246bc59#246bc5960b504258b0603bc76760777e6650c91d"
checksum = "003f4f533ee696c1f69d753db2c66096dec5700a93bd0bc801ab5891fec041c6"
dependencies = [ dependencies = [
"futures",
"log", "log",
"wasm-bindgen", "wasm-bindgen",
"wasm-bindgen-futures", "wasm-bindgen-futures",

View File

@ -13,10 +13,16 @@ crate-type = ["cdylib", "rlib"]
tenebrous-api = { path = "../../api" } tenebrous-api = { path = "../../api" }
[dependencies] [dependencies]
yew = { version = "0.17" } # yew = { version = "0.18" }
yewtil = {version = "0.3" } # yewtil = {version = "0.4" }
yew-router = {version = "0.14" } # yew-router = {version = "0.15" }
yewdux = {version = "^0.6" } # yewdux = {version = "^0.6" }
yew = { git = "https://github.com/yewstack/yew", rev = "246bc59" }
yew-functional = { git = "https://github.com/yewstack/yew", rev = "246bc59" }
yew-router = { git = "https://github.com/yewstack/yew", rev = "246bc59" }
yew-services = { git = "https://github.com/yewstack/yew", rev = "246bc59" }
yewtil = { git = "https://github.com/yewstack/yew", rev = "246bc59"}
yewdux = { git = "https://github.com/deftsp/yewdux", rev = "dbda686"}
wasm-bindgen = { version = "0.2" } wasm-bindgen = { version = "0.2" }
wasm-bindgen-futures = "0.4" wasm-bindgen-futures = "0.4"
js-sys = "0.3" js-sys = "0.3"

View File

@ -1,34 +1,34 @@
use rooms::RoomList; use rooms::RoomList;
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
use yew::prelude::*; use yew::prelude::*;
use yew_router::{components::RouterAnchor, prelude::*}; use yew_router::prelude::*;
pub mod api; pub mod api;
pub mod error; pub mod error;
pub mod grpc; pub mod grpc;
pub mod rooms; pub mod rooms;
#[derive(Switch, Clone, Debug)] #[derive(Routable, PartialEq, Clone, Debug)]
pub enum AppRoute { pub enum AppRoute {
#[to = "/rooms"] #[at("/rooms")]
Rooms, Rooms,
#[to = "/rooms/{room_id}"] #[at("/rooms/{room_id}")]
Room(String), Room { room_id: String },
#[to = "/"] #[at("/")]
Index, Index,
} }
type AppRouter = Router<AppRoute>; type AppRouter = Router<AppRoute>;
type AppAnchor = RouterAnchor<AppRoute>; //For rendering clickable links. type AppAnchor = Link<AppRoute>; //For rendering clickable links.
fn render_route(switch: AppRoute) -> Html { fn render_route(routes: &AppRoute) -> Html {
match switch { match routes {
AppRoute::Rooms => { AppRoute::Rooms => {
html! { html! {
<RoomList /> <RoomList />
} }
} }
AppRoute::Room(room_id) => { AppRoute::Room { room_id } => {
html! { html! {
<div>{"This is the specifi roompage."}</div> <div>{"This is the specifi roompage."}</div>
} }