My website lesbian.skin
0
fork

Configure Feed

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

Create post page

+34 -1
+34 -1
src/website.gleam
··· 1 1 import birl.{type Day} 2 2 import gleam/int 3 3 import gleam/list 4 + import gleam/result 4 5 import gleam/string 5 6 import gleam/uri.{type Uri} 6 7 import lustre ··· 238 239 } 239 240 240 241 fn view_post(model: Model, id: String) -> Element(Msg) { 241 - html.h1([], [element.text("Post: " <> id)]) 242 + let post = 243 + model.posts 244 + |> list.find(fn(post) { post.id == id }) 245 + html.div([attribute.style(post_style)], case post { 246 + Ok(post) -> [ 247 + cluster.of( 248 + html.div, 249 + [ 250 + attribute.style([ 251 + #("display", "flex"), 252 + #("align-items", "center"), 253 + #("gap", "1em"), 254 + ]), 255 + ], 256 + [ 257 + html.h1([], [element.text(post.title)]), 258 + html.p([attribute.style([#("color", "gray")])], [ 259 + element.text("Author: " <> post.author), 260 + ]), 261 + html.p([attribute.style([#("color", "gray")])], [ 262 + element.text("Date Posted: " <> post.date_posted |> day_to_string), 263 + ]), 264 + ], 265 + ), 266 + html.hr([]), 267 + html.div([], [post.content]), 268 + ] 269 + Error(_) -> [ 270 + html.h1([attribute.style([#("text-align", "center")])], [ 271 + element.text("Invalid post!"), 272 + ]), 273 + ] 274 + }) 242 275 }