-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.rs
94 lines (78 loc) · 2.24 KB
/
main.rs
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
mod component;
mod error;
mod hook;
mod layout;
mod model;
mod page;
mod state;
mod util;
use const_format::concatcp;
use dioxus::prelude::*;
use crate::hook::{use_gallery_handler, use_mode_provider, use_state_provider};
use crate::layout::{ChapterListState, MangaListState, Navbar};
use crate::page::{
extensions::ExtensionList,
sources::{ChapterList, MangaList, PageList, SourceList},
};
const APP_USER_AGENT: &str = concatcp!(midoku_config::NAME, "/", midoku_config::VERSION);
const CSS: Asset = asset!("/assets/tailwind.css");
#[derive(Debug, Clone, Routable, PartialEq, Eq, Hash)]
#[rustfmt::skip]
enum Route {
#[redirect("/", || Route::SourceList {})]
#[nest("/sources")]
#[layout(Navbar)]
#[route("")]
SourceList {},
#[end_layout]
#[layout(MangaListState)]
#[nest("/:extension_id/mangas")]
#[route("")]
MangaList { extension_id: String },
#[layout(ChapterListState)]
#[nest("/:manga_id")]
#[route("")]
ChapterList {
extension_id: String,
manga_id: String
},
#[route("/chapter/:chapter_id")]
PageList {
extension_id: String,
manga_id: String,
chapter_id: String
},
#[end_nest]
#[end_layout]
#[end_nest]
#[end_layout]
#[end_nest]
#[layout(Navbar)]
#[route("/extensions")]
ExtensionList {},
}
fn main() {
#[cfg(target_os = "android")]
dioxus::launch(App);
#[cfg(not(target_os = "android"))]
{
use dioxus::desktop::{LogicalSize, WindowBuilder};
let window = WindowBuilder::default()
.with_title(midoku_config::NAME)
.with_inner_size(LogicalSize::new(600, 1000));
let config = dioxus::desktop::Config::default()
.with_menu(None)
.with_window(window);
LaunchBuilder::new().with_cfg(config).launch(App);
}
}
#[component]
fn App() -> Element {
use_gallery_handler();
use_state_provider();
use_mode_provider();
rsx! {
document::Stylesheet { href: CSS }
Router::<Route> {}
}
}