feat(frontend): fill project cards from the dashboard API - #305
Draft
nourshoreibah wants to merge 1 commit into
Draft
feat(frontend): fill project cards from the dashboard API#305nourshoreibah wants to merge 1 commit into
nourshoreibah wants to merge 1 commit into
Conversation
Every ProjectCard on /dashboard and /projects was rendered with
budget_used={0} members={0}, so the budget bar sat at 0% and the staff count
read "0 members" for every project regardless of the data.
Both pages now read GET /projects/dashboard, which returns the same
caller-scoped set of projects already carrying `spent` and `staff_count`, so
there is nothing left to aggregate client-side. That endpoint is admin-only on
main; the branch this is stacked on scopes it to the caller's projects.
ProjectCard guarded against a zero budget while here: with a hardcoded
budget_used of 0 the division was a harmless 0/0, but with real spend a project
with no budget set yields Infinity% straight into the bar width.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
GitHub retargets this to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Part of replacing the frontend's placeholder data with real APIs. Stacked on #304 — base that branch, not
main.📝 Description
ProjectCardon/dashboardand/projectswas rendered withbudget_used={0} members={0}for every project, so the budget bar sat at 0% and every card read "0 members" no matter the data. That was the last of the hardcoded placeholder data outside the pages #303 already touches.GET /projects/dashboardinstead ofGET /projects. It returns the same caller-scoped set of projects, already carryingspentandstaff_count— so there is nothing to aggregate client-side, and no second round trip.ProjectSummary/Dashboardadded to@/types(alongside the other extracted types from 252 extract duplicated inline types #288) rather than re-declaring a localProjectRowin each page, as both pages had been doing.ProjectCardnow guards the budget division. With a hardcodedbudget_usedof0the0/0was a harmlessNaN; with real spend, a project with no budget set producesInfinity%straight into the bar's inlinewidth. Overspend still reports honestly (200%) but the bar is clamped to the track.✔️ Verification
In
apps/frontend, all green:npm run typecheck— cleannpm run lint— cleannpx jest— 260 passed, 2 skipped, 25 suitesnpm run build— static export succeeds, all 12 routes emittedNew coverage in
test/components/ProjectsPage.test.tsxruns against both pages viadescribe.each: asserts the card data comes from/projects/dashboardand that/projectsis not called, that real spend/staff render instead of zeros, the no-budget case renders0%, and that a rejected request surfaces the error rather than empty cards.ProjectCard.test.tsxgains the zero-budget, no-budget-with-spend, and overspend-clamp cases.🏕️ (Optional) Future Work / Notes
/projects(the list endpoint) is untouched and still used elsewhere.🤖 Generated with Claude Code