My personal website, in gleam+lustre!
0
fork

Configure Feed

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

optimise size a bit !

+19 -19
assets/img/badges-unminified/my-badgie.webp

This is a binary file and will not be displayed.

assets/img/badges/e29.jpg assets/img/badges-unminified/e29.jpg
assets/img/badges/e29.webp

This is a binary file and will not be displayed.

assets/img/badges/getfirefox.webp

This is a binary file and will not be displayed.

assets/img/badges/linux80x15.png assets/img/badges-unminified/linux80x15.png
assets/img/badges/linux80x15.webp

This is a binary file and will not be displayed.

assets/img/badges/my-badgie.webp

This is a binary file and will not be displayed.

assets/img/badges/nixos.png assets/img/badges-unminified/nixos.png
assets/img/badges/nixos.svg assets/img/badges-unminified/nixos.svg
assets/img/badges/nixos.webp

This is a binary file and will not be displayed.

assets/img/badges/revamp pride version badgie version.kra assets/img/badges-unminified/revamp pride version badgie version.kra
assets/img/badges/transles80x31.png assets/img/badges-unminified/transles80x31.png
assets/img/badges/transles80x31.webp

This is a binary file and will not be displayed.

assets/img/badges/y2k-compliant.webp

This is a binary file and will not be displayed.

+2
justfile
··· 17 17 just prepare -- --prod 18 18 rm -fr ./dist 19 19 gleam run -m lustre/dev build --minify 20 + bun x terser --compress --mangle -- dist/homepage.js > dist/homepage.js.tmp 21 + mv dist/homepage.js.tmp dist/homepage.js 20 22 just prepare -- --prod --prepopulate 21 23 22 24 # Runs two watchers and allows you to always get a proper preview before pushing!
+2 -4
priv/codegen-templates/data.gleam
··· 1 - import gleam/dict 2 - 3 1 /// We want to disable this while previewing, as to not spam ari.lt with 4 2 /// requests due to autoreloading. 5 3 pub const arrivertisements_show = False 6 4 7 5 pub const address = "https://strawmelonjuice.com/" 8 6 9 - pub fn files() { 10 - dict.from_list(todo as "templated:files") 7 + pub fn files() -> List(#(String, String)) { 8 + todo as "templated:files" 11 9 }
+13 -12
src/homepage.gleam
··· 612 612 // text_badge: "", 613 613 // ), 614 614 Badge( 615 - img_url: "/img/badges/e29.jpg", 615 + img_url: "/img/badges/e29.webp", 616 616 img_alt: "The Sims addict", 617 617 img_title: "The Sims addict", 618 618 clickable_url: "", ··· 689 689 text_badge: "", 690 690 ), 691 691 Badge( 692 - img_url: "/img/badges/linux80x15.png", 692 + img_url: "/img/badges/linux80x15.webp", 693 693 img_alt: "Linux", 694 694 img_title: "arch linux btw heheh", 695 695 clickable_url: "", ··· 710 710 text_badge: "", 711 711 ), 712 712 Badge( 713 - img_url: "/img/badges/transles80x31.png", 713 + img_url: "/img/badges/transles80x31.webp", 714 714 img_alt: "trans-lesbian flag", 715 715 img_title: "I'm trans, and... girls... are... awesome!", 716 716 clickable_url: "", 717 717 text_badge: "", 718 718 ), 719 719 Badge( 720 - img_url: "/img/badges/nixos.png", 720 + img_url: "/img/badges/nixos.webp", 721 721 img_alt: "This user uses NixOS", 722 722 img_title: "NixOS :3", 723 723 clickable_url: "https://forge.strawmelonjuice.com/strawmelonjuice/nix", ··· 1216 1216 1217 1217 Lustre(a) -> a 1218 1218 File(markup:, path:) -> { 1219 - let assert Ok(inner) = data.files() |> dict.get(path) 1219 + let assert Ok(inner) = data.files() |> list.key_find(path) 1220 1220 as "File does not exist in data." 1221 1221 post_body_normalize(Post(..takes, body: Inline(markup:, string: inner))) 1222 1222 } ··· 1244 1244 ["post", post_id] -> 1245 1245 result.unwrap( 1246 1246 result.map( 1247 - result.or(dict.get(model.aliases, post_id), int.parse(post_id)), 1247 + result.or(list.key_find(model.aliases, post_id), int.parse(post_id)), 1248 1248 PostById, 1249 1249 ), 1250 1250 NotFound(path: uri.path), ··· 1306 1306 }) 1307 1307 |> list.flatten 1308 1308 |> list.map(pair.swap) 1309 - |> dict.from_list 1310 1309 1311 1310 let posts = 1312 1311 posts() 1313 1312 |> list.map(fn(post) { #(post.id, post |> post_normalize) }) 1314 - |> dict.from_list 1313 + 1315 1314 Model(raw_posts:, route: Index, posts:, aliases:) 1316 1315 } 1317 1316 ··· 2051 2050 [ 2052 2051 subtitle("Pinned posts"), 2053 2052 list.map(highlighted_posts, fn(id) { 2054 - let assert Ok(post) = model.posts |> dict.get(id) 2053 + let assert Ok(post) = model.posts |> list.key_find(id) 2055 2054 as "A pinned post does not exist :o" 2056 2055 view_post_preview(post) 2057 2056 }) ··· 2081 2080 fn view_posts(model: Model, filtered: PostFilter) -> List(Element(Msg)) { 2082 2081 let postlist = 2083 2082 model.posts 2084 - |> dict.filter(fn(_id, post) { 2083 + |> list.filter(fn(kv) { 2084 + let #(_, post) = kv 2085 2085 case filtered { 2086 2086 AllPosts -> True 2087 2087 PostsInCategory(category) -> post.category == category ··· 2092 2092 ) 2093 2093 } 2094 2094 }) 2095 - |> dict.values 2095 + // get values 2096 + |> list.map(fn(kv) { kv.1 }) 2096 2097 |> list.sort(fn(a, b) { 2097 2098 calendar.naive_date_compare(b.published, a.published) 2098 2099 }) ··· 2302 2303 } 2303 2304 2304 2305 fn view_post(model: Model, post_id: Int) -> List(Element(Msg)) { 2305 - case dict.get(model.posts, post_id) { 2306 + case list.key_find(model.posts, post_id) { 2306 2307 Error(_) -> not_found.view() 2307 2308 Ok(post) -> [ 2308 2309 html.article([attribute.class(" bg-[#FAEBEB]")], [
+2 -3
src/homepage/stuff.gleam
··· 1 1 // Imports 2 2 import gleam/bool 3 - import gleam/dict.{type Dict} 4 3 import gleam/int 5 4 import gleam/list 6 5 import gleam/option.{type Option} ··· 86 85 pub type Model { 87 86 Model( 88 87 raw_posts: List(Post), 89 - posts: Dict(Int, NormalizedPost), 90 - aliases: Dict(String, Int), 88 + posts: List(#(Int, NormalizedPost)), 89 + aliases: List(#(String, Int)), 91 90 route: Route, 92 91 ) 93 92 }