From d55dc525b72db86facae96feae8c82285e2676ba Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Fri, 19 Apr 2024 12:15:52 +0200 Subject: [PATCH] Started working on participants page --- application/src/app.rs | 4 + application/src/components.rs | 1 + application/src/components/participant.rs | 222 +++++++++++++++++++++ application/src/components/participants.rs | 9 +- application/style/main.scss | 1 + application/style/modal.scss | 29 +++ 6 files changed, 264 insertions(+), 2 deletions(-) create mode 100644 application/src/components/participant.rs create mode 100644 application/style/modal.scss diff --git a/application/src/app.rs b/application/src/app.rs index c8708d3..63831ad 100644 --- a/application/src/app.rs +++ b/application/src/app.rs @@ -12,6 +12,9 @@ pub fn App() -> impl IntoView { // Provides context that manages stylesheets, titles, meta tags, etc. provide_meta_context(); let participants: util::surrealdb::schemas::ParticipantsContext = create_rw_signal(vec![]); + let participant: RwSignal> = create_rw_signal(None); + + provide_context(participant); provide_context(participants); util::surrealdb::init_participants(); @@ -35,6 +38,7 @@ pub fn App() -> impl IntoView { .into_view() }> +
diff --git a/application/src/components.rs b/application/src/components.rs index 7a2354d..5c2e6c7 100644 --- a/application/src/components.rs +++ b/application/src/components.rs @@ -1,2 +1,3 @@ pub mod header; +pub mod participant; pub mod participants; diff --git a/application/src/components/participant.rs b/application/src/components/participant.rs new file mode 100644 index 0000000..2b0668b --- /dev/null +++ b/application/src/components/participant.rs @@ -0,0 +1,222 @@ +use crate::util::surrealdb::{client::Time, schemas}; +use leptos::*; + +/// Renders the home page of your application. +#[component] +pub fn Modal() -> impl IntoView { + let participant_id = use_context::>>().unwrap(); + let participants = use_context::().unwrap(); + + let participant = move || { + let x = participants + .get() + .into_iter() + .filter(|item| item.id == participant_id.get().unwrap_or("".to_string())) + .collect::>(); + + match x.get(0) { + Some(participant) => Some(participant.value), + None => None, + } + }; + + let time_lifesaver = create_rw_signal(Time { + minutes: 0, + seconds: 0, + milliseconds: 0, + }); + + let time_hindernis = create_rw_signal(Time { + minutes: 0, + seconds: 0, + milliseconds: 0, + }); + + let time_popduiken = create_rw_signal(Time { + minutes: 0, + seconds: 0, + milliseconds: 0, + }); + + view! { + { move || match participant() { + Some(p) => view! { + + }.into_view(), + None => view! {}.into_view() + + }} + } +} diff --git a/application/src/components/participants.rs b/application/src/components/participants.rs index 73a29e6..3a60081 100644 --- a/application/src/components/participants.rs +++ b/application/src/components/participants.rs @@ -1,4 +1,7 @@ -use crate::util::surrealdb::{client::Time, schemas}; +use crate::util::surrealdb::{ + client::Time, + schemas::{self, ParticipantSignal}, +}; use leptos::*; /// Renders the home page of your application. @@ -10,6 +13,8 @@ pub fn Participants( #[prop(default = true)] show_hindernis: bool, #[prop(default = true)] show_popduiken: bool, ) -> impl IntoView { + let participant_modal = use_context::>>().unwrap(); + view! { @@ -32,7 +37,7 @@ pub fn Participants( key=|state| state.id.clone() let:child > - + diff --git a/application/style/main.scss b/application/style/main.scss index 388ebc6..dc40876 100644 --- a/application/style/main.scss +++ b/application/style/main.scss @@ -13,6 +13,7 @@ $text-color: #f3efef; @import "header"; @import "index"; @import "groups"; +@import "modal"; html, body { diff --git a/application/style/modal.scss b/application/style/modal.scss new file mode 100644 index 0000000..770b1e9 --- /dev/null +++ b/application/style/modal.scss @@ -0,0 +1,29 @@ +.modal-background { + width: 100%; + height: 100%; + position: fixed; + top: 0; + left: 0; + display: flex; + justify-content: center; + align-items: center; + background-color: rgba(0, 0, 0, 0.8); + z-index: 200; + box-sizing: border-box; + padding: 10px; +} + +.modal { + width: 100%; + max-width: 500px; + height: 100%; + max-height: 800px; + overflow-y: auto; + background-color: $secondary-bg-color; + border-radius: 5px; + padding: 0px 20px; +} + +.modal form { + width: 100%; +}
{ move || child.value.get().name } { move || child.value.get().group }