Add sorting options to task list pages

t-181·WorkTask·
·
·
·Omni/Jr.hs
Created3 months ago·Updated3 months ago

Description

Edit

Add ability to sort task lists on /tasks, /epics, /ready, /blocked, /intervention pages.

Sort options:

  • Newest First (default) - by createdAt DESC
  • Oldest First - by createdAt ASC
  • Recently Updated - by updatedAt DESC
  • Priority (High to Low) - P0 first, then P1, etc.
  • Priority (Low to High) - P4 first, then P3, etc.

Design: Add a small dropdown or horizontal toggle near the page title: Sort: [Newest ▾]

When clicked, shows options. Selection reloads page with query param.

Implementation:

1. Add query param to list routes: "tasks" :> QueryParam "sort" Text :> ... :> Get '[Lucid.HTML] TaskListPage Same for other list pages.

2. Sort values: "newest", "oldest", "updated", "priority-high", "priority-low"

3. In each handler, sort tasks after filtering: sortTasks :: Maybe Text -> [Task] -> [Task] sortTasks Nothing = sortBy (comparing (Down . taskCreatedAt)) sortTasks (Just "oldest") = sortBy (comparing taskCreatedAt) sortTasks (Just "updated") = sortBy (comparing (Down . taskUpdatedAt)) sortTasks (Just "priority-high") = sortBy (comparing taskPriority) sortTasks (Just "priority-low") = sortBy (comparing (Down . taskPriority)) sortTasks _ = sortBy (comparing (Down . taskCreatedAt))

4. Add sort dropdown component to list page headers.

5. Add CSS for .sort-dropdown similar to navbar dropdowns.

Files: Omni/Jr/Web.hs (routes, handlers, sort dropdown component), Omni/Jr/Web/Style.hs (sort-dropdown styles)

Timeline (0)

No activity yet.