From 645e815ebe11dbb86781c3eb645d3d67cd62cf7c Mon Sep 17 00:00:00 2001 From: polwex Date: Fri, 27 Jun 2025 16:34:09 +0700 Subject: nice nice. lsp still doesnt work tho --- lib/pages/BlogIndex.mlx | 76 ++++++++++++++++++++++++++++++++++++++ lib/pages/BlogIndex.re | 11 ------ lib/pages/components/Navbar.mlx | 34 +++++++++++++++++ lib/pages/components/SiteTitle.mlx | 10 +++++ lib/pages/dune | 4 ++ lib/pages/lmao.re | 40 ++++++++++++++++++++ 6 files changed, 164 insertions(+), 11 deletions(-) create mode 100644 lib/pages/BlogIndex.mlx delete mode 100644 lib/pages/BlogIndex.re create mode 100644 lib/pages/components/Navbar.mlx create mode 100644 lib/pages/components/SiteTitle.mlx create mode 100644 lib/pages/lmao.re (limited to 'lib/pages') diff --git a/lib/pages/BlogIndex.mlx b/lib/pages/BlogIndex.mlx new file mode 100644 index 0000000..3e036aa --- /dev/null +++ b/lib/pages/BlogIndex.mlx @@ -0,0 +1,76 @@ +open Shared + +let header ~title () =

title

+ +let page = + + +
(React.string "Some content goes here")
+ + +;; + +module Layout = struct + let[@react.component] make ~children = + + + (React.string "Bloody Shovel 5") + + + + children + + ;; +end + +module PostPreviews = struct + let[@react.component] make ~(conn : Query.conn) = + let posts = + match Query.get_poasts () conn with + | Error _err -> [] + | Ok posts -> posts + in + let tests = "This is 'a 'weird " in +
+ (match posts with + | [] -> React.string "No posts" + | posts -> + let ps = + posts + |> List.map (fun (p : Query.post_summary) -> + Logs.info (fun d -> d "poast %s\n" p.title); +

(React.string p.title)

) + in + let pp = React.string tests :: ps in + pp |> Array.of_list |> React.array) +
+ ;; +end + +let[@react.component] make (conn : Query.conn) = + +
+ +
+ +
+
+
+
+;; + +(* let[@react.component] make (conn : Query.conn) = *) +(* let posts = *) +(* match Query.get_poasts () conn with *) +(* | Error _err -> [] *) +(* | Ok posts -> posts *) +(* in *) +(*
*) +(* (match posts with *) +(* | [] -> React.string "No posts" *) +(* | hd :: _tl -> React.string hd.title) *) +(*
*) +(* ;; *) + +(* # formatter = {command = "ocamlformat-mlx", args = ["-", "--impl"]} *) +(* List.map (fun _p ->

(React.string "wtf")

) posts |> React.list *) diff --git a/lib/pages/BlogIndex.re b/lib/pages/BlogIndex.re deleted file mode 100644 index 50beaed..0000000 --- a/lib/pages/BlogIndex.re +++ /dev/null @@ -1,11 +0,0 @@ -[@react.component] -let make = () => { - - - - {React.string("Bloody Shovel 5")} - - // -

{React.string("Oh hai")}

- ; -}; diff --git a/lib/pages/components/Navbar.mlx b/lib/pages/components/Navbar.mlx new file mode 100644 index 0000000..68003fe --- /dev/null +++ b/lib/pages/components/Navbar.mlx @@ -0,0 +1,34 @@ +module Link = struct + let[@react.component] make ~children ~href ?(className = "") = + let base_class = "hover:text-gray-300 transition-colors" in + let clas = Printf.sprintf "%s %s" base_class className in + children + ;; +end + +let rs = React.string + +let[@react.component] make () = +
+
+ + + + +
+ (rs "SEARCH") + (rs "LOGIN") +
+
+
+;; diff --git a/lib/pages/components/SiteTitle.mlx b/lib/pages/components/SiteTitle.mlx new file mode 100644 index 0000000..cfee4f3 --- /dev/null +++ b/lib/pages/components/SiteTitle.mlx @@ -0,0 +1,10 @@ +let[@react.component] make () = +
+ +

+ (React.string "BLOODY SHOVEL 5") +

+
+

(React.string "Nemo nos Salvabit")

+
+;; diff --git a/lib/pages/dune b/lib/pages/dune index 8cc2720..8ec2184 100644 --- a/lib/pages/dune +++ b/lib/pages/dune @@ -3,6 +3,10 @@ (library (name pages) (libraries + ; local + shared + ; + logs lwt.unix server-reason-react.belt server-reason-react.js diff --git a/lib/pages/lmao.re b/lib/pages/lmao.re new file mode 100644 index 0000000..24c630e --- /dev/null +++ b/lib/pages/lmao.re @@ -0,0 +1,40 @@ +[@react.component] +let make = () => { + + + + + {React.string("Bloody Shovel 5")} + +

{React.string("Oh hai")}

+ ; + // let _lol = conn; + // let make = (~conn) => { +}; +// [@react.component] +// let make = (~conn: Query.conn) => { +// let posts = +// switch (Query.get_poasts(conn)) { +// | Ok(posts) => posts +// | Error(_) => [] +// }; + +// +// +// +// {React.string("Bloody Shovel 5")} +// +// +//

{React.string("Oh hai")}

+//
    +// {posts +// |> List.map(post => +//
  • +// {React.string(post.title)} +//
  • +// ) +// |> React.array} +//
+// +// ; +// }; -- cgit v1.2.3