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.

๐Ÿ’„ add back link to login page

+73 -27
+10 -12
src/client.gleam
··· 165 165 // 166 166 // If the Server successfully authenticated the User, 167 167 // initialize its Session, and redirect them to the correct route. 168 - Model(session: session.Pending(on_success:, on_failure: _), ..), 168 + Model(session: session.Pending(on_success:, ..), ..), 169 169 UserRestoredSession(Ok(session)) 170 170 -> #( 171 171 Model(..model, session:, route: on_success, page: page.init(on_success)), ··· 174 174 175 175 // If it fails, start the Session as a Guest and redirect 176 176 // the User accordingly, usually to the Login Page. 177 - Model(session: session.Pending(on_success: _, on_failure:), ..), 177 + Model(session: session.Pending(on_failure:, ..), ..), 178 178 UserRestoredSession(Error(_)) 179 - -> #( 180 - Model( 181 - ..model, 182 - route: on_failure, 183 - page: page.init(on_failure), 184 - session: session.Guest, 185 - ), 186 - modem.push(route.path(on_failure), option.None, option.None), 187 - ) 179 + -> { 180 + let session = session.Guest 181 + let route = on_failure 182 + 183 + let model = Model(..model, route:, page: page.init(route), session:) 184 + #(model, modem.push(route.path(route), option.None, option.None)) 185 + } 188 186 189 187 // User ended their Session and token has been removed. 190 188 // Redirect user to the Home page. ··· 218 216 let route = case model.session, route { 219 217 // If the route require the User to be authenticated, 220 218 // redirect them to the Login page. 221 - session.Guest, _ | session.Pending(_, _), _ if protected -> route.Login 219 + session.Guest, _ | session.Pending(..), _ if protected -> route.Login 222 220 // If the User is *already* authenticated but navigating to 223 221 // the Login page, redirect them to Dashboard instead. 224 222 session.Authenticated(_), route.Login -> route.Dashboard
+20
src/client/icon.gleam
··· 164 164 ], 165 165 ) 166 166 } 167 + 168 + pub fn arrow_left(attributes: List(Attribute(a))) { 169 + svg.svg( 170 + [ 171 + attribute("stroke-linejoin", "round"), 172 + attribute("stroke-linecap", "round"), 173 + attribute("stroke-width", "2"), 174 + attribute("stroke", "currentColor"), 175 + attribute("fill", "none"), 176 + attribute("viewBox", "0 0 24 24"), 177 + attribute("height", "24"), 178 + attribute("width", "24"), 179 + ..attributes 180 + ], 181 + [ 182 + svg.path([attribute("d", "m12 19-7-7 7-7")]), 183 + svg.path([attribute("d", "M19 12H5")]), 184 + ], 185 + ) 186 + }
+13 -1
src/client/page/login.gleam
··· 1 1 import client/brand 2 + import client/icon 2 3 import client/language as lang 4 + import client/route 3 5 import client/session 4 6 import gleam/json 5 7 import lustre/attribute.{class} as attr ··· 85 87 // Wrapper 86 88 let wrapper_attr = [ 87 89 class("p-4 mx-auto max-w-lg h-full"), 88 - class("flex flex-col gap-2 items-center"), 90 + class("flex flex-col gap-4 items-center"), 89 91 ] 90 92 91 93 // Disable button if the any of the fields are empty ··· 231 233 ], 232 234 ), 233 235 ]), 236 + ]), 237 + 238 + html.a([class("hstack text-subtext"), attr.href(route.path(route.Home))], [ 239 + icon.arrow_left([class("size-4")]), 240 + html.text(case lang { 241 + lang.BrazillianPortuguese | lang.Portuguese -> "Voltar para o site" 242 + lang.English -> "Return to website" 243 + lang.German -> "Zurรผck zur Webseite" 244 + lang.Spanish -> "Volver al sitio web" 245 + }), 234 246 ]), 235 247 ]) 236 248 }
+30 -14
src/client/page/navbar.gleam
··· 10 10 import lustre/event 11 11 12 12 pub type Msg { 13 + /// User changed the selected language for the whole website. 13 14 UserSelectedLanguage(lang: lang.Language) 14 15 } 15 16 ··· 17 18 session: session.Session, 18 19 lang: lang.Language, 19 20 ) -> element.Element(Msg) { 20 - let style = class("flex justify-between h-full border-b md:py-4 md:px-24") 21 + let style = class("flex justify-between py-2 h-full border-b md:px-24") 21 22 html.nav([attr.data("topnav", ""), style], [ 22 23 view_left_section(), 23 24 view_middle_section(lang), ··· 121 122 122 123 // Login link 123 124 case session { 124 - session.Authenticated(_) -> 125 - html.a([attr.href(route.path(route.Dashboard))], [ 125 + session.Authenticated(..) -> { 126 + let attributes = [ 127 + attr.href(route.path(route.Dashboard)), 128 + class("font-bold bg-primary text-primary-foreground"), 129 + ] 130 + 131 + html.a(attributes, [ 126 132 html.text("Dashboard"), 127 133 ]) 134 + } 128 135 129 - session.Guest -> 130 - html.a( 131 - [ 132 - attr.href(route.path(route.Login)), 133 - class("py-2 px-4 rounded-md hstack"), 134 - class("font-bold bg-primary text-primary-foreground"), 135 - ], 136 - [icon.log_in([]), html.text("Login")], 137 - ) 136 + session.Guest -> { 137 + let attributes = [ 138 + attr.href(route.path(route.Login)), 139 + class("py-2 px-4 rounded-md hstack"), 140 + class("font-bold bg-primary text-primary-foreground"), 141 + ] 142 + 143 + html.a(attributes, [ 144 + icon.log_in([]), 145 + html.text("Login"), 146 + ]) 147 + } 138 148 139 - session.Pending(..) -> 140 - html.div([class("flex gap-2 items-center")], [ 149 + session.Pending(..) -> { 150 + let attributes = [ 151 + class("flex gap-2 items-center"), 152 + class("font-bold bg-primary text-primary-foreground"), 153 + ] 154 + 155 + html.div(attributes, [ 141 156 // ๏„ Render spinner when waiting for Authentication. 142 157 html.span([attr.aria_busy(True), attr.data("spinner", "small")], []), 143 158 html.p([], [html.text("Loading")]), 144 159 ]) 160 + } 145 161 }, 146 162 ]) 147 163 }