Add themes, update layout, fix pages
Some checks failed
Build Crate / build (push) Failing after 1m53s

This commit is contained in:
2024-08-31 03:12:28 -04:00
parent 659037ec00
commit 3e2163dbf3
18 changed files with 347 additions and 123 deletions

24
src/templates/index.rs Normal file
View File

@@ -0,0 +1,24 @@
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use sycamore::prelude::*;
fn index_page<G: Html>(cx: Scope) -> View<G> {
view! { cx,
Layout(content_state = ContentState::None) {
// Anything we put in here will be rendered inside the `<main>` block of the layout
p { "Hello World!" }
br {}
}
}
}
#[engine_only_fn]
fn head(cx: Scope) -> View<SsrNode> {
view! { cx,
title { "Index Page" }
}
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("").view(index_page).head(head).build()
}

View File

@@ -1,3 +1,4 @@
pub mod index;
pub mod pickleball;
pub mod pool;
pub mod table_tennis;

View File

@@ -0,0 +1,27 @@
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use sycamore::prelude::*;
fn index_page<G: Html>(cx: Scope) -> View<G> {
view! { cx,
Layout(content_state = ContentState::Pickleball) {
// Anything we put in here will be rendered inside the `<main>` block of the layout
p { "Hello World!" }
br {}
}
}
}
#[engine_only_fn]
fn head(cx: Scope) -> View<SsrNode> {
view! { cx,
title { "Index Page" }
}
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("pickleball")
.view(index_page)
.head(head)
.build()
}

View File

@@ -0,0 +1 @@
pub mod index;

View File

@@ -1,4 +1,4 @@
use crate::{components::layout::Layout, state_enums::GameState};
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use serde::{Deserialize, Serialize};
use sycamore::prelude::*;
@@ -31,7 +31,7 @@ fn add_game_form_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, state: &'a PageStat
};
view! { cx,
Layout(game = GameState::Pool) {
Layout(content_state = ContentState::Pool) {
div (class = "flex flex-wrap") {
select {
option (value="red")
@@ -91,7 +91,7 @@ fn head(cx: Scope) -> View<SsrNode> {
// Template
pub fn get_template<G: Html>() -> Template<G> {
Template::build("add-game-form")
Template::build("pool/add-game-form")
.request_state_fn(get_request_state)
.view_with_state(add_game_form_page)
.head(head)

View File

@@ -1,10 +1,10 @@
use crate::{components::layout::Layout, state_enums::GameState};
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use sycamore::prelude::*;
fn index_page<G: Html>(cx: Scope) -> View<G> {
view! { cx,
Layout(game = GameState::Pool) {
Layout(content_state = ContentState::Pool) {
// Anything we put in here will be rendered inside the `<main>` block of the layout
p { "Hello World!" }
br {}
@@ -20,5 +20,5 @@ fn head(cx: Scope) -> View<SsrNode> {
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("").view(index_page).head(head).build()
Template::build("pool").view(index_page).head(head).build()
}

View File

@@ -1,4 +1,4 @@
use crate::{components::layout::Layout, state_enums::GameState};
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use serde::{Deserialize, Serialize};
use sycamore::prelude::*;
@@ -9,7 +9,7 @@ struct PageState {}
fn one_v_one_board_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, _state: &'a PageStateRx) -> View<G> {
view! { cx,
Layout(game = GameState::Pool) {
Layout(content_state = ContentState::Pool) {
p { "leaderboard" }
}
}
@@ -31,7 +31,7 @@ fn head(cx: Scope) -> View<SsrNode> {
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("one-v-one-board")
Template::build("pool/one-v-one-board")
.request_state_fn(get_request_state)
.view_with_state(one_v_one_board_page)
.head(head)

View File

@@ -1,4 +1,4 @@
use crate::{components::layout::Layout, global_state::AppStateRx, state_enums::GameState};
use crate::{components::layout::Layout, global_state::AppStateRx, state_enums::ContentState};
use perseus::prelude::*;
use serde::{Deserialize, Serialize};
@@ -12,7 +12,7 @@ fn overall_board_page<'a, G: Html>(cx: BoundedScope<'_, 'a>, _state: &'a PageSta
let _global_state = Reactor::<G>::from_cx(cx).get_global_state::<AppStateRx>(cx);
view! { cx,
Layout(game = GameState::Pool) {
Layout(content_state = ContentState::Pool) {
ul {
(View::new_fragment(
vec![],
@@ -38,7 +38,7 @@ fn head(cx: Scope) -> View<SsrNode> {
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("overall-board")
Template::build("pool/overall-board")
.request_state_fn(get_request_state)
.view_with_state(overall_board_page)
.head(head)

View File

@@ -0,0 +1,27 @@
use crate::{components::layout::Layout, state_enums::ContentState};
use perseus::prelude::*;
use sycamore::prelude::*;
fn index_page<G: Html>(cx: Scope) -> View<G> {
view! { cx,
Layout(content_state = ContentState::TableTennis) {
// Anything we put in here will be rendered inside the `<main>` block of the layout
p { "Hello World!" }
br {}
}
}
}
#[engine_only_fn]
fn head(cx: Scope) -> View<SsrNode> {
view! { cx,
title { "Index Page" }
}
}
pub fn get_template<G: Html>() -> Template<G> {
Template::build("table_tennis")
.view(index_page)
.head(head)
.build()
}

View File

@@ -0,0 +1 @@
pub mod index;