-
Notifications
You must be signed in to change notification settings - Fork 17
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
Feat/new open positions #1731
Feat/new open positions #1731
Conversation
…sistent-user-data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM-few smol questions
const pnlPercentage = (pnl / cost) * 100 | ||
const sign = Math.sign(pnl) | ||
|
||
const entryPrice = data.trade.underlyingAssetUnitPrice ?? 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious, when will this be null-ish? Asking because the entry price/return will show much higher than it is if it does happen to be null-ish
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well technically never, but accoring to the database it can be nullish, and if memory serves this has to do with how prisma types are produced based on the database structure, and then in turn zod types from prisma. Prisma doesnt support a bunch of things weirdly. So in turn this will appear in the types being optional as well. Although I don't like to use afterbang, as I feel like better safe than sorry :D
An example where it could be nullish btw, if for some reason we can't fetch the current eth price, but saving the trade still shouldn't break. Mega edgecase-y
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense - thanks for the explanation 👍
@@ -8,6 +10,7 @@ const UserMetadataContext = | |||
export const UserMetadataProvider = UserMetadataContext.Provider | |||
|
|||
export const useUserMetadata = () => { | |||
useRefId() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this line do? (return value not being used- seems like a side effect or just unused line?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the value is not being used, but as soon as you arrive, if there is an utm_source, we save that immediately to localstorage. I found this is the best place to do it.
@@ -8,6 +8,10 @@ export default { | |||
darkMode: 'selector', | |||
theme: { | |||
extend: { | |||
screens: { | |||
xs: '475px', | |||
lgn: '1080px', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's lgn
for here? seems very close to the default tailwind breakpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in my mind in made sense to name it like this :D but i know its not intuitive. It stands for lg-narrowed, and it is close to the actual lg. But the actual lg proved too broad, between 1024 - 1200something. So I added this for a little fine-tuning. Its hard to deal with columns when we want to show everything.
@@ -43,7 +43,7 @@ export const useQueryParams = <T extends Partial<UseQueryParamsArgs>>( | |||
const sell = searchParams.get('sell') || '' | |||
|
|||
const queryNetwork = | |||
chains.find((chain) => chain.id === network)?.id ?? chainId ?? 1 | |||
chains.find((chain) => chain.id === network)?.id ?? chainId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's safe to remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the reason is that useNetwork handles this case, but we already sent 1 if there is no queryParam, which is wrong. This was actually the reason why nothing loaded, when the network queryparam was there, it always tried to load ethereum
Summary of Changes
Test Data or Screenshots
By submitting this pull request, you are confirming the following to be true:
IndexCoop/index-app
.