From b60c04b0cd3f0d865ca04b258903694680ebafef Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Fri, 28 Nov 2025 04:20:27 -0500 Subject: Use HTMX hx-boost for smoother page navigation The build and tests pass. The `hx-boost="true"` is already implemented o ```haskell pageBody content = Lucid.body_ [Lucid.makeAttribute "hx-boost" "true"] <| do navbar content ``` This means: - All anchor tags (``) and forms within the body will automatically u - Page content will be swapped via AJAX without full page reloads - Scroll position is preserved, making navigation feel snappier The task appears to have already been implemented correctly. The build p Task-Id: t-151.5 --- Omni/Jr/Web.hs | 54 ++++++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 32 deletions(-) (limited to 'Omni') diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index 4a37c6f..607d9d9 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -318,6 +318,12 @@ statusDropdownJs = "});" ] +pageBody :: (Monad m) => Lucid.HtmlT m () -> Lucid.HtmlT m () +pageBody content = + Lucid.body_ [Lucid.makeAttribute "hx-boost" "true"] <| do + navbar + content + navbar :: (Monad m) => Lucid.HtmlT m () navbar = Lucid.nav_ [Lucid.class_ "navbar"] <| do @@ -512,8 +518,7 @@ instance Lucid.ToHtml HomePage where toHtml (HomePage stats readyTasks recentTasks hasMoreRecent _now) = Lucid.doctypehtml_ <| do pageHead "Jr Dashboard" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h2_ "Task Status" Lucid.div_ [Lucid.class_ "stats-grid"] <| do @@ -571,8 +576,7 @@ instance Lucid.ToHtml ReadyQueuePage where toHtml (ReadyQueuePage tasks _now) = Lucid.doctypehtml_ <| do pageHead "Ready Queue - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml ("Ready Queue (" <> tshow (length tasks) <> " tasks)") if null tasks @@ -584,8 +588,7 @@ instance Lucid.ToHtml BlockedPage where toHtml (BlockedPage tasks _now) = Lucid.doctypehtml_ <| do pageHead "Blocked Tasks - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml ("Blocked Tasks (" <> tshow (length tasks) <> " tasks)") Lucid.p_ [Lucid.class_ "info-msg"] "Tasks with unmet blocking dependencies." @@ -598,8 +601,7 @@ instance Lucid.ToHtml InterventionPage where toHtml (InterventionPage tasks _now) = Lucid.doctypehtml_ <| do pageHead "Needs Intervention - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml ("Needs Intervention (" <> tshow (length tasks) <> " tasks)") Lucid.p_ [Lucid.class_ "info-msg"] "Tasks that have failed 3+ times and need human help." @@ -612,8 +614,7 @@ instance Lucid.ToHtml KBPage where toHtml (KBPage facts) = Lucid.doctypehtml_ <| do pageHead "Knowledge Base - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Knowledge Base" Lucid.p_ [Lucid.class_ "info-msg"] "Facts learned during task execution." @@ -709,8 +710,7 @@ instance Lucid.ToHtml FactDetailPage where toHtml (FactDetailNotFound fid) = Lucid.doctypehtml_ <| do pageHead "Fact Not Found - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Fact Not Found" Lucid.p_ [Lucid.class_ "error-msg"] (Lucid.toHtml ("Fact with ID " <> tshow fid <> " not found.")) @@ -718,8 +718,7 @@ instance Lucid.ToHtml FactDetailPage where toHtml (FactDetailFound fact now) = Lucid.doctypehtml_ <| do pageHead "Fact Detail - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.div_ [Lucid.class_ "task-detail-header"] <| do Lucid.h1_ <| do @@ -811,8 +810,7 @@ instance Lucid.ToHtml EpicsPage where toHtml (EpicsPage epics allTasks) = Lucid.doctypehtml_ <| do pageHead "Epics - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml ("Epics (" <> tshow (length epics) <> ")") Lucid.p_ [Lucid.class_ "info-msg"] "All epics (large, multi-task projects)." @@ -892,8 +890,7 @@ instance Lucid.ToHtml TaskListPage where toHtml (TaskListPage tasks filters _now) = Lucid.doctypehtml_ <| do pageHead "Tasks - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml ("Tasks (" <> tshow (length tasks) <> ")") @@ -972,8 +969,7 @@ instance Lucid.ToHtml TaskDetailPage where toHtml (TaskDetailNotFound tid) = Lucid.doctypehtml_ <| do pageHead "Task Not Found - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Task Not Found" Lucid.p_ <| do @@ -983,8 +979,7 @@ instance Lucid.ToHtml TaskDetailPage where toHtml (TaskDetailFound task allTasks activities maybeRetry commits maybeAggMetrics now) = Lucid.doctypehtml_ <| do pageHead (TaskCore.taskId task <> " - Jr") - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| Lucid.toHtml (TaskCore.taskTitle task) @@ -1416,8 +1411,7 @@ instance Lucid.ToHtml TaskReviewPage where toHtml (ReviewPageNotFound tid) = Lucid.doctypehtml_ <| do pageHead "Task Not Found - Jr Review" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Task Not Found" Lucid.p_ <| do @@ -1427,8 +1421,7 @@ instance Lucid.ToHtml TaskReviewPage where toHtml (ReviewPageFound task reviewInfo) = Lucid.doctypehtml_ <| do pageHead ("Review: " <> TaskCore.taskId task <> " - Jr") - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Review Task" @@ -1493,8 +1486,7 @@ instance Lucid.ToHtml TaskDiffPage where toHtml (DiffPageNotFound tid commitHash') = Lucid.doctypehtml_ <| do pageHead "Commit Not Found - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ "Commit Not Found" Lucid.p_ <| do @@ -1504,8 +1496,7 @@ instance Lucid.ToHtml TaskDiffPage where toHtml (DiffPageFound tid commitHash' diffOutput) = Lucid.doctypehtml_ <| do pageHead ("Diff " <> Text.take 8 commitHash' <> " - Jr") - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.div_ [Lucid.class_ "diff-header"] <| do Lucid.a_ [Lucid.href_ ("/tasks/" <> tid), Lucid.class_ "back-link"] "← Back to task" @@ -1519,8 +1510,7 @@ instance Lucid.ToHtml StatsPage where toHtml (StatsPage stats maybeEpic) = Lucid.doctypehtml_ <| do pageHead "Task Statistics - Jr" - Lucid.body_ <| do - navbar + pageBody <| do Lucid.div_ [Lucid.class_ "container"] <| do Lucid.h1_ <| case maybeEpic of Nothing -> "Task Statistics" -- cgit v1.2.3