Skip to content

feat(card): apply the tilt hover effect on the single-user page (#64)#66

Merged
Younesfdj merged 1 commit into
Younesfdj:masterfrom
eeshsaxena:feat/tilt-on-user-page
Jul 16, 2026
Merged

feat(card): apply the tilt hover effect on the single-user page (#64)#66
Younesfdj merged 1 commit into
Younesfdj:masterfrom
eeshsaxena:feat/tilt-on-user-page

Conversation

@eeshsaxena

Copy link
Copy Markdown
Contributor

Closes #64.

What

The Versus page wraps its card in TiltCard (the lean-toward-the-cursor plus specular sweep), but the single-user page - the more visited of the two - renders a bare PlayerCard. This applies the same effect there.

It reuses the existing TiltCard rather than duplicating the physics, and passes the same maskSrc={resolveCardTheme(card).bg} that DuelView uses, so the shine is clipped to the card's silhouette instead of painting a rectangle.

The one non-obvious bit: where the wrapper goes

TiltCard wraps the capture container, not the card:

<TiltCard maskSrc={resolveCardTheme(card).bg}>
  <div ref={captureRef} className="relative">
    ...glow...
    <PlayerCard card={card} />
  </div>
</TiltCard>

renderCardImage does node.cloneNode(true) on captureRef.current, so it exports exactly that subtree. Wrapping outside captureRef keeps TiltCard's hover-glass overlay a sibling of the captured node, so it can never end up in the downloaded or copied PNG. Wrapping inside (around PlayerCard alone) would have put the overlay into the export.

The tilt transform is likewise applied to the parent, and renderCardImage re-anchors the clone at the viewport origin, so it does not affect the exported image either. FlagPicker stays outside captureRef exactly as before.

Verification

  • npx tsc --noEmit clean; npm run lint 0 errors; npx vitest run green (20 files, 217 tests).
  • Confirmed the export path structurally: only the captureRef subtree is cloned, and the hover glass sits outside it.

An AI assistant helped implement this; I reviewed the change and ran the typecheck, linter and tests locally.

The FUT-style lean-and-shine already used on the Versus page is a big part of
the card's feel, and the single-user page is the more visited of the two.

Reuse the existing TiltCard rather than duplicating the physics, wrapping the
capture container instead of the card itself: renderCardImage clones the
captureRef subtree, so keeping the hover glass a sibling of that node ensures
it can never appear in the exported PNG.
@eeshsaxena

Copy link
Copy Markdown
Contributor Author

Closing this one - I could not verify the hover behaviour in a running browser on my side, and I would rather not land a visual change I have only reasoned about statically. Happy to leave #64 open for someone who can check it end to end. Thanks!

@eeshsaxena eeshsaxena closed this Jul 14, 2026
@Younesfdj Younesfdj reopened this Jul 15, 2026
@Younesfdj

Copy link
Copy Markdown
Owner

@eeshsaxena I checked it in the browser across the result page, hover feels right.
Reopened it myself since the closing reason is covered now. Anything left on your side, or good to merge?

@eeshsaxena eeshsaxena closed this Jul 16, 2026
@eeshsaxena eeshsaxena reopened this Jul 16, 2026
@eeshsaxena

eeshsaxena commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Sorry for closing this, it was closed by mistake during a cleanup. The PR looks good from my side, happy for it to be reviewed and merged whenever convenient.

@Younesfdj

Copy link
Copy Markdown
Owner

@eeshsaxena Im merging this now, thank you

@Younesfdj
Younesfdj merged commit df9b3dc into Younesfdj:master Jul 16, 2026
3 checks passed
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.

[feat] Apply Card Hover Effect on "User"-page

2 participants