feat(tazjin/predlozhnik): bootstrap yew/wasm-based web UI
this commit is mostly to figure out hwo to build a yew application in depot using the wasm toolchain. it's a bit finnicky, but could be a lot worse. Change-Id: I7804a774f1686a1f308ae1a3f549cd0ae7b5dbeb Reviewed-on: https://cl.tvl.fyi/c/depot/+/5980 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
38d01f7f3b
commit
d795a05c07
5 changed files with 528 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
|||
use yew::prelude::*;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use maplit::hashmap;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Write;
|
||||
|
||||
#[derive(Debug, Hash, PartialEq, Eq)]
|
||||
enum Падеж {
|
||||
|
|
@ -95,11 +98,40 @@ lazy_static! {
|
|||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn example_output() -> String {
|
||||
let mut out = String::new();
|
||||
|
||||
for (пд, пги) in &*ПО_ПАДЕЖУ {
|
||||
println!("Падеж: {:?}", пд);
|
||||
write!(out, "Падеж: {:?}\n", пд).ok();
|
||||
for п in пги {
|
||||
println!("\t{}", п);
|
||||
write!(out, "\t{}\n", п).ok();
|
||||
}
|
||||
}
|
||||
|
||||
out
|
||||
}
|
||||
|
||||
struct Model(());
|
||||
|
||||
impl Component for Model {
|
||||
type Message = ();
|
||||
type Properties = ();
|
||||
|
||||
fn create(_ctx: &Context<Self>) -> Self {
|
||||
Self(())
|
||||
}
|
||||
|
||||
fn update(&mut self, _ctx: &Context<Self>, _msg: Self::Message) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn view(&self, _ctx: &Context<Self>) -> Html {
|
||||
html! {
|
||||
<pre>{example_output()}</pre>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
yew::start_app::<Model>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue