Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[ECO-2161] Update market page with new grace period dynamics #237

Merged
merged 5 commits into from
Oct 7, 2024
Merged

Conversation

CRBl69
Copy link
Collaborator

@CRBl69 CRBl69 commented Sep 5, 2024

Description

This PR integrates the new grace period dynamics:

  • When the market is in a grace period:
    • the BONDING CURVE: XY% is replaced with GRACE PERIOD (X MINUTES AND Y SECONDS LEFT)
    • if the current user is not the market registrant:
      • the swap button is disabled
      • the swap button has an on hover popup that explains why it is disabled

In order to prevent the market registrant to trade on his own market, in case
of query failure, the UI will let anyone try to trade.

On trade, the grace period is automatically updated !

Screenshots

image

Testing

Go to vercel, register a market, go on the market page with two different accounts (registrant and another one).

Checklist

  • Did you check all checkboxes from the linked Linear task?

Copy link

vercel bot commented Sep 5, 2024

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

Name Status Preview Comments Updated (UTC)
emojicoin-dot-fun ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 7, 2024 4:35am
emojicoin-dot-fun-docs 🛑 Canceled (Inspect) Oct 7, 2024 4:35am

…stable reference to `props.data.symbol` and `queryClient`

Move grace period message to the top of the file

Put the `canTrade` logic into a `useMemo`

Add `numSwaps` to the `SwapButton` props so it re-renders properly when the # of swaps changes ready

Clean up and consolidate hook logic, decouple the fetch logic from display interval logic

Disable `useQuery` hook from fetching once the market is not in grace period
Copy link
Collaborator

@xbtmatt xbtmatt left a comment

Choose a reason for hiding this comment

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

Awesome, I sort of re-arranged a few things, but mostly kept the logic the same.

The main difference is I put the refetching logic into useQuery in the enabled field and then stop fetching when the market is out of the grace period.

I also changed the format to be 00:00 for the time left, since it was too big when looking at it on mobile. That was it though :D

@xbtmatt xbtmatt merged commit 4ba57a9 into main Oct 7, 2024
9 of 10 checks passed
@xbtmatt xbtmatt deleted the ECO-2161 branch October 7, 2024 04:46
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