Skip to content

feat: add last synced timestamp to dashboard header (#186)#1298

Draft
Tannuu18 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Tannuu18:feat/issue-186-dashboard-header-timestamp
Draft

feat: add last synced timestamp to dashboard header (#186)#1298
Tannuu18 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
Tannuu18:feat/issue-186-dashboard-header-timestamp

Conversation

@Tannuu18
Copy link
Copy Markdown
Contributor

Summary

Brief description of what this PR does.

Adds a global dashboard sync timestamp in the header so users can see how fresh their metrics are.

Closes #186

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / code cleanup

Changes Made

  • Added a dashboard-scoped sync context/provider to track the last successful widget fetch.
  • Updated the DashboardHeader to show a muted “Synced just now” / “Synced X min ago” label.
  • Added a 60-second interval so the displayed timestamp stays current.
  • Kept the timestamp hidden until the first successful sync happens.

How to Test

Steps for the reviewer to verify this works:

  1. Open the dashboard.
  2. Wait for any widget to finish loading data.
  3. Confirm the header shows a small muted sync timestamp.
  4. Wait a minute and confirm the timestamp increments as expected.
  5. Refresh the page and confirm the sync line stays hidden until the first fetch completes.

Screenshots (if UI change)

image image

Checklist

  • Linked issue in summary
  • npm run lint passes locally
  • No TypeScript errors (npm run type-check)
  • Self-reviewed the diff
  • Added/updated tests if applicable

@vercel
Copy link
Copy Markdown

vercel Bot commented May 27, 2026

@Tannuu18 is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:feature GSSoC type bonus: new feature labels May 27, 2026
@github-actions
Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

@Tannuu18
Copy link
Copy Markdown
Contributor Author

heyy @Priyanshu-byte-coder can you please review and merge the issue??

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Thanks @Tannuu18 for the dashboard timestamp feature! Before we can merge, we need clarification on a key architectural change:

This PR replaces <DashboardSSEProvider> with <DashboardSyncProvider> from DashboardHeader. The SSEProvider handles real-time Server-Sent Events for the dashboard. Can you explain:

  1. What does DashboardSyncProvider do differently?
  2. Does it still maintain the SSE connection for real-time updates?
  3. Why does src/lib/supabase.ts need to be changed?

Also, the package-lock.json has many "peer": true additions — these appear to be from running a different npm version. Please ensure you run npm install with the same npm version as the project.

Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

This PR has 10 merge conflicts with current main (in src/app/dashboard/page.tsx, src/components/DashboardHeader.tsx, and src/lib/supabase.ts which have all been significantly updated). Please rebase onto current main and resolve the conflicts.

@Priyanshu-byte-coder Priyanshu-byte-coder added gssoc:approved GSSoC: PR approved for scoring level:beginner GSSoC: Beginner difficulty (20 pts) labels May 28, 2026
@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

Your PR has conflicts with the current main branch. Please rebase on main to resolve conflicts and this can be reviewed for merging. Labels have been added ✅

Priyanshu-byte-coder added a commit that referenced this pull request May 29, 2026
Shows relative time since last data sync (e.g. 'Synced 2 min ago') in
the dashboard header, using a fetch-intercepting context provider.

Co-authored-by: Tannuu18 <adhikaritani901@gmail.com>
Copy link
Copy Markdown
Owner

@Priyanshu-byte-coder Priyanshu-byte-coder left a comment

Choose a reason for hiding this comment

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

This PR now has merge conflicts with main due to recent merges. Please rebase onto the latest main branch and resolve all conflicts to proceed with merging.

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR has merge conflicts with main. Please rebase your branch against the latest main and force-push to resolve. Run: git fetch upstream && git rebase upstream/main

@Priyanshu-byte-coder
Copy link
Copy Markdown
Owner

This PR has merge conflicts with the current main branch. Please rebase your branch onto main, resolve the conflicts, and force-push. Once conflicts are resolved and the PR is marked as mergeable it will be reviewed for merging.

@Tannuu18 Tannuu18 force-pushed the feat/issue-186-dashboard-header-timestamp branch from 45f63c8 to 1ac414e Compare June 1, 2026 15:51
@Tannuu18
Copy link
Copy Markdown
Contributor Author

Tannuu18 commented Jun 1, 2026

  1. [DashboardSyncProvider] does something different from SSEProvider: it patches [window.fetch] and records a local last-synced timestamp whenever dashboard data requests succeed. That timestamp is only for the header UI in [DashboardHeader.tsx], so the user can see “synced just now” or “synced X min ago”.

  2. It does not maintain the SSE connection. The real-time stream is still handled by [DashboardSSEProvider.tsx], which opens [EventSource("/api/stream")] and dispatches the devtrack:sync and [devtrack:notifications] events. In the merged result, [DashboardSSEProvider] stays around the dashboard page and [DashboardSyncProvider]is scoped to the header only.

3.[supabase.ts] needed the merge because the timestamp change also touched the public-profile lookup path. The safe merged version keeps Supabase from being initialized when env vars are missing or placeholder values, and it avoids build/runtime crashes in environments where Supabase is not configured. It also preserves the exact username lookup used by the public profile checks.

@Tannuu18 Tannuu18 marked this pull request as draft June 1, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved GSSoC: PR approved for scoring gssoc26 GSSoC 2026 contribution level:beginner GSSoC: Beginner difficulty (20 pts) type:feature GSSoC type bonus: new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] Add 'last synced' timestamp to DashboardHeader

2 participants