Skip to content

feat: redesign the home dashboard with trend sparklines - #829

Merged
pikann merged 3 commits into
Paca-AI:masterfrom
robertcoroianu:feat/home-dashboard-redesign
Nov 25, 2026
Merged

pikann merged 3 commits into
Paca-AI:masterfrom
robertcoroianu:feat/home-dashboard-redesign

Conversation

@robertcoroianu

Copy link
Copy Markdown
Contributor

Summary

The home page now shows what needs attention instead of a large banner and big, sparse cards.

Web

  • Header: one compact row. A summary line shows tasks assigned to you, how many are overdue (red) and how many are due this week (amber).
  • Stat cards: about half the previous height. Projects, Open Tasks and Team Members show a 30-day sparkline and a 7-day change badge. The badge is green when the change is good news, so for Open Tasks a drop is green. Open Tasks also shows "N assigned to you", and AI Agents gets a "Set up" link when no agent exists.
  • Layout: two columns. My Tasks and Waiting tasks on the left. On the right, a new Due soon card (overdue or due within 14 days) and a compact project list that replaces the card grid.
  • My Tasks gets status filter tabs with counts. Statuses with the same name in different projects share one tab. The page size goes from 10 to 50 so the counts, header summary and Due soon card cover a typical workload; "Load more" still handles anything beyond that.
  • New strings in all nine locales. The unused hero badge and subtitle strings are removed.

API: GET /projects/workspace-trend?days=N (7–90, default 30)

  • Returns the workspace-stats counters as daily series over the last N UTC days. Each value is the count at the end of that day, so the last value equals the live count.
  • Nothing is snapshotted and no migration is needed. Each series is rebuilt from existing rows:
    • Projects and team members: from created_at / deleted_at (exact).
    • Open tasks: from each task's status timeline, rebuilt from the status entries of its task.updated activities. After the last recorded change, the task's current status is used, so today's value matches workspace-stats. Older values are approximate: status changes made outside the task update endpoint aren't logged, and a status renamed or deleted since then counts as open.
  • Uses the same projects and per-project task scope (iam.WithProjectScopes) as workspace-stats. The project listing and scope setup are moved into helpers that both handlers share.
  • docs/architecture/authorization.md now lists the new endpoint with the other cross-project task reads.

Screenshots

These were taken against a dev stack. To show the filter tabs and the Due soon card, the browser replaced the /users/me/tasks response with six sample tasks that use the project's real statuses. The sparklines and every other part of the page show real data. They rise in one step because all of that dev data was created on the same day.

Dark
Home dashboard, dark theme

Light
Home dashboard, light theme

My Tasks filtered to one status
My Tasks filtered by status

Test plan

  • tsc -b clean, Biome clean for the changed files
  • Web vitest: full suite passes. GitSettings.test.tsx failed once under full-suite load, then passed three times on its own; that file isn't touched here.
  • New web tests: due-date helpers, sparkline maths, My Tasks filter tabs (names merged across projects; tabs hidden when every task has one status)
  • Go: go build, go vet, gofmt clean
  • New Go tests: handler tests for the day window, the 30-day default, rejecting a bad days value, and empty series when no source is wired; Postgres tests for the open-task timeline (status changes, reopening, deletion, a status name no longer in the project, case-insensitive names), per-project task scope, projects and users
  • go test ./... with PACA_TEST_PG_DSN: passes apart from six test/integration tests (TestIAMMigrationKeyMapping, TestPluginManifestActionsMigration, TestProjectRoleResourcesMigration, TestRolesAPI_EndToEnd, TestRolesAssignMigration, TestServiceAccountsAPI_EndToEnd). They fail the same way on an untouched master.
  • Checked in the browser against the dev stack, dark and light
  • Playwright e2e not run. projects/management.spec.ts and iam/list-scoping.spec.ts read the home page. The text and roles they assert on are unchanged, but they should be run.
  • Trend query timing on a large workspace. It took 5–17 ms on dev data.

🤖 Generated with Claude Code

robertcoroianu and others added 2 commits November 25, 2026 12:42
GET /projects/workspace-trend?days=N (7-90, default 30) returns the
workspace counters of /projects/workspace-stats as daily series over the
last N UTC days, for the home page stat-card sparklines.

Nothing is snapshotted; each series is rebuilt from existing rows:
- projects and team members from created_at / deleted_at (exact);
- open tasks from each task's status timeline, rebuilt from the "status"
  entries of its task.updated activities. The stretch after the last
  recorded change uses the current status, so today's value equals the
  live open-task count. Older values are approximate: status changes
  made outside the task update endpoint are not logged, and a status
  renamed or deleted since counts as open.

Projects and open tasks cover the same projects and per-project task
scope as workspace-stats; the project listing and scope setup are
extracted into helpers both handlers share.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Compact header with a live summary: tasks assigned to you, overdue and
  due this week.
- Slimmer stat cards with a 30-day sparkline and a 7-day change badge
  (from the new workspace-trend endpoint), "N assigned to you" on Open
  Tasks and a "Set up" link when no AI agent exists.
- Two-column layout: My Tasks and Waiting tasks on the left; a new
  "Due soon" card and a compact project list (replacing the card grid)
  on the right.
