Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: session key demo: improve timers, styles, and error handling #1368

Merged
merged 9 commits into from
Feb 20, 2025

Conversation

jakehobbs
Copy link
Member

@jakehobbs jakehobbs commented Feb 15, 2025

Pull Request Checklist


PR-Codex overview

This PR focuses on improving the UI and functionality of transaction handling in the small cards component. It enhances layout styles, modifies transaction states, and refines the logic for recurring transactions.

Detailed summary

  • Updated styles in Wrapper.tsx for better layout.
  • Adjusted heading and div classes in MintCard.tsx.
  • Modified transaction card layout in TransactionsCard.tsx.
  • Improved state management for transaction countdown in Transactions.tsx.
  • Added timeToBuy to TransactionType in useRecurringTransactions.ts.
  • Enhanced error handling in transaction processes.
  • Streamlined transaction state updates and handling logic.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

vercel bot commented Feb 15, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
aa-sdk-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 6:32pm
aa-sdk-ui-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 20, 2025 6:32pm

Copy link

graphite-app bot commented Feb 15, 2025

How to use the Graphite Merge Queue

Add the label graphite-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. # using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

adamegyed
adamegyed previously approved these changes Feb 18, 2025
Comment on lines 36 to 37
timeToBuy?: number; // timestamp when the txn will initiate
secUntilBuy?: number; // seconds until the txn will initiate
Copy link
Collaborator

Choose a reason for hiding this comment

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

noob question: why do we need the timestamp here in addition to the countdown? could the countdown also serve as the time to reveal the transaction component's contents?

Copy link
Member Author

@jakehobbs jakehobbs Feb 19, 2025

Choose a reason for hiding this comment

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

The timeToBuy is used to calculate the number of seconds remaining each time the interval ticks. At first I was just trying to only have the timeToBuy and NOT include the secToBuy here, but I ran into a lot of annoying edge cases where it would be off by 1 due to re-renders, i.e. sometimes it would start from 11 sec and other times from 9 sec. This solution resulted in the cleanest UX, since we explicitly start the timer at 10 sec.

Copy link
Member Author

Choose a reason for hiding this comment

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

i think i found another good solution! will push shortly.

console.error("no session key client");
setCardStatus("initial");
// Handle the ticking of the timers.
useEffect(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

related question re: timestamp and interval - could the reveal be handled in the 10s countdown promise? Not super high pri, just curious if we could simplify

Copy link
Member Author

@jakehobbs jakehobbs Feb 19, 2025

Choose a reason for hiding this comment

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

Not totally following what you mean.

Copy link
Member Author

@jakehobbs jakehobbs Feb 19, 2025

Choose a reason for hiding this comment

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

Hmm, we could probably just give each of them the time they should fire at the beginning and set the timeouts to 0, 10, and 20 sec right away. But doing it how it is now also results in waiting extra time before starting the next txn if the current txn takes longer than 10 sec, which I think is nice to have.

@jakehobbs jakehobbs merged commit 6855610 into main Feb 20, 2025
7 checks passed
@jakehobbs jakehobbs deleted the jake/ui-demo-txn-simulation-timer branch February 20, 2025 18:32
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants