From d5e9c7e0d3a9a8e35c11ff633ae0dbd08ffd27e9 Mon Sep 17 00:00:00 2001 From: James Brechtel Date: Tue, 19 May 2026 21:40:02 -0400 Subject: [PATCH] feat: replace server-rendered index with JS-rendered shell page - Rewrites indexPage to render a shell page with embedded JSON + JS - Adds searchJs with vanilla JS for client-side list rendering, filtering, sorting - Hash-based sort modes (#alpha, #tags, #course) - Search filters by title and filename (case-insensitive) - Fix: recipe links use /recipes/ prefix and encodeURIComponent for # encoding - Fix: avoid double-render on initial page load --- src/Roux/Html.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Roux/Html.hs b/src/Roux/Html.hs index 8ea3f56..f7c4a9e 100644 --- a/src/Roux/Html.hs +++ b/src/Roux/Html.hs @@ -255,7 +255,7 @@ searchJs = T.unlines , " if (items.length === 0) return '

No recipes found.

';" , " let html = '';" , " return html;" @@ -317,10 +317,9 @@ searchJs = T.unlines , "}" , "window.addEventListener('hashchange', updateActiveNav);" , "" - , "// Initial render" + , "// Initial render -- setting hash triggers hashchange" , "if (!location.hash) location.hash = 'alpha';" - , "updateActiveNav();" - , "render();" + , "else { updateActiveNav(); render(); }" , "" , "})();" ]