Skip to content

feat: Add user profile preview card on hover/focus - #931

Merged
aXenDeveloper merged 2 commits into
canaryfrom
claude/intelligent-lamport-f88uqb
Nov 21, 2026
Merged

aXenDeveloper merged 2 commits into
canaryfrom
claude/intelligent-lamport-f88uqb

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Description

What?

Adds a user profile preview card that displays when hovering over or focusing on a linked username. The preview shows:

  • User's cover image and avatar with online status indicator
  • Name, @nameCode, and primary role
  • Reputation, join date, and last visit time (as short elapsed times)
  • For moderators: warning summary with active points and review link
  • "View profile" button to navigate to full profile

On touch devices (phones/tablets), tapping a linked name opens the same preview as a swipeable bottom sheet instead of navigating immediately.

The preview is implemented as:

  • UserPreview component: wraps any element to add preview functionality
  • UserPreviewCard component: lazy-loaded content that fetches profile data on open
  • UserPreviewSkeleton component: loading state matching card layout
  • useCoarsePointer hook: detects touch devices to switch between hover card and bottom sheet

The preview integrates with UserFormat (enabled by default, can be disabled with preview={false}), and is wired into all user name displays across the site: comments, forum, blog, search results, who-reacted lists, ModCP, and activity logs.

Why?

Provides quick context about users without leaving the current page, improving navigation and reducing friction. Shares cache with the profile page, so opening the preview and then navigating to the profile renders instantly. Only fetches data for previews that are actually opened, keeping performance impact minimal.

The implementation respects device capabilities: hover cards for mice, bottom sheets for touch, with proper accessibility (screen reader labels, keyboard navigation, semantic HTML).

Test Plan

  • Hover over linked usernames to verify preview card appears after 400ms delay
  • Tab to linked usernames to verify preview opens on focus
  • Verify preview closes after 150ms when pointer leaves
  • On touch device: tap linked username to verify bottom sheet opens instead of navigating
  • Verify preview loads user data and displays all sections correctly
  • For moderators: verify warnings section appears with correct data
  • Verify "View profile" button navigates to full profile
  • Verify preview shares cache with profile page (no duplicate requests)
  • Verify preview={false} prop disables preview on UserFormat
  • Verify preview works on all integrated components (comments, forum, blog, etc.)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-21T18:49:43.193282Z e400d64 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit e400d64.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 867e042e0e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +369 to +370
if (query.isError) {
const notFound = isProfileNotFound(query.error);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the loaded profile when a background refetch fails

When a previously loaded profile becomes stale and a background refetch fails, TanStack Query retains query.data but also sets query.isError. This unconditional error branch replaces the entire preview with an empty state, hiding the cached identity, statistics and View profile action despite usable data remaining available. This also affects reopening a stale cached preview while offline. Reserve the empty state for errors without data; otherwise retain the profile and show a warning with an in-place retry, as required by AGENTS.md.

AGENTS.md reference: AGENTS.md:L80-L80

Useful? React with 👍 / 👎.

@aXenDeveloper aXenDeveloper changed the title Add user profile preview card on hover/focus feat: Add user profile preview card on hover/focus Nov 21, 2026
@github-actions github-actions Bot added the 💡 Feature A new feature label Nov 21, 2026
@aXenDeveloper
aXenDeveloper force-pushed the claude/intelligent-lamport-f88uqb branch from 867e042 to 89b66a6 Compare November 21, 2026 17:40
Hovering or focusing a linked username or avatar opens a card with the
member's cover fading into the card, avatar with an online dot, name,
handle and primary role, Reputation / Joined / Last visited stats and a
View profile button. Moderators also see the member's warning summary with
a link to the ModCP. The card only receives the nameCode and loads the
public profile when it opens (shared cache with the profile page), with a
skeleton while loading and an empty state for missing or failed profiles.

On touch screens a tap opens the same content in a swipeable bottom
drawer. The drawer's built-in handle row can now be turned off, and the
new `DrawerIndent` scales the page behind an open bottom drawer.

All copy lives under `core.profile.preview` keys, and the user format docs
page documents the preview with screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aXenDeveloper
aXenDeveloper force-pushed the claude/intelligent-lamport-f88uqb branch from bd131bf to edfd121 Compare November 21, 2026 18:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: edfd121bb3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

);
}

if (query.isError) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Retain the warning summary when its background refetch fails

When a moderator reopens a preview after the member-standing cache becomes stale (10 seconds), a failed refetch leaves usable query.data but sets query.isError. This branch then hides the cached warning points, counts, and Review link behind the error message. Handle errors without data separately; for a failed refetch, retain the summary and show a warning with an in-place retry above it, as required by the repository’s error-feedback guidance.

AGENTS.md reference: AGENTS.md:L81-L81

Useful? React with 👍 / 👎.

@aXenDeveloper
aXenDeveloper merged commit 7d68dd9 into canary Nov 21, 2026
7 checks passed
@aXenDeveloper
aXenDeveloper deleted the claude/intelligent-lamport-f88uqb branch November 21, 2026 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant