Small code reduction.

beta
Philippe Pittoli 2023-07-04 04:50:07 +02:00
parent b061c0b18e
commit c2569bc959
1 changed files with 27 additions and 25 deletions

View File

@ -112,18 +112,20 @@ render { wsUp,
, render_register_form , render_register_form
] ]
should_be_disabled = (if wsUp then (HP.enabled true) else (HP.disabled true))
render_auth_form = HH.form render_auth_form = HH.form
[ HE.onSubmit AuthenticationAttempt ] [ HE.onSubmit AuthenticationAttempt ]
[ Bulma.box_input "Login" "login" -- title, placeholder [ Bulma.box_input "Login" "login" -- title, placeholder
(HandleAuthenticationInput <<< AUTH_INP_login) -- action (HandleAuthenticationInput <<< AUTH_INP_login) -- action
authenticationForm.login -- value authenticationForm.login -- value
true -- validity (TODO) true -- validity (TODO)
(if wsUp then (HP.enabled true) else (HP.disabled true)) -- condition should_be_disabled -- condition
, Bulma.box_password "Password" "password" -- title, placeholder , Bulma.box_password "Password" "password" -- title, placeholder
(HandleAuthenticationInput <<< AUTH_INP_pass) -- action (HandleAuthenticationInput <<< AUTH_INP_pass) -- action
authenticationForm.pass -- value authenticationForm.pass -- value
true -- validity (TODO) true -- validity (TODO)
(if wsUp then (HP.enabled true) else (HP.disabled true)) -- condition should_be_disabled -- condition
, HH.button , HH.button
[ HP.style "padding: 0.5rem 1.25rem;" [ HP.style "padding: 0.5rem 1.25rem;"
, HP.type_ HP.ButtonSubmit , HP.type_ HP.ButtonSubmit
@ -134,21 +136,21 @@ render { wsUp,
render_register_form = HH.form render_register_form = HH.form
[ HE.onSubmit RegisterAttempt ] [ HE.onSubmit RegisterAttempt ]
[ Bulma.box_input "Login" "login" -- title, placeholder [ Bulma.box_input "Login" "login" -- title, placeholder
(HandleRegisterInput <<< REG_INP_login) -- action (HandleRegisterInput <<< REG_INP_login) -- action
registrationForm.login -- value registrationForm.login -- value
true -- validity (TODO) true -- validity (TODO)
(if wsUp then (HP.enabled true) else (HP.disabled true)) -- condition should_be_disabled -- condition
, Bulma.box_input "Email" "email@example.com" -- title, placeholder , Bulma.box_input "Email" "email@example.com" -- title, placeholder
(HandleRegisterInput <<< REG_INP_email) -- action (HandleRegisterInput <<< REG_INP_email) -- action
registrationForm.email -- value registrationForm.email -- value
true -- validity (TODO) true -- validity (TODO)
(if wsUp then (HP.enabled true) else (HP.disabled true)) -- condition should_be_disabled -- condition
, Bulma.box_password "Password" "password" -- title, placeholder , Bulma.box_password "Password" "password" -- title, placeholder
(HandleRegisterInput <<< REG_INP_pass) -- action (HandleRegisterInput <<< REG_INP_pass) -- action
registrationForm.pass -- value registrationForm.pass -- value
true -- validity (TODO) true -- validity (TODO)
(if wsUp then (HP.enabled true) else (HP.disabled true)) -- condition should_be_disabled -- condition
, HH.div_ , HH.div_
[ HH.button [ HH.button
[ HP.style "padding: 0.5rem 1.25rem;" [ HP.style "padding: 0.5rem 1.25rem;"