-
Notifications
You must be signed in to change notification settings - Fork 146
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
DRAFT: add asset context menu #6161
base: dev
Are you sure you want to change the base?
Conversation
Thanks for making this PR @fabric-8 My biggest gripe with this work are the semantics, which might seem petty but I think do distinguish important differences in behaviour. This doesn't add a context menu, rather it makes each currency item a large dropdown trigger. By definition (at least Radix's definition), a context menu is opened by right click, and this isn't configurable in their library. |
@@ -46,7 +46,7 @@ export function useStxSendForm() { | |||
const sendMaxBalance = useMemo( | |||
() => | |||
convertAmountToBaseUnit( | |||
availableBalance.amount.minus(stxFees?.estimates[1].fee.amount || 0), | |||
availableBalance.amount.minus(stxFees?.estimates?.[1]?.fee?.amount || 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.
unintended change?
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.
Yep, should be fixed 👍
const isSwapEnabled = useConfigSwapsEnabled(); | ||
|
||
const handleReceiveClick = async () => { | ||
const isBtcToken = assetSymbol.toLowerCase() === 'btc'; |
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.
Considering currencies boolean like this isn't a beautiful way of handling two (or more) forks in the logic.
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.
Updated this part 👍
import React from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import * as ContextMenu from '@radix-ui/react-context-menu'; |
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.
@fabric-8, the way we have our UI library set up is that we export pre-styled radix components via @leather.io/ui
. We should do the same here.
First, creating a new context menu component in mono/packages/ui, adding styling, exporting, then consuming here. Let me know if you need any guidance doing this, though if you look at some of the other components wrapping with forwardRef
it's pretty straightforward
Introduces a context menu to the home/assets view, allowing users to access token-based actions via left-click. The goal is to provide a lightweight interaction until full token detail views are implemented.