Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 134
Update mobile web pages and overflow menus for asset details page#12980
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -29,7 +29,9 @@ import { | ||
| import { UserCoinAccount } from '@audius/sdk' | ||
| import { useQueryClient } from '@tanstack/react-query' | ||
| import ActionDrawer from 'components/action-drawer/ActionDrawer' | ||
| import { ToastContext } from 'components/toast/ToastContext' | ||
| import { useIsMobile } from 'hooks/useIsMobile' | ||
| import { copyToClipboard } from 'utils/clipboardUtil' | ||
| import { | ||
| @@ -55,7 +57,9 @@ const WalletRow = ({ | ||
| }: WalletRowProps) => { | ||
| const { toast } = useContext(ToastContext) | ||
| const [isRemovingWallet, setIsRemovingWallet] = useState(false) | ||
| const isMobile = useIsMobile() | ||
| const queryClient = useQueryClient() | ||
| const [isMobileOverflowOpen, setIsMobileOverflowOpen] = useState(false) | ||
| const { data: currentUserId } = useCurrentUserId() | ||
| // For connected wallets we want to use the root wallet address, for in-app wallets the owner will be us and not the user so we need to use the token account address | ||
| const address = isInAppWallet ? account : owner | ||
| @@ -66,6 +70,14 @@ const WalletRow = ({ | ||
| const { mutateAsync: removeConnectedWalletAsync } = useRemoveConnectedWallet() | ||
| const onOpenMobileOverflow = useCallback(() => { | ||
| setIsMobileOverflowOpen(true) | ||
| }, [setIsMobileOverflowOpen]) | ||
| const onCloseMobileOverflow = useCallback(() => { | ||
| setIsMobileOverflowOpen(false) | ||
| }, [setIsMobileOverflowOpen]) | ||
| const handleRemove = useCallback(async () => { | ||
| try { | ||
| setIsRemovingWallet(true) | ||
| @@ -88,13 +100,13 @@ const WalletRow = ({ | ||
| [ | ||
| { | ||
| text: messages.copy, | ||
| icon: <IconCopy />, | ||
| icon: <IconCopy color='default' />, | ||
| onClick: copyAddressToClipboard | ||
| }, | ||
| !isInAppWallet | ||
| ? { | ||
| text: messages.remove, | ||
| icon: <IconTrash />, | ||
| icon: <IconTrash color='default' />, | ||
| onClick: handleRemove | ||
| } | ||
| : null | ||
| @@ -121,28 +133,51 @@ const WalletRow = ({ | ||
| {Math.trunc(balance / Math.pow(10, decimals)).toLocaleString()} | ||
| </Text> | ||
| </Flex> | ||
| <Flex | ||
| css={{ | ||
| marginLeft: 'auto', | ||
| flexBasis: 0 | ||
| }} | ||
| > | ||
| <PopupMenu | ||
| items={items} | ||
| aria-disabled={isRemovingWallet} | ||
| renderTrigger={(ref, trigger) => ( | ||
| <IconButton | ||
| ref={ref} | ||
| icon={IconKebabHorizontal} | ||
| size='s' | ||
| color='subdued' | ||
| disabled={isRemovingWallet} | ||
| onClick={() => trigger()} | ||
| aria-label={messages.options} | ||
| /> | ||
| )} | ||
| /> | ||
| </Flex> | ||
| {isMobile ? ( | ||
| <> | ||
| <IconButton | ||
| icon={IconKebabHorizontal} | ||
| onClick={onOpenMobileOverflow} | ||
| aria-label='More options' | ||
| /> | ||
| <ActionDrawer | ||
| actions={items.map((item) => ({ | ||
| text: item.text as string, | ||
| icon: item.icon, | ||
| onClick: (e) => { | ||
| // @ts-ignore - Element vs HTMLElement | ||
| item.onClick?.(e) | ||
| onCloseMobileOverflow() | ||
| } | ||
| }))} | ||
| isOpen={isMobileOverflowOpen} | ||
| onClose={onCloseMobileOverflow} | ||
| /> | ||
| </> | ||
| ) : ( | ||
| <Flex | ||
| css={{ | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sometimes i find the ai-generated css to be unnecessary ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. idk what this is, it was here from before | ||
| marginLeft: 'auto', | ||
| flexBasis: 0 | ||
| }} | ||
| > | ||
| <PopupMenu | ||
| items={items} | ||
| aria-disabled={isRemovingWallet} | ||
| renderTrigger={(ref, trigger) => ( | ||
| <IconButton | ||
| ref={ref} | ||
| icon={IconKebabHorizontal} | ||
| size='s' | ||
| color='subdued' | ||
| disabled={isRemovingWallet} | ||
| onClick={() => trigger()} | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea probably, also was here from before | ||
| aria-label={messages.options} | ||
| /> | ||
| )} | ||
| /> | ||
| </Flex> | ||
| )} | ||
| </Flex> | ||
| ) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
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.
can't type this properly?
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.
nah its a Element vs HTMLElement issue. I tried to type it, but it wasn't accepting MouseEvent as a generic for some reason