this repo has no description
lustre frontent oat-ui gleam
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

๐Ÿ’ก Add comments about session management

+16 -22
+8 -16
src/client.gleam
··· 32 32 ) 33 33 } 34 34 35 - /// โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” 36 - /// โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”‚ View โ”‚โ†โ”€โ”€โ”€โ”€โ”€โ” 37 - /// โ†“ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ 38 - /// โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” 39 - /// โ”‚ Model โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ†’โ”‚ UPDATE โ”‚ 40 - /// โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 41 - /// 42 35 pub fn main() -> Nil { 43 36 let app = lustre.application(init:, update:, view:) 44 37 let assert Ok(_runtime) = lustre.start(app, "#app", Nil) ··· 63 56 // UI Elements 64 57 SidebarMsg(msg: sidebar.Msg) 65 58 NavbarMsg(msg: navbar.Msg) 66 - NotFoundMsg(not_found.Msg) 59 + NotFoundMsg(msg: not_found.Msg) 67 60 } 68 61 69 62 // INIT ------------------------------------------------------------------------ ··· 161 154 162 155 // SESSION MANAGEMENT ----------------------------------------------------- 163 156 // 164 - // Success 157 + // If the Server successfully authenticated the User, 158 + // initialize its Session, and redirect them to the correct route. 165 159 Model(session: session.Pending(on_success:, on_error: _), ..), 166 160 UserRestoredSession(Ok(session)) 167 161 -> #( ··· 169 163 modem.push(route.to_path(on_success), option.None, option.None), 170 164 ) 171 165 172 - // Failure 166 + // If it fails, start the Session as a Guest and redirect 167 + // the User accordingly, usually to the Login Page. 173 168 Model(session: session.Pending(on_success: _, on_error:), ..), 174 169 UserRestoredSession(Error(_)) 175 170 -> #( ··· 183 178 ) 184 179 185 180 // User ended their Session and token has been removed. 186 - // Redirect user to the Home page 181 + // Redirect user to the Home page. 187 182 model, ServerRemovedToken(Ok(_)) -> { 188 183 let session = session.Guest 189 184 let route = route.to_path(route.Home) ··· 252 247 _ -> "" 253 248 } 254 249 255 - let page = 256 - login.Model(..page, loading: False, message:) 257 - |> page.Login 258 - 259 - #(Model(..model, page:), effect.none()) 250 + let page = login.Model(..page, loading: False, message:) 251 + #(Model(..model, page: page.Login(page)), effect.none()) 260 252 } 261 253 } 262 254 }
+8 -6
src/client/page/login.gleam
··· 30 30 /// User updated password field 31 31 UserTypedPassword(password: String) 32 32 33 - /// User sent credentials to the Server 33 + /// User sent login credentials to the Server 34 34 UserClickedSubmit 35 35 36 36 /// API validated User's credentials ··· 93 93 ] 94 94 95 95 html.div(wrapper_attr, [ 96 - // ๏ฌ Logo with Title --- 96 + // ๏ฌ LOGO AND TITLE ------------------------------------------------------- 97 97 html.section( 98 98 [ 99 99 class("p-4 w-full"), ··· 114 114 ], 115 115 ), 116 116 117 - // Form --- 117 + // ๓ฑ FORM ----------------------------------------------------------------- 118 118 html.article([class("w-full card @container")], [ 119 - // Form Header 119 + // Header 120 120 html.header([class("hidden mb-4 @md:inline")], [ 121 121 html.h3([class("my-2 font-bold")], [ 122 122 html.text(case lang { ··· 125 125 _ -> "Join the Platform" 126 126 }), 127 127 ]), 128 + 128 129 html.p([class("text-subtext")], [ 129 130 html.text(case lang { 130 131 language.BrazillianPortuguese | language.PortugalPortuguese -> 131 - "Acesse sua conta para gerenciar contratos de energia" 132 + "Acesse sua conta para gerenciar seus contratos de energia" 132 133 _ -> "Access your account to manage your energy contracts" 133 134 }), 134 135 ]), ··· 160 161 "Senha" 161 162 _ -> "Password" 162 163 }), 164 + 163 165 html.input([ 164 166 attr.type_("password"), 165 167 attr.value(model.password), ··· 177 179 html.text("Login"), 178 180 ]), 179 181 180 - // --- 181 182 html.hr([class("my-4")]), 183 + 182 184 html.div( 183 185 [ 184 186 class("text-sm text-center"),