Add example pages and remove dead code
All checks were successful
Build Crate / build (push) Successful in 4m41s

This commit is contained in:
2023-09-19 03:27:31 -04:00
parent aaaaf256f4
commit 1b3a6db223
10 changed files with 207 additions and 173 deletions

View File

@@ -0,0 +1,48 @@
use crate::components::layout::Layout;
use perseus::prelude::*;
use serde::{Deserialize, Serialize};
use std::fs;
use sycamore::prelude::*;
// Reactive page
#[derive(Serialize, Deserialize, Clone, ReactiveState)]
#[rx(alias = "PageStateRx")]
struct PageState {
}
fn overall_board_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, state: &'a PageStateRx) -> View<G> {
view! { cx,
Layout(title = "Overall Leaderboard") {
// Anything we put in here will be rendered inside the `<main>` block of the layout
p { "leaderboard" }
}
}
}
#[engine_only_fn]
async fn get_request_state(
_info: StateGeneratorInfo<()>,
req: Request,
) -> Result<PageState, BlamedError<std::convert::Infallible>> {
Ok(PageState {})
}
#[engine_only_fn]
fn head(cx: Scope) -> View<SsrNode> {
view! { cx,
title { "Overall leaderboard" }
}
}
// Template
pub fn get_template<G: Html>() -> Template<G> {
Template::build("overall-board")
.request_state_fn(get_request_state)
.view_with_state(overall_board_page)
.head(head)
.build()
}