From 71c20233ff79e696d0eeca2ce1462d3083fbcfed Mon Sep 17 00:00:00 2001 From: polwex Date: Sun, 15 Jun 2025 04:59:49 +0700 Subject: and were done, just like that --- bs5/server/pages/NoteList.re | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 bs5/server/pages/NoteList.re (limited to 'bs5/server/pages/NoteList.re') diff --git a/bs5/server/pages/NoteList.re b/bs5/server/pages/NoteList.re new file mode 100644 index 0000000..d284f0f --- /dev/null +++ b/bs5/server/pages/NoteList.re @@ -0,0 +1,52 @@ +open Lwt.Syntax; + +let is_substring = (a, b) => { + let len_a = String.length(a); + let len_b = String.length(b); + if (len_a > len_b) { + false; + } else { + let rec check = start => + if (start > len_b - len_a) { + false; + } else if (String.sub(b, start, len_a) == a) { + true; + } else { + check(start + 1); + }; + check(0); + }; +}; + +[@react.async.component] +let make = (~searchText: string) => { + let+ notes = DB.read_notes(); + + switch (notes) { + | Error(error) => +
+ "❌" + "Couldn't read notes file" + error +
+ | Ok(notes) when notes->List.length == 0 => +
+ "There's no notes created yet!" +
+ | Ok(notes) => + + }; +}; -- cgit v1.2.3