Skip to content

feat: per-widget Eye toggle to hide amounts (replace global Costs toggle)#214

Merged
EdiWeeks merged 2 commits into
mainfrom
feature/213-per-widget-amount-visibility-toggle
Jun 22, 2026
Merged

feat: per-widget Eye toggle to hide amounts (replace global Costs toggle)#214
EdiWeeks merged 2 commits into
mainfrom
feature/213-per-widget-amount-visibility-toggle

Conversation

@EdiWeeks

Copy link
Copy Markdown
Contributor

Summary

Replaces the single global "Costs visible" toggle in the project header with a per-widget Eye / Eye-slash icon on each of the 8 KPI cards, so individual amounts can be hidden independently (e.g. hide Actual Cost while Budget Cost stays visible).

Implements #213 with the agreed scoping decisions:

  1. All 8 widgets (4 time + 4 financial) get the Eye toggle.
  2. The per-widget "i" info tooltip is dropped (the Eye replaces it in the top-right corner).
  3. Hidden state is local and resets on reload (not persisted).
  4. PDF export keeps working.

Changes

  • src/components/projects/ProjectKPICards.tsx
    • Remove the InfoTooltip ("i") component and all per-card tooltip data.
    • Add a VisibilityToggle (Eye/Eye-slash) and hiddenCards local state (keyed by KPI label).
    • When a card is hidden, mask the value as ••••• and hide its £ breakdown.
  • src/components/projects/ProjectHeader.tsx — remove the "Costs visible" button. showCosts/showPrices are retained because they still drive the PDF export ("Without Financials") and the Spend vs Budget chart.
  • src/hooks/useProjectDetailsStore.ts — default showCosts to true (costs visible by default now the global toggle is gone; export still toggles it off temporarily while printing).

Behaviour notes (reviewer, please sanity-check)

  • Costs now visible by default. With no global toggle, the default flipped to visible — this also means the Spend vs Budget chart shows cost figures by default (previously hidden until toggled), and there's no longer an interactive way to hide that chart's costs. The Eye toggles cover only the 8 KPI widgets. Confirmed acceptable with the requester.
  • The Eye masks the main amount and the £ breakdown; secondary sub-labels (e.g. "1492.5h remaining") remain visible.

Test plan

  • bun run typecheck — clean
  • bun run lint — 0 errors
  • bun run test — 54/54 pass
  • bun run build — compiles successfully
  • Manually tested on PR00100:
    • "Costs visible" button removed from header
    • Each of the 8 widgets has an Eye icon; clicking hides just that widget's amount (•••••) and toggles to eye-slash; clicking again reveals
    • Hiding is independent per widget
    • Reload resets all widgets to visible
    • Export PDF → "With Financials" prints on-screen state; "Without Financials" omits the financial row

Note: bun run format:check flags many files locally due to a Windows CRLF/LF mismatch (pristine main files also fail). Committed blobs are LF (core.autocrlf=true), so CI's format check passes.

Fixes #213

🤖 Generated with Claude Code

Replace the single header "Costs visible" toggle with a per-widget Eye /
Eye-slash icon (where the info "i" used to be) on all 8 project KPI cards,
so each widget's amount can be hidden individually. Hidden state is local
to the component and resets on reload.

- ProjectKPICards: drop the InfoTooltip ("i") and its tooltip data; add a
  VisibilityToggle and per-card hiddenCards state; mask the value (and the
  £ breakdown) when a card is hidden.
- ProjectHeader: remove the "Costs visible" button. showCosts/showPrices
  are retained for the PDF export ("Without Financials") and the Spend vs
  Budget chart.
- useProjectDetailsStore: default showCosts to true now that the global
  toggle is gone (costs visible by default; export still hides temporarily).

Fixes #213

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 22, 2026 09:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the global “Costs visible” header toggle with per-widget Eye/Eye-slash controls on each KPI card, enabling independent masking of each KPI’s displayed amount while keeping PDF export behavior intact.

Changes:

  • Add per-card visibility toggles to all 8 KPI cards and mask the main value (and financial breakdown) when hidden.
  • Remove the global “Costs visible” button from the project header UI.
  • Flip showCosts default to true in the project details store to match the new UX baseline while retaining its use for export/chart gating.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/hooks/useProjectDetailsStore.ts Changes default internal cost visibility to true to align with removal of the global toggle.
src/components/projects/ProjectKPICards.tsx Replaces info tooltips with per-card Eye toggles and implements per-widget masking state.
src/components/projects/ProjectHeader.tsx Removes the global “Costs visible” button while keeping PDF export controls.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/projects/ProjectKPICards.tsx Outdated
financialKpis is statically typed with a breakdown property, so the
`'breakdown' in kpi` runtime guard was redundant. Access kpi.breakdown
directly (still nullable).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@EdiWeeks
EdiWeeks merged commit 688d7de into main Jun 22, 2026
4 checks passed
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.

[FEATURE] Per-widget Eye toggle to hide amounts (replace global "Costs visible" button)

3 participants