Skip to content

Commit

Permalink
refactor: change way to generate nodes with sketch
Browse files Browse the repository at this point in the history
Signed-off-by: Guillaume Hivert <[email protected]>
  • Loading branch information
ghivert committed May 14, 2024
1 parent 1d18aa0 commit c4fd738
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 271 deletions.
6 changes: 3 additions & 3 deletions apps/frontend/gleam.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ typescript_declarations = true

[dependencies]
gleam_javascript = "~> 0.8"
gleam_json = ">= 1.0.1 and < 2.0.0"
gleam_stdlib = "~> 0.34 or ~> 1.0"
grille_pain = {path = "../../packages/grille_pain"}
lustre = ">= 4.2.0 and < 5.0.0"
lustre_http = "~> 0.5"
modem = ">= 1.1.0 and < 2.0.0"
plinth = ">= 0.2.0 and < 1.0.0"
sketch = ">= 2.2.0 and < 3.0.0"
sketch = ">= 2.2.2 and < 3.0.0"
tardis = ">= 0.1.0 and < 1.0.0"
gleam_json = ">= 1.0.1 and < 2.0.0"
modem = ">= 1.1.0 and < 2.0.0"

[dev-dependencies]
gleeunit = "~> 1.0"
10 changes: 5 additions & 5 deletions apps/frontend/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ packages = [
{ name = "gleam_stdlib", version = "0.37.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "5398BD6C2ABA17338F676F42F404B9B7BABE1C8DC7380031ACB05BBE1BCF3742" },
{ name = "gleeunit", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "72CDC3D3F719478F26C4E2C5FED3E657AC81EC14A47D2D2DEBB8693CA3220C3B" },
{ name = "grille_pain", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_stdlib", "lustre", "scheduler", "sketch", "tardis"], source = "local", path = "../../packages/grille_pain" },
{ name = "lustre", version = "4.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "258F876CD7AB12C2C773F1A30F76DFC0A0ED989B720070DF32FC0717A6A0E60C" },
{ name = "lustre", version = "4.2.2", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_json", "gleam_otp", "gleam_stdlib"], otp_app = "lustre", source = "hex", outer_checksum = "927683F0F45D32A3C10449A8E85F0DAE383AADDB31AD7499670C998E73DA8D49" },
{ name = "lustre_http", version = "0.5.2", build_tools = ["gleam"], requirements = ["gleam_fetch", "gleam_http", "gleam_javascript", "gleam_json", "gleam_stdlib", "lustre"], otp_app = "lustre_http", source = "hex", outer_checksum = "FB0478CBFA6B16DBE8ECA326DAE2EC15645E04900595EF2C4F039ABFA0512ABA" },
{ name = "modem", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre"], otp_app = "modem", source = "hex", outer_checksum = "4C6E448089B09A57C179455D44526A717E4E217D4000B91201617FD2D9F18E68" },
{ name = "plinth", version = "0.2.0", build_tools = ["gleam"], requirements = ["gleam_javascript", "gleam_json", "gleam_stdlib"], otp_app = "plinth", source = "hex", outer_checksum = "83211E672D83F3CE14681D0ECD3AD883EE7588E423E7C9DDDB460014AD60AC24" },
{ name = "ranger", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "ranger", source = "hex", outer_checksum = "1566C272B1D141B3BBA38B25CB761EF56E312E79EC0E2DFD4D3C19FB0CC1F98C" },
{ name = "scheduler", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], source = "local", path = "../../packages/scheduler" },
{ name = "sketch", version = "2.2.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "lustre", "plinth"], otp_app = "sketch", source = "hex", outer_checksum = "8860E68627E33E4B63379050C1699546828CBF02364F26E191B95EA080AE483A" },
{ name = "sketch", version = "2.2.2", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_otp", "gleam_stdlib", "lustre", "plinth"], otp_app = "sketch", source = "hex", outer_checksum = "AE2FE447AB1C993CE4884D9EFE915D1971AEDED335904B77BE875B5BE3D7378B" },
{ name = "tardis", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "lustre", "plinth", "sketch"], otp_app = "tardis", source = "hex", outer_checksum = "C8E7BAB95C59EF50332905A06B82BB35526B7BE2F191580F3CD8790903AA49F7" },
{ name = "thoas", version = "1.2.0", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "540C8CB7D9257F2AD0A14145DC23560F91ACDCA995F0CCBA779EB33AF5D859D1" },
{ name = "thoas", version = "1.2.1", build_tools = ["rebar3"], requirements = [], otp_app = "thoas", source = "hex", outer_checksum = "E38697EDFFD6E91BD12CEA41B155115282630075C2A727E7A6B2947F5408B86A" },
]

[requirements]
Expand All @@ -31,7 +31,7 @@ gleeunit = { version = "~> 1.0" }
grille_pain = { path = "../../packages/grille_pain" }
lustre = { version = ">= 4.2.0 and < 5.0.0" }
lustre_http = { version = "~> 0.5" }
modem = { version = ">= 1.1.0 and < 2.0.0"}
modem = { version = ">= 1.1.0 and < 2.0.0" }
plinth = { version = ">= 0.2.0 and < 1.0.0" }
sketch = { version = ">= 2.2.0 and < 3.0.0" }
sketch = { version = ">= 2.2.2 and < 3.0.0" }
tardis = { version = ">= 0.1.0 and < 1.0.0" }
2 changes: 0 additions & 2 deletions apps/frontend/src/data/model.gleam
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import data/model/mock
import data/search_result.{type SearchResult, type SearchResults}
import gleam/io
import gleam/list
import gleam/pair
import gleam/result
Expand Down Expand Up @@ -52,6 +51,5 @@ fn insert_module_names(index: Index, search_results: List(SearchResult)) {
list.key_find(acc, key)
|> result.unwrap([])
|> fn(i) { list.prepend(i, #(val.module_name, val.name)) }
|> io.debug()
|> fn(i) { list.key_set(acc, key, i) }
}
12 changes: 3 additions & 9 deletions apps/frontend/src/frontend/view.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import frontend/colors/palette
import frontend/view/body/body
import frontend/view/footer/footer
import frontend/view/navbar/navbar
import gleam/list
import lustre/attribute.{type Attribute}
import lustre/element.{type Element}
import sketch
import sketch/lustre/extra as l
import sketch/size

fn layout(attributes: List(Attribute(msg)), children: List(Element(msg))) {
sketch.class([
fn layout(attributes, children) {
l.memo("div", attributes, children, [
sketch.display("grid"),
sketch.grid_template_areas(
"\"navbar\"
Expand All @@ -23,10 +21,6 @@ fn layout(attributes: List(Attribute(msg)), children: List(Element(msg))) {
sketch.background(palette.dark.underwater_blue),
sketch.color(palette.dark.white),
])
|> sketch.memo()
|> sketch.to_lustre()
|> list.prepend(attributes, _)
|> element.element("div", _, children)
}

pub fn view(model: Model) {
Expand Down
Loading

0 comments on commit c4fd738

Please sign in to comment.