2024-04-29 22:48:53 +02:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
2024-05-21 16:39:11 +02:00
|
|
|
use std::str::FromStr;
|
|
|
|
|
2024-04-29 22:48:53 +02:00
|
|
|
use dioxus::prelude::*;
|
2024-05-21 16:39:11 +02:00
|
|
|
use dioxus_sdk::i18n::*;
|
2024-05-14 11:33:25 +02:00
|
|
|
|
2024-04-29 22:48:53 +02:00
|
|
|
use tracing::Level;
|
|
|
|
|
|
|
|
pub mod components;
|
2024-05-21 16:39:11 +02:00
|
|
|
mod consulting;
|
2024-04-29 22:48:53 +02:00
|
|
|
mod cv;
|
|
|
|
mod home;
|
|
|
|
mod impressum;
|
2024-05-21 16:39:11 +02:00
|
|
|
mod languages;
|
2024-04-29 22:48:53 +02:00
|
|
|
mod layout;
|
|
|
|
mod publications;
|
|
|
|
|
2024-05-21 16:39:11 +02:00
|
|
|
use crate::consulting::Consulting;
|
2024-04-29 22:48:53 +02:00
|
|
|
use crate::cv::CV;
|
|
|
|
use crate::home::Home;
|
|
|
|
use crate::impressum::Impressum;
|
2024-05-21 16:39:11 +02:00
|
|
|
use crate::languages::DE_DE;
|
|
|
|
use crate::languages::EN_GB;
|
2024-04-29 22:48:53 +02:00
|
|
|
use crate::layout::Layout;
|
2024-05-21 16:39:11 +02:00
|
|
|
use crate::publications::PublicationsProjects;
|
2024-04-29 22:48:53 +02:00
|
|
|
|
|
|
|
#[derive(Clone, Routable, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
|
|
|
|
pub enum Route {
|
|
|
|
#[layout(Layout)]
|
|
|
|
#[route("/")]
|
|
|
|
Home {},
|
|
|
|
#[route("/impressum")]
|
|
|
|
Impressum {},
|
|
|
|
#[route("/publications")]
|
2024-05-21 16:39:11 +02:00
|
|
|
PublicationsProjects {},
|
2024-04-29 22:48:53 +02:00
|
|
|
#[route("/resume")]
|
|
|
|
CV {},
|
2024-05-21 16:39:11 +02:00
|
|
|
#[route("/consulting")]
|
|
|
|
Consulting {},
|
2024-04-29 22:48:53 +02:00
|
|
|
#[end_layout]
|
|
|
|
#[route("/:..route")]
|
|
|
|
PageNotFound { route: Vec<String> },
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-05-02 11:04:23 +02:00
|
|
|
dioxus_logger::init(Level::DEBUG).expect("failed to init logger");
|
2024-05-21 16:39:11 +02:00
|
|
|
LaunchBuilder::fullstack()
|
|
|
|
.with_cfg(server_only!(dioxus::fullstack::Config::new().addr(
|
|
|
|
std::net::SocketAddrV4::new(std::net::Ipv4Addr::new(0, 0, 0, 0), 8080,)
|
|
|
|
)))
|
|
|
|
.launch(App)
|
2024-04-29 22:48:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fn App() -> Element {
|
2024-05-21 16:39:11 +02:00
|
|
|
use_init_i18n("en-GB".parse().unwrap(), "en-GB".parse().unwrap(), || {
|
|
|
|
let en_gb = Language::from_str(EN_GB).unwrap();
|
|
|
|
let de_de = Language::from_str(DE_DE).unwrap();
|
|
|
|
vec![en_gb, de_de]
|
|
|
|
});
|
|
|
|
|
2024-04-29 22:48:53 +02:00
|
|
|
rsx! {
|
|
|
|
div {
|
|
|
|
class: "bg-white dark:bg-gray-900 min-h-screen",
|
|
|
|
Router::<Route> {},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[component]
|
|
|
|
fn PageNotFound(route: Vec<String>) -> Element {
|
|
|
|
rsx! {
|
|
|
|
div {
|
2024-07-25 03:39:53 +02:00
|
|
|
class: "h-screen items-center justify-center",
|
2024-04-29 22:48:53 +02:00
|
|
|
img {
|
|
|
|
class: "size-auto",
|
|
|
|
src: "https://raw.githubusercontent.com/SAWARATSUKI/ServiceLogos/main/404Notfound/NotFound.png"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(PartialEq, Props, Clone)]
|
|
|
|
pub struct BodyProp {
|
|
|
|
children: Element,
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn Body(prop: BodyProp) -> Element {
|
|
|
|
rsx! {
|
|
|
|
div {
|
2024-07-25 03:39:53 +02:00
|
|
|
class: "flex-grow container mx-auto p-4",
|
2024-05-21 17:03:40 +02:00
|
|
|
{prop.children}
|
|
|
|
}
|
2024-04-29 22:48:53 +02:00
|
|
|
}
|
|
|
|
}
|