Add basic register and login
All checks were successful
Build Crate / build (push) Successful in 1m45s
All checks were successful
Build Crate / build (push) Successful in 1m45s
This commit is contained in:
@@ -36,6 +36,16 @@ pub fn Header<'a, G: Html>(cx: Scope<'a>, HeaderProps { game, title }: HeaderPro
|
||||
}
|
||||
};
|
||||
|
||||
let handle_register = move |_event: Event| {
|
||||
#[cfg(client)]
|
||||
{
|
||||
spawn_local_scoped(cx, async move {
|
||||
let global_state = Reactor::<G>::from_cx(cx).get_global_state::<AppStateRx>(cx);
|
||||
global_state.modals_open.register.set(OpenState::Open);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
let handle_log_out = move |_event: Event| {
|
||||
#[cfg(client)]
|
||||
{
|
||||
@@ -61,10 +71,10 @@ pub fn Header<'a, G: Html>(cx: Scope<'a>, HeaderProps { game, title }: HeaderPro
|
||||
match *global_state.auth.state.get() {
|
||||
LoginState::NotAuthenticated => {
|
||||
view! { cx,
|
||||
button(class = "text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700") {
|
||||
button(on:click = handle_register, class = "text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-100 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700") {
|
||||
"Register"
|
||||
}
|
||||
button(on:click = handle_log_in,class = "text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800") {
|
||||
button(on:click = handle_log_in, class = "text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-blue-600 dark:hover:bg-blue-700 focus:outline-none dark:focus:ring-blue-800") {
|
||||
"Log in"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::{
|
||||
capsules::{
|
||||
forgot_password_form::{ForgotPasswordFormProps, FORGOT_PASSWORD_FORM},
|
||||
login_form::{LoginFormProps, LOGIN_FORM},
|
||||
register_form::{RegisterFormProps, REGISTER_FORM},
|
||||
},
|
||||
components::header::{Header, HeaderProps},
|
||||
global_state::AppStateRx,
|
||||
@@ -57,6 +58,22 @@ pub fn Layout<'a, G: Html>(
|
||||
view!{ cx, }
|
||||
}
|
||||
})
|
||||
(match *global_state.modals_open.register.get() {
|
||||
OpenState::Open => {
|
||||
view! { cx,
|
||||
(REGISTER_FORM.widget(cx, "",
|
||||
RegisterFormProps{
|
||||
registration_code: true,
|
||||
nickname: true,
|
||||
email: true,
|
||||
}
|
||||
))
|
||||
}
|
||||
}
|
||||
OpenState::Closed => {
|
||||
view!{ cx, }
|
||||
}
|
||||
})
|
||||
(match *global_state.modals_open.forgot_password.get() {
|
||||
OpenState::Open => {
|
||||
view! { cx,
|
||||
|
||||
Reference in New Issue
Block a user