2024-09-07 22:08:35 +02:00
|
|
|
use crate::error_template::{AppError, ErrorTemplate};
|
|
|
|
|
2025-01-11 22:22:39 +01:00
|
|
|
use leptos::prelude::*;
|
2024-09-07 22:08:35 +02:00
|
|
|
use leptos_meta::*;
|
2025-01-11 22:22:39 +01:00
|
|
|
use leptos_router::{components::*, StaticSegment};
|
2024-09-07 22:08:35 +02:00
|
|
|
|
|
|
|
pub mod error_template;
|
|
|
|
|
2025-01-11 22:22:39 +01:00
|
|
|
#[cfg(feature = "ssr")]
|
|
|
|
pub mod state;
|
|
|
|
|
|
|
|
pub fn shell(options: LeptosOptions) -> impl IntoView {
|
|
|
|
view! {
|
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<AutoReload options=options.clone() />
|
|
|
|
<HydrationScripts options />
|
|
|
|
<MetaTags />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<App />
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-09-07 22:08:35 +02:00
|
|
|
#[component]
|
|
|
|
pub fn App() -> impl IntoView {
|
|
|
|
// Provides context that manages stylesheets, titles, meta tags, etc.
|
|
|
|
provide_meta_context();
|
|
|
|
|
|
|
|
view! {
|
2025-01-11 22:22:39 +01:00
|
|
|
<Stylesheet id="leptos" href="/pkg/%%name%%.css" />
|
2024-09-07 22:08:35 +02:00
|
|
|
|
|
|
|
// sets the document title
|
2025-01-11 22:22:39 +01:00
|
|
|
<Title text="%%name%%" />
|
2024-09-07 22:08:35 +02:00
|
|
|
|
|
|
|
// content for this welcome page
|
2025-01-11 22:22:39 +01:00
|
|
|
<Router>
|
|
|
|
<main class="">
|
|
|
|
<Routes fallback=|| {
|
|
|
|
let mut outside_errors = Errors::default();
|
|
|
|
outside_errors.insert_with_default_key(AppError::NotFound);
|
|
|
|
view! { <ErrorTemplate outside_errors /> }.into_view()
|
|
|
|
}>
|
|
|
|
<Route path=StaticSegment("") view=pages::home::HomePage />
|
2024-09-07 22:08:35 +02:00
|
|
|
</Routes>
|
|
|
|
</main>
|
|
|
|
</Router>
|
|
|
|
}
|
|
|
|
}
|
2024-09-07 22:19:25 +02:00
|
|
|
|
|
|
|
#[component]
|
2025-01-11 22:22:39 +01:00
|
|
|
pub fn HomePage() -> impl IntoView {
|
|
|
|
view! {
|
|
|
|
<h1> "%%name%%" </h1>
|
|
|
|
}
|
2024-09-07 22:19:25 +02:00
|
|
|
}
|