Skip to content

feat: add hover tooltips to dashboard summary stat cards (Closes #484)#798

Closed
orgy272 wants to merge 1 commit intoSolFoundry:mainfrom
orgy272:feat/tooltip-v2
Closed

feat: add hover tooltips to dashboard summary stat cards (Closes #484)#798
orgy272 wants to merge 1 commit intoSolFoundry:mainfrom
orgy272:feat/tooltip-v2

Conversation

@orgy272
Copy link
Copy Markdown
Contributor

@orgy272 orgy272 commented Mar 23, 2026

Summary

Add informative hover tooltips to all four dashboard summary stat cards, providing users with contextual descriptions of each metric.

Closes #484

Changes

  • frontend/src/components/ContributorDashboard.tsx — Added optional tooltip prop to SummaryCard component with hover-triggered tooltip display, and added descriptive tooltips to all 4 stat cards (Total Earned, Active Bounties, Pending Payouts, Reputation Rank).

Implementation Details

  • Uses useState for hover state management (already imported)
  • Pure Tailwind CSS tooltip — no external dependencies
  • Dark mode support via dark: variant classes
  • Accessible with role="tooltip" attribute
  • CSS arrow indicator using border trick
  • Tooltip positions above the card with centered alignment
  • Minimal diff: 22 lines added, 2 modified in a single file

Wallet

61FYMEPXMe73ypR53wMAR7PYAWHhZWKFJMNKnG9NwoW

…oundry#484)

- Added optional tooltip prop to SummaryCard component
- Tooltips appear on hover with smooth positioning
- Added descriptive tooltips to all 4 dashboard stats:
  Total Earned, Active Bounties, Pending Payouts, Reputation Rank
- Pure CSS tooltip using Tailwind classes, no external dependencies
- Supports dark mode with appropriate color scheme
- Accessible: uses role='tooltip' attribute
- Zero new files, minimal diff — only modifies ContributorDashboard.tsx
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

This change extends the SummaryCard component in the ContributorDashboard with hover-based tooltip functionality. The SummaryCardProps interface was updated with an optional tooltip prop. The component now manages tooltip visibility state through mouse enter/leave events on the card container and conditionally renders an absolutely-positioned tooltip element with an arrow when both conditions are met. The new tooltip prop was passed to four SummaryCard instances: Total Earned, Active Bounties, Pending Payouts, and Reputation Rank.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding hover tooltips to dashboard summary stat cards, matching the code changes which add tooltips to the SummaryCard component.
Description check ✅ Passed The description is directly related to the changeset, detailing the tooltip feature added to the dashboard cards with implementation details and file modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown

@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 `@frontend/src/components/ContributorDashboard.tsx`:
- Around line 247-255: The SummaryCard component currently toggles the tooltip
only via onMouseEnter/onMouseLeave; update SummaryCard to also support keyboard
accessibility by adding tabIndex={0} on the card container, wire onFocus and
onBlur to setShowTooltip(true/false) alongside the existing mouse handlers,
generate or accept a stable tooltip id (e.g., tooltipId) and add
aria-describedby={tooltipId} to the container and id={tooltipId} on the tooltip
element, and add a keydown handler on the container to dismiss the tooltip on
Escape (clearing showTooltip) while ensuring the tooltip's visibility is
reflected with appropriate aria-hidden/role attributes; apply the same changes
to the other identical card instance referenced (lines ~273-281).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6150a222-482f-4bad-803f-97ab1e3603b9

📥 Commits

Reviewing files that changed from the base of the PR and between 72d63b0 and 2673f72.

📒 Files selected for processing (1)
  • frontend/src/components/ContributorDashboard.tsx

Comment on lines +247 to +255
function SummaryCard({ label, value, suffix, icon, trend, trendValue, tooltip }: SummaryCardProps) {
const [showTooltip, setShowTooltip] = useState(false);

return (
<div className="bg-white dark:bg-surface-100 rounded-xl p-5 border border-gray-200 hover:border-gray-300 dark:border-white/5 dark:hover:border-white/10 transition-colors shadow-sm dark:shadow-none">
<div
className="bg-white dark:bg-surface-100 rounded-xl p-5 border border-gray-200 hover:border-gray-300 dark:border-white/5 dark:hover:border-white/10 transition-colors shadow-sm dark:shadow-none relative"
onMouseEnter={() => tooltip && setShowTooltip(true)}
onMouseLeave={() => setShowTooltip(false)}
>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Tooltip is not accessible to keyboard users.

The tooltip visibility is controlled solely via onMouseEnter/onMouseLeave, which excludes keyboard navigation. To meet WCAG 2.1 SC 1.4.13 (Content on Hover or Focus), the tooltip must also appear on focus and be dismissible without moving pointer or focus.

Missing requirements:

  1. tabIndex={0} on the card container to make it focusable
  2. onFocus / onBlur handlers to toggle showTooltip
  3. aria-describedby linking the card to the tooltip's id for screen readers
  4. Escape key dismissal (optional but recommended)
♿ Proposed fix for keyboard accessibility
 function SummaryCard({ label, value, suffix, icon, trend, trendValue, tooltip }: SummaryCardProps) {
   const [showTooltip, setShowTooltip] = useState(false);
+  const tooltipId = tooltip ? `tooltip-${label.replace(/\s+/g, '-').toLowerCase()}` : undefined;

   return (
     <div
-      className="bg-white dark:bg-surface-100 rounded-xl p-5 border border-gray-200 hover:border-gray-300 dark:border-white/5 dark:hover:border-white/10 transition-colors shadow-sm dark:shadow-none relative"
+      className="bg-white dark:bg-surface-100 rounded-xl p-5 border border-gray-200 hover:border-gray-300 dark:border-white/5 dark:hover:border-white/10 transition-colors shadow-sm dark:shadow-none relative focus:outline-none focus:ring-2 focus:ring-solana-purple/50"
+      tabIndex={tooltip ? 0 : undefined}
+      aria-describedby={tooltipId}
       onMouseEnter={() => tooltip && setShowTooltip(true)}
       onMouseLeave={() => setShowTooltip(false)}
+      onFocus={() => tooltip && setShowTooltip(true)}
+      onBlur={() => setShowTooltip(false)}
     >
       {/* ... card content ... */}
       {showTooltip && tooltip && (
         <div
+          id={tooltipId}
           role="tooltip"
           className="absolute z-50 left-1/2 -translate-x-1/2 bottom-full mb-2 px-3 py-2 text-xs text-white bg-gray-900 dark:bg-gray-700 rounded-lg shadow-lg whitespace-nowrap pointer-events-none"
         >

Also applies to: 273-281

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@frontend/src/components/ContributorDashboard.tsx` around lines 247 - 255, The
SummaryCard component currently toggles the tooltip only via
onMouseEnter/onMouseLeave; update SummaryCard to also support keyboard
accessibility by adding tabIndex={0} on the card container, wire onFocus and
onBlur to setShowTooltip(true/false) alongside the existing mouse handlers,
generate or accept a stable tooltip id (e.g., tooltipId) and add
aria-describedby={tooltipId} to the container and id={tooltipId} on the tooltip
element, and add a keydown handler on the container to dismiss the tooltip on
Escape (clearing showTooltip) while ensuring the tooltip's visibility is
reflected with appropriate aria-hidden/role attributes; apply the same changes
to the other identical card instance referenced (lines ~273-281).

@orgy272
Copy link
Copy Markdown
Contributor Author

orgy272 commented Mar 23, 2026

Superseded by updated PR with accessibility fixes

@orgy272 orgy272 closed this Mar 23, 2026
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.

1 participant