Skip to content

feat(affiliate): show the exact updated at value for stats#7169

Merged
kernelwhisperer merged 1 commit intomainfrom
feat/show-actual-updated-at
Apr 6, 2026
Merged

feat(affiliate): show the exact updated at value for stats#7169
kernelwhisperer merged 1 commit intomainfrom
feat/show-actual-updated-at

Conversation

@kernelwhisperer
Copy link
Copy Markdown
Contributor

@kernelwhisperer kernelwhisperer commented Mar 18, 2026

Summary

Now that we moved away from 6hrs to 24hrs we can show the exact value of updated at.

Summary by CodeRabbit

  • New Features

    • Affiliate partner and trader statistics cards now display the precise timestamp indicating when metrics were last updated, significantly enhancing transparency regarding data freshness and providing users with clear visibility into how recent the displayed information is.
  • Improvements

    • Enhanced messaging for update intervals to better communicate refresh schedules and user expectations around metric synchronization.

@kernelwhisperer kernelwhisperer requested review from a team March 18, 2026 07:55
@kernelwhisperer kernelwhisperer self-assigned this Mar 18, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cowfi Ready Ready Preview Mar 18, 2026 7:58am
explorer-dev Ready Ready Preview Mar 18, 2026 7:58am
sdk-tools Ready Ready Preview Mar 18, 2026 7:58am
swap-dev Ready Ready Preview Mar 18, 2026 7:58am
widget-configurator Ready Ready Preview Mar 18, 2026 7:58am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
cosmos Ignored Ignored Mar 18, 2026 7:58am

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 18, 2026

Walkthrough

The pull request extends the MetricsCard component in the affiliate module to accept and display a lastUpdatedAt timestamp prop. Container components now pass the stats' last updated time to MetricsCard, which implements timestamp handling logic and updates the display to reflect when metrics were last refreshed.

Changes

Cohort / File(s) Summary
Container Components
apps/cowswap-frontend/src/modules/affiliate/containers/AffiliatePartnerStats.tsx, apps/cowswap-frontend/src/modules/affiliate/containers/AffiliateTraderStats.tsx
Added lastUpdatedAt={stats?.lastUpdatedAt} prop passing to MetricsCard component instances.
Pure Component
apps/cowswap-frontend/src/modules/affiliate/pure/MetricsCard.tsx
Added lastUpdatedAt?: string prop to MetricsCardProps; imported ms.macro and toValidDate; defined TIME_AGO_UPDATE_INTERVAL_MS constant; updated timestamp derivation logic to use new prop with fallback to approxUpdatedAt; changed tooltip text from "Updates daily at 02:00 UTC" to "Updates every 24 hours".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 The metrics now remember when they last were refreshed,
With timestamps passed like carrots in a vest,
Every day anew, the data tells its tale,
A rabbit's gift of timeliness will not fail! 🕐✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description lacks required sections (To Test, Background) and provides minimal context about implementation details, testing instructions, or visual changes. Add a 'To Test' section with steps and verification checkboxes to guide QA, and expand the summary with more implementation details.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding display of exact updated-at values for affiliate stats.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/show-actual-updated-at
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes.

Add @coderabbitai placeholder anywhere in the title of your PR and CodeRabbit will replace it with a title based on the changes in the PR. You can change the placeholder by changing the reviews.auto_title_placeholder setting.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/cowswap-frontend/src/modules/affiliate/pure/MetricsCard.tsx`:
- Around line 89-91: The relative "last updated" text (statsUpdatedTimeAgo) is
still hiding the exact timestamp in the title attribute
(formatDateWithTimezone(statsUpdatedAt)), which is inaccessible on
touch/keyboard; change the span that currently uses
title={formatDateWithTimezone(statsUpdatedAt)} to render both the relative time
and a visible exact timestamp (for example show "{statsUpdatedTimeAgo} —
{formatDateWithTimezone(statsUpdatedAt)}" or place the exact value in a visible
<time> element with dateTime={statsUpdatedAt}) so the exact updated-at is always
readable; keep the existing HelpTooltip usage and ensure the date/time element
uses the same formatDateWithTimezone(statsUpdatedAt) value for consistency and
accessibility.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d6cd6692-74b5-4484-8286-9363a74f6a62

📥 Commits

Reviewing files that changed from the base of the PR and between c1c8dba and a9c57c1.

📒 Files selected for processing (3)
  • apps/cowswap-frontend/src/modules/affiliate/containers/AffiliatePartnerStats.tsx
  • apps/cowswap-frontend/src/modules/affiliate/containers/AffiliateTraderStats.tsx
  • apps/cowswap-frontend/src/modules/affiliate/pure/MetricsCard.tsx

Comment thread apps/cowswap-frontend/src/modules/affiliate/pure/MetricsCard.tsx
@fairlighteth
Copy link
Copy Markdown
Contributor

My only comment is on the mobile affordance for the timestamp hover. There is no real affordance there also because we use the title attribute for that:
Screenshot 2026-03-18 at 12 14 52
Screenshot 2026-03-18 at 12 14 14

My suggestion would be to have both the current title but on hover of the (?) icon to show Timestamp + 'Updates every 24 hours' message in one tooltip message. Nobody can miss it then.

Also FYI right now the title affordance on desktop is only on the '9 hours ago' text part and not the whole 'Last updated 9 hours ago'. I'd fix that too.

@kernelwhisperer
Copy link
Copy Markdown
Contributor Author

My only comment is on the mobile affordance for the timestamp hover. There is no real affordance there also because we use the title attribute for that: Screenshot 2026-03-18 at 12 14 52 Screenshot 2026-03-18 at 12 14 14

My suggestion would be to have both the current title but on hover of the (?) icon to show Timestamp + 'Updates every 24 hours' message in one tooltip message. Nobody can miss it then.

Also FYI right now the title affordance on desktop is only on the '9 hours ago' text part and not the whole 'Last updated 9 hours ago'. I'd fix that too.

Please come up with an app-wide solution. I took this pattern from the orders table. 😐

@kernelwhisperer kernelwhisperer changed the base branch from develop to main March 20, 2026 08:38
Copy link
Copy Markdown
Collaborator

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

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

Looks good!
image

@kernelwhisperer kernelwhisperer merged commit 48c452a into main Apr 6, 2026
16 checks passed
@kernelwhisperer kernelwhisperer deleted the feat/show-actual-updated-at branch April 6, 2026 07:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants