Skip to content

add merchant cards#657

Closed
gudnuf wants to merge 8 commits intomasterfrom
stars
Closed

add merchant cards#657
gudnuf wants to merge 8 commits intomasterfrom
stars

Conversation

@gudnuf
Copy link
Contributor

@gudnuf gudnuf commented Sep 29, 2025

depends on #659 and #658

Adds a new /cards route that renders all of the user's star accounts. We dynamically load all the card designs based on the account's mint url. When a card is selected from the stack there is an animation the slides the card up while and balance, send, receive, and tx history appear.

This PR is currently open to master so that we can have the deployment.

There are 4 commits to this PR. The first 3 are needed to make the UI work.

This is the new cards ui:
image

image

@vercel
Copy link

vercel bot commented Sep 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
agicash Ready Ready Preview Comment Oct 16, 2025 8:23pm

@supabase
Copy link

supabase bot commented Oct 8, 2025

Updates to Preview Branch (stars) ↗︎

Deployments Status Updated
Database Thu, 16 Oct 2025 20:23:16 UTC
Services Thu, 16 Oct 2025 20:23:16 UTC
APIs Thu, 16 Oct 2025 20:23:16 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations Thu, 16 Oct 2025 20:23:16 UTC
Migrations Thu, 16 Oct 2025 20:23:16 UTC
Seeding Thu, 16 Oct 2025 20:23:16 UTC
Edge Functions Thu, 16 Oct 2025 20:23:16 UTC

View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@gudnuf gudnuf requested a review from jbojcic1 October 9, 2025 22:49
@gudnuf gudnuf added the P2 Medium priority label Oct 9, 2025
@gudnuf gudnuf self-assigned this Oct 9, 2025
@jbojcic1
Copy link
Collaborator

This PR is currently open to master so that we can have the deployment.

there is no deployment if master is not destination? I really liked how you broke these into smaller prs but this now kind of loses that benefit and makes it hard to review again

Copy link
Collaborator

@jbojcic1 jbojcic1 left a comment

Choose a reason for hiding this comment

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

how does one get "star accounts"?

export function useGetAccountFromLocation(select?: { type?: AccountType }) {
const [searchParams] = useSearchParams();
const accountId = searchParams.get('accountId');
const { data: accounts } = useAccounts({ type: select?.type });
Copy link
Collaborator

Choose a reason for hiding this comment

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

we already have useAccount hook. can we use that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

have you analysed the new queries to see if the query plan is still efficient (we need to be careful with this query as this table will have a lot of data)?

from wallet.transactions t
where t.user_id = p_user_id
and t.state in ('PENDING', 'COMPLETED', 'REVERSED')
and (p_account_id is null or t.account_id = p_account_id) -- Apply account filter if provided
Copy link
Collaborator

Choose a reason for hiding this comment

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

e.g. I think this or might not be a good thing for the performance

const PAGE_SIZE = 25;

export function useTransactions() {
export function useTransactions(select?: { accountId?: string }) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

did we call params like this (ones not used in the select part of the use query) select in other places too? I would maybe call it filter instead


const result = useInfiniteQuery({
queryKey: [allTransactionsQueryKey],
queryKey: [allTransactionsQueryKey, select],
Copy link
Collaborator

Choose a reason for hiding this comment

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

so query key will now be ['all-transactions', '[uuid]']. I wonder if we should make it ['all-transactions', 'account', '[uuid]'] instead to make it clear it's not a transaction id. or ['account-transactions', '[uuid]']

*/
export function SelectableWalletCard({
account,
isSelected,
Copy link
Collaborator

Choose a reason for hiding this comment

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

if we pass index and selectedCardIndex do we need isSelected?

};

// Calculate Y position based on state
let yOffset: number;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would extract this logic to function called getYOffset maybe. or one called getTransition that gets all transition styles

const transition = `all ${ANIMATION_DURATION}ms ${EASE_IN_OUT}`;

return (
// biome-ignore lint/a11y/useSemanticElements: div needed for absolute positioning wrapper
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this needed? becuase you used role button on div? why didn't you just use button if you want that role?

const [customDesignPath, setCustomDesignPath] = useState<string | null>(null);

useEffect(() => {
loadCardAsset(account.mintUrl).then(setCustomDesignPath);
Copy link
Collaborator

Choose a reason for hiding this comment

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

so while this is being loaded we show default element. how does the transition look once this is loaded? does the content jump?

loadCardAsset(account.mintUrl).then(setCustomDesignPath);
}, [account.mintUrl]);

const cardName = account.wallet.cachedMintInfo.name ?? account.name;
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are we picking this over acc name?

@gudnuf
Copy link
Contributor Author

gudnuf commented Oct 13, 2025

how does one get "star accounts"?

https://fake.agi.cash
https://fake2.agi.cash
https://fake4.agi.cash

@jbojcic1
Copy link
Collaborator

how does one get "star accounts"?

https://fake.agi.cash https://fake2.agi.cash https://fake4.agi.cash

but how does user gets those? is the idea that they add it via regular account add flow?

@gudnuf
Copy link
Contributor Author

gudnuf commented Oct 14, 2025

how does one get "star accounts"?

https://fake.agi.cash https://fake2.agi.cash https://fake4.agi.cash

but how does user gets those? is the idea that they add it via regular account add flow?

That's a question for @bobscully3, but yea one way is to add via regular account flow. This is a little awkward atm because we don't show star accounts in the account list so after adding you don't see the account until going over to the loyalty view. The other way to get star accounts is to receive ecash from from them (via nfc card for example). If the mint can only settle internally, then when receiving ecash the only option will be to add the account and swap to claim

@bobscully3
Copy link

we will want to have a way to search and add merchant mints in the future that is separate from the regular mint flow. i have some mockups that i can show on our call tomorrow.

@jbojcic1
Copy link
Collaborator

@gudnuf can this be closed? Can you also go through all your PRs and close irrelevant ones?

@gudnuf
Copy link
Contributor Author

gudnuf commented Jan 27, 2026

replaced by #758... closing

@gudnuf gudnuf closed this Jan 27, 2026
@gudnuf gudnuf deleted the stars branch January 29, 2026 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments