Repository navigation
feat: Add user profile preview card on hover/focus - #931
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
There was a problem hiding this comment.
💡 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".
| if (query.isError) { | ||
| const notFound = isProfileNotFound(query.error); |
There was a problem hiding this comment.
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 👍 / 👎.
867e042 to
89b66a6
Compare
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>
bd131bf to
edfd121
Compare
There was a problem hiding this comment.
💡 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) { |
There was a problem hiding this comment.
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 👍 / 👎.
Description
What?
Adds a user profile preview card that displays when hovering over or focusing on a linked username. The preview shows:
@nameCode, and primary roleOn 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:
UserPreviewcomponent: wraps any element to add preview functionalityUserPreviewCardcomponent: lazy-loaded content that fetches profile data on openUserPreviewSkeletoncomponent: loading state matching card layoutuseCoarsePointerhook: detects touch devices to switch between hover card and bottom sheetThe preview integrates with
UserFormat(enabled by default, can be disabled withpreview={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
preview={false}prop disables preview onUserFormat