2024-01-20 00:36:40 +00:00
|
|
|
use dioxus::desktop::{tao::dpi::LogicalSize, Config, WindowBuilder};
|
2022-03-05 21:10:17 +00:00
|
|
|
use dioxus::prelude::*;
|
2024-01-20 00:36:40 +00:00
|
|
|
use dioxus::router::prelude::*;
|
2022-03-04 18:08:25 +00:00
|
|
|
|
|
|
|
fn main() {
|
2024-01-18 20:32:01 +00:00
|
|
|
LaunchBuilder::desktop()
|
2024-01-19 00:27:43 +00:00
|
|
|
.with_cfg(
|
2024-01-18 20:32:01 +00:00
|
|
|
Config::new().with_window(
|
|
|
|
WindowBuilder::new()
|
|
|
|
.with_inner_size(LogicalSize::new(600, 1000))
|
|
|
|
.with_resizable(false),
|
|
|
|
),
|
|
|
|
)
|
2024-01-19 00:27:43 +00:00
|
|
|
.launch(|| rsx! { Router::<Route> {} })
|
2023-06-02 17:33:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Routable, Clone)]
|
|
|
|
#[rustfmt::skip]
|
|
|
|
enum Route {
|
|
|
|
#[layout(Footer)]
|
|
|
|
#[route("/")]
|
|
|
|
Home {},
|
|
|
|
#[route("/games")]
|
|
|
|
Games {},
|
|
|
|
#[route("/play")]
|
|
|
|
Play {},
|
|
|
|
#[route("/settings")]
|
|
|
|
Settings {},
|
|
|
|
}
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Footer() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx! {
|
2022-12-17 06:39:27 +00:00
|
|
|
div {
|
2024-01-16 14:42:16 +00:00
|
|
|
Outlet::<Route> {}
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2024-01-16 14:42:16 +00:00
|
|
|
p { "----" }
|
2022-12-16 10:55:20 +00:00
|
|
|
|
2022-12-17 18:02:26 +00:00
|
|
|
nav {
|
|
|
|
ul {
|
2024-01-16 14:42:16 +00:00
|
|
|
li {
|
|
|
|
Link { to: Route::Home {}, "Home" }
|
|
|
|
}
|
|
|
|
li {
|
|
|
|
Link { to: Route::Games {}, "Games" }
|
|
|
|
}
|
|
|
|
li {
|
|
|
|
Link { to: Route::Play {}, "Play" }
|
|
|
|
}
|
|
|
|
li {
|
|
|
|
Link { to: Route::Settings {}, "Settings" }
|
|
|
|
}
|
2022-03-04 18:08:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-12-16 10:55:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Home() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx!("Home")
|
2022-12-16 10:55:20 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Games() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx!("Games")
|
2022-12-16 10:55:20 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Play() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx!("Play")
|
2022-12-16 10:55:20 +00:00
|
|
|
}
|
|
|
|
|
2023-09-15 14:13:36 +00:00
|
|
|
#[component]
|
2024-01-14 04:51:37 +00:00
|
|
|
fn Settings() -> Element {
|
2024-01-16 19:18:46 +00:00
|
|
|
rsx!("Settings")
|
2022-03-04 18:08:25 +00:00
|
|
|
}
|