Skip to content

Add hide-toggle UI blocks for budgets and categories in Control page - #85

Closed
Billos with Copilot wants to merge 3 commits into
developfrom
copilot/add-hide-toggle-budgets
Closed

Add hide-toggle UI blocks for budgets and categories in Control page#85
Billos with Copilot wants to merge 3 commits into
developfrom
copilot/add-hide-toggle-budgets

Conversation

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

The hide-toggle endpoints from PR #84 (/hide-toggle/budget/:name, /hide-toggle/category/:name) had no UI surface — and also contained two bugs that would have prevented them from working at all.

Bug fixes

  • Route param mismatch: Routes were declared with :budgetId/:categoryId but handlers accessed req.params.budgetName/req.params.categoryName → always undefined. Renamed route params to match.
  • No response: Handlers called next() with no subsequent middleware, resulting in a 404 on every toggle call. Changed to res.json({ hidden, budgetName|categoryName }).

Backend (controlPage.ts)

Fetches budgets, categories, and both hidden lists from Redis in parallel before rendering:

const [{ data: budgets }, { data: categories }, hiddenBudgets, hiddenCategories] = await Promise.all([
  BudgetsService.listBudget({ client, query: { page: 1, limit: 50 } }),
  CategoriesService.listCategory({ client, query: { page: 1, limit: 50 } }),
  redis.lrange(hiddenBudgetsKey, 0, -1),
  redis.lrange(hiddenCategoriesKey, 0, -1),
])

Frontend (control.pug + style.css)

  • Two new .items blocks — Hide Toggle Budgets and Hide Toggle Categories — each rendering a button per item with its current state (👁️ visible / 🙈 hidden)
  • Click fires GET /hide-toggle/{type}/{name}?api_token=TOKEN and updates the button visually without page reload
  • type is validated client-side as 'budget' or 'category' before URL construction to prevent path traversal
  • New CSS classes: .toggle-button, .visible-item, .hidden-item

Copilot AI changed the title [WIP] Add UI for hide toggle budgets functionality Add hide-toggle UI blocks for budgets and categories in Control page Jun 13, 2026
Copilot AI requested a review from Billos June 13, 2026 11:40
@Billos
Billos marked this pull request as ready for review June 13, 2026 14:06
@Billos Billos closed this Jun 13, 2026
@Billos
Billos deleted the copilot/add-hide-toggle-budgets branch June 13, 2026 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants