summaryrefslogtreecommitdiff
path: root/webapp/src/main.rs
blob: 8a1fccc96b079d078e084c6fbc74683a2d35ea36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#[allow(unused_imports)]
use log::{debug, error, info, warn};
use yew::prelude::*;
pub mod bridge_engine;
pub mod card;
pub mod components;
use components::Game;
extern crate wee_alloc;

// Use `wee_alloc` as the global allocator.
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

fn main() {
    std::panic::set_hook(Box::new(console_error_panic_hook::hook));
    wasm_logger::init(wasm_logger::Config::default());
    yew::start_app::<App>();
}

#[function_component(App)]
pub fn app() -> Html {
    html! {
        <>
            <div class="app">
                <Game />
            </div>
        </>
    }
}

#[cfg(test)]
mod tests {
    pub fn test_setup() {
        dotenv::dotenv().ok();
        let _ = env_logger::builder().is_test(true).try_init();
    }
}