diff options
| author | Ben Sima <ben@bensima.com> | 2025-11-27 18:34:10 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2025-11-27 18:34:10 -0500 |
| commit | 4ccd1ada825395654a9e6053d9d7e6cd4986b1c0 (patch) | |
| tree | 4ac407b156bf34a2f0779c08daede05d3b30c178 /Omni/Jr/Web.hs | |
| parent | 1c37d95f79d67eccd20dd2d1fc2348a78be08c84 (diff) | |
Convert dashboard ready queue and recent activity to list-group pattern
All the changes are in place: 1. Created `renderListGroupItem` function
for compact list-style task di 2. Updated the dashboard's Ready
Queue section to use `list-group` with 3. Updated the dashboard's
Recent Activity section to use `list-group` w 4. Updated the
`RecentActivityPartial` (HTMX partial) to also use the li 5. Added CSS
styles for `.list-group`, `.list-group-item`, etc. in Style 6. Added
dark mode styles for the list-group components
The build and tests pass successfully.
Task-Id: t-156.2
Diffstat (limited to 'Omni/Jr/Web.hs')
| -rw-r--r-- | Omni/Jr/Web.hs | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/Omni/Jr/Web.hs b/Omni/Jr/Web.hs index 9bc5ae5..79e32f6 100644 --- a/Omni/Jr/Web.hs +++ b/Omni/Jr/Web.hs @@ -310,6 +310,20 @@ renderTaskCard t = Lucid.span_ [Lucid.class_ "priority"] (Lucid.toHtml (tshow (TaskCore.taskPriority t))) Lucid.p_ [Lucid.class_ "task-title"] (Lucid.toHtml (TaskCore.taskTitle t)) +renderListGroupItem :: (Monad m) => TaskCore.Task -> Lucid.HtmlT m () +renderListGroupItem t = + Lucid.a_ + [ Lucid.class_ "list-group-item", + Lucid.href_ ("/tasks/" <> TaskCore.taskId t) + ] + <| do + Lucid.div_ [Lucid.class_ "list-group-item-content"] <| do + Lucid.span_ [Lucid.class_ "list-group-item-id"] (Lucid.toHtml (TaskCore.taskId t)) + Lucid.span_ [Lucid.class_ "list-group-item-title"] (Lucid.toHtml (TaskCore.taskTitle t)) + Lucid.div_ [Lucid.class_ "list-group-item-meta"] <| do + statusBadge (TaskCore.taskStatus t) + Lucid.span_ [Lucid.class_ "priority"] (Lucid.toHtml (tshow (TaskCore.taskPriority t))) + instance Lucid.ToHtml HomePage where toHtmlRaw = Lucid.toHtml toHtml (HomePage stats readyTasks recentTasks) = @@ -342,8 +356,8 @@ instance Lucid.ToHtml HomePage where if null readyTasks then Lucid.p_ [Lucid.class_ "empty-msg"] "No tasks ready for work." else - Lucid.div_ [Lucid.class_ "task-list"] - <| traverse_ renderTaskCard (take 5 readyTasks) + Lucid.div_ [Lucid.class_ "list-group"] + <| traverse_ renderListGroupItem (take 5 readyTasks) Lucid.h2_ "Recent Activity" Lucid.div_ @@ -354,8 +368,8 @@ instance Lucid.ToHtml HomePage where <| if null recentTasks then Lucid.p_ [Lucid.class_ "empty-msg"] "No recent tasks." else - Lucid.div_ [Lucid.class_ "task-list"] - <| traverse_ renderTaskCard recentTasks + Lucid.div_ [Lucid.class_ "list-group"] + <| traverse_ renderListGroupItem recentTasks where statCard :: (Monad m) => Text -> Int -> Text -> Text -> Lucid.HtmlT m () statCard label count badgeClass href = @@ -1126,8 +1140,8 @@ instance Lucid.ToHtml RecentActivityPartial where if null recentTasks then Lucid.p_ [Lucid.class_ "empty-msg"] "No recent tasks." else - Lucid.div_ [Lucid.class_ "task-list"] - <| traverse_ renderTaskCard recentTasks + Lucid.div_ [Lucid.class_ "list-group"] + <| traverse_ renderListGroupItem recentTasks instance Lucid.ToHtml ReadyCountPartial where toHtmlRaw = Lucid.toHtml |