- My Tasks gets status filter tabs with counts; statuses with the same
  name in different projects share a tab. The page size goes from 10 to
  50 so the counts, the summary and "Due soon" cover a typical workload.
- New strings in all nine locales; the unused hero badge and subtitle
  strings are removed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@pullfrog pullfrog Bot 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.

Important

The new GET /projects/workspace-trend route is missing from the router's reviewed open-route allowlist, so three services/api router tests fail (TestEveryRouteIsGuarded, TestRouteCoverage_EveryNonOpenRouteDeclaresAGate, TestRouteCoverage_Behaviour). I reproduced all three on 60ed81c; the fix is a one-line allowlist entry, detailed inline on router.go.

Approach: sound — the trend is rebuilt from existing rows with no snapshot table or migration, and reconstructing open tasks from the task.updated status timeline is a reasonable, explicitly documented approximation. The project/team-member series are exact only for projects the caller can still see.

Reviewed changes

  • Workspace trend endpoint: new GET /projects/workspace-trend?days=N (7–90, default 30) returns daily project, open-task and team-member series with UTC dates; projects/users come from row timestamps, open tasks from the status entries of task.updated activities.
  • Shared project/task scoping: workspaceProjectIDs and workspaceTaskScope extracted so workspace-stats and the trend use the same project set and per-project task scope.
  • Home dashboard: compact header with overdue/due-this-week summary, sparkline stat cards with 7-day deltas, two-column layout, new Due soon card, project rows in place of the card grid, and status filter tabs with counts on My Tasks.
  • Supporting changes: due-dates and sparkline helpers with tests, ASSIGNED_TASKS_PAGE_SIZE 10→50, new strings in all nine locales, authorization docs updated.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

"overdue_many": "{{count}} просрочено",
"overdue_other": "{{count}} просрочено",
"dueThisWeek_one": "{{count}} — срок на этой неделе",
"dueThisWeek_other": "{{count}} — срок на этой неделе"

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.

dueThisWeek only has _one/_other, but Russian selects _few for counts 2–4 and _many for 5+, and i18next does not fall back to _other within the same language — those counts fall through to en and render English. The neighbouring assigned, overdue, subAssigned and trendLabel keys all carry the full _few/_many set; add the two missing forms here.

// ProjectCountTrend counts, at each day end, how many of projectIDs existed:
// created before it and not yet deleted. projectIDs is the caller's current
// set of accessible projects, so the last value equals the live project count.
func (r *WorkspaceTrendRepository) ProjectCountTrend(ctx context.Context, projectIDs []uuid.UUID, firstDayEnd, lastDayEnd time.Time) ([]int64, error) {

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.

workspaceProjectIDs only ever returns live projects (List/ListAccessible filter deleted_at IS NULL), so this method never sees a project deleted inside the window and the series omits it rather than showing a drop; OpenTaskTrend inherits the same gap. The PG test's gone project hides this because production can never pass a deleted id.

Technical details
# Project/open-task history omits projects deleted in the window

## Affected sites
- `services/api/internal/transport/http/handler/project_handler.go:283` — `workspaceProjectIDs` fetches via `svc.List` / `ListAccessible`, both of which filter `deleted_at IS NULL`.
- `services/api/internal/repository/postgres/workspace_trend_repository.go:66` — `ProjectCountTrend` handles `deleted_at`, but is never given a deleted id.
- `services/api/internal/repository/postgres/workspace_trend_pg_test.go:97` — the test inserts `gone` with `deleted_at` and passes it directly, which production cannot do.

## Required outcome
- Either include projects (and their tasks) that existed during the window but were deleted, or stop describing the project series as exact and document the same approximation as the open-task series.

Like workspace-stats, GET /projects/workspace-trend is open to any
authenticated caller and scopes its counts to the caller's projects and
task permissions inside the handler. Add it to the reviewed openRouteGroups
allow-list and cover it with the not-shadowed-by-{projectId} route test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@pullfrog pullfrog Bot 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.

ℹ️ No new issues in this delta — the router open-route allowlist failure from the previous review is fixed.

Reviewed changes

Reviewed the single commit since the prior pullfrog review (60ed81c): a test-only change that admits the new endpoint to the reviewed allowlist and covers its routing.

  • Workspace-trend route allowlisted: GET /api/v1/projects/workspace-trend now sits in openRouteGroups beside workspace-stats, and the coverage comment enumerates it with the other handler-scoped routes.
  • Route-shadowing test: added TestProjectsRoute_WorkspaceTrend_NotShadowedByProjectIDRoute, the sibling guard proving the static path is not captured by the {projectId} route.

I ran the router package locally: TestEveryRouteIsGuarded, TestRouteCoverage_EveryNonOpenRouteDeclaresAGate and TestRouteCoverage_Behaviour all pass now, as do both NotShadowedByProjectIDRoute tests and TestProjectsRoute_GetByID_StillParsesProjectID.

Pullfrog  | Fix it ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@pikann pikann 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.

LGTM! Thank you for the contribution! 🚀

@pikann
pikann merged commit 0eed6c6 into Paca-AI:master Nov 25, 2026
7 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.

2 participants