Skip to content

Refactor to use view transitions for card animations#765

Merged
gudnuf merged 3 commits intogift-cards-2from
gift-cards-view-transitions
Jan 12, 2026
Merged

Refactor to use view transitions for card animations#765
gudnuf merged 3 commits intogift-cards-2from
gift-cards-view-transitions

Conversation

@jbojcic1
Copy link
Copy Markdown
Collaborator

No description provided.

@jbojcic1 jbojcic1 self-assigned this Jan 12, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 12, 2026

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

Project Deployment Review Updated (UTC)
agicash Ready Ready Preview, Comment Jan 12, 2026 8:45pm

@supabase
Copy link
Copy Markdown

supabase Bot commented Jan 12, 2026

This pull request has been ignored for the connected project hrebgkfhjpkbxpztqqke because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

) {
return extendedData
.slice()
.sort(
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I needed to add this sort because I noticed that the order of accounts returned by upsert user db function was different then the order returned by making a get call to get all accounts which was making gift-cards page show one order on initial render and different after rerender

@jbojcic1
Copy link
Copy Markdown
Collaborator Author

jbojcic1 commented Jan 12, 2026

I made this mostly with claude code by giving it my other example repo and your gift card branch and telling it I want to do the transitions like in my example repo (with some additional details). Then had to do some manual cleanup.

Besides work for transitions I also make some naming updates to make things more clear and to follow our approach so far (what goes to route, what goes to feature component, etc.)

It seems to be working fine but please double check

@jbojcic1 jbojcic1 requested a review from gudnuf January 12, 2026 14:33
size?: WalletCardSize;
className?: string;
/** When true, the info overlay (name, balance, gradient) fades out */
overlayHidden?: boolean;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This was used so that the selected card doesn't show the balance and gift card name, just the image.

And the animations removed below make it so that as the card is changin state the overlay fades in or out.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok we can return it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added back in 06df891

Comment thread app/features/gift-cards/gift-cards.tsx Outdated
const giftCardsToDiscover = useDiscoverGiftCards();

const handleCardClick = (account: CashuAccount) => {
navigate(`/gift-cards/${account.id}`, { viewTransition: true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not useNavigateWithViewTransition?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i thought it might mess with the card transition since that is tailored for transitioning the entire view. I might be wrong. we should try it

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I was right. it does mess it up. you can see things like x button moving etc.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we should either keep it as is or update useNavigateWithViewTransition so it can be used for cases like this where we are only transitioning certain elements between the views instead of entire view

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay I say we just keep as is for now then see about that later.

I want to do this same type of view transition for things like the send and receive flows and other places where the header or other page content stays the same across flows. For example, when our send confirmation screen goes to the pending transaction details this type of transition would look better. We can see then if there's something that makes sense to change about useNavigateWithViewTransition and LinkWithViewTransition

Comment thread app/features/gift-cards/transitions.css Outdated

/* Ensure cards maintain their stacking during transition */
::view-transition-image-pair(*) {
isolation: auto;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is this what was needed to make all the cards be in the same stacking context? I also saw you put all the cards in the gift-card-details.tsx, is that needed too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

claude added that and I forgot to check what is it for. seems to be working without it too

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I also saw you put all the cards in the gift-card-details.tsx, is that needed too?

that part is needed. that how view transition works. you have element with same view transition name on two pages and then browser transitions it. thus to transition other cards too when one is selected we need to have them on destination screen as well

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

checked it and this and some other stuff was not needed. in fact z-index set on transactions was making it visible over cards slightly. cleaned up in ec65137

Comment thread app/routes/_protected.gift-cards.tsx
@gudnuf gudnuf merged commit 80a42fb into gift-cards-2 Jan 12, 2026
5 checks passed
@gudnuf gudnuf deleted the gift-cards-view-transitions branch January 12, 2026 20:47
gudnuf pushed a commit that referenced this pull request Jan 27, 2026
* Refactor to use view transitions for card animations

* Cleanup

* Add back fade in/out transition for gift card item overlay
gudnuf pushed a commit that referenced this pull request Jan 30, 2026
* Refactor to use view transitions for card animations

* Cleanup

* Add back fade in/out transition for gift card item overlay
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.

2 participants