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

Configure Feed

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

♻️ acquire modem initial uri before starting the application

+16 -7
+14 -5
src/client.gleam
··· 11 11 import gleam/bool 12 12 import gleam/http/response 13 13 import gleam/option 14 + import gleam/uri 14 15 import lustre 15 16 import lustre/attribute as attr 16 17 import lustre/effect.{type Effect} ··· 33 34 } 34 35 35 36 pub fn main() -> Nil { 37 + let assert Ok(uri) = modem.initial_uri() 38 + 36 39 let app = lustre.application(init:, update:, view:) 37 - let assert Ok(_runtime) = lustre.start(app, "#app", Nil) 40 + let assert Ok(_runtime) = lustre.start(app, "#app", InitOpts(uri)) 38 41 39 42 Nil 40 43 } 41 44 45 + /// Data passed to our application during startup 46 + pub type InitOpts { 47 + InitOpts( 48 + /// Uri of the page when it first loaded. 49 + uri: uri.Uri, 50 + ) 51 + } 52 + 42 53 pub type Msg { 43 54 /// Handle internal links navigation 44 55 UserNavigatedTo(to: route.Route) ··· 62 73 // INIT ------------------------------------------------------------------------ 63 74 64 75 /// Build initial application Model 65 - pub fn init(_opts: Nil) -> #(Model, Effect(Msg)) { 66 - // Get the `Uri` of the page when it first loaded. 67 - let assert Ok(uri) = modem.initial_uri() 68 - let route = route.parse(uri) 76 + pub fn init(opts: InitOpts) -> #(Model, Effect(Msg)) { 77 + let route = route.parse(opts.uri) 69 78 let page = page.init(route) 70 79 let is_protected = route.is_protected(route) 71 80 let session = init_session(route:, is_protected:)
+2 -2
src/client/page/login.gleam
··· 174 174 }), 175 175 176 176 html.input([ 177 - attr.type_("password"), 178 177 event.on_input(UserTypedPassword), 178 + attr.type_("password"), 179 179 attr.value(model.password), 180 180 attr.placeholder("********"), 181 181 class("py-1 px-2 bg-gray-100 rounded-md text-subtext"), ··· 189 189 // 󰳽 Login Button 190 190 html.button( 191 191 [ 192 - attr.disabled(disabled), 193 192 event.on_click(UserClickedSubmit), 193 + attr.disabled(disabled), 194 194 attr.aria_busy(model.loading), 195 195 class("w-full"), 196 196 ],