Commit 6895bccc authored by tom's avatar tom

fix account actions menu item click

parent e07fd2aa
...@@ -51,9 +51,8 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>( ...@@ -51,9 +51,8 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
})(); })();
return ( return (
<Skeleton loading={ loadingSkeleton } asChild> <Skeleton loading={ loadingSkeleton } asChild ref={ ref as React.ForwardedRef<HTMLDivElement> }>
<ChakraButton <ChakraButton
ref={ ref }
{ ...(expanded ? { 'data-expanded': true } : {}) } { ...(expanded ? { 'data-expanded': true } : {}) }
{ ...(selected ? { 'data-selected': true } : {}) } { ...(selected ? { 'data-selected': true } : {}) }
{ ...(highlighted ? { 'data-highlighted': true } : {}) } { ...(highlighted ? { 'data-highlighted': true } : {}) }
......
...@@ -54,9 +54,8 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>( ...@@ -54,9 +54,8 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
if (external) { if (external) {
return ( return (
<Skeleton loading={ loading } asChild> <Skeleton loading={ loading } ref={ ref as React.ForwardedRef<HTMLDivElement> } asChild>
<ChakraLink <ChakraLink
ref={ ref }
href={ href } href={ href }
className="group" className="group"
target="_blank" target="_blank"
...@@ -72,10 +71,9 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>( ...@@ -72,10 +71,9 @@ export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
} }
return ( return (
<Skeleton loading={ loading } asChild> <Skeleton loading={ loading } ref={ ref as React.ForwardedRef<HTMLDivElement> } asChild>
<ChakraLink <ChakraLink
asChild asChild
ref={ ref }
{ ...(disabled ? { 'data-disabled': true } : {}) } { ...(disabled ? { 'data-disabled': true } : {}) }
{ ...rest } { ...rest }
> >
......
...@@ -80,14 +80,14 @@ const AdaptiveTabsList = (props: Props) => { ...@@ -80,14 +80,14 @@ const AdaptiveTabsList = (props: Props) => {
overflowX={{ base: 'auto', lg: 'initial' }} overflowX={{ base: 'auto', lg: 'initial' }}
overscrollBehaviorX="contain" overscrollBehaviorX="contain"
css={{ css={{
'scroll-snap-type': 'x mandatory', scrollSnapType: 'x mandatory',
'scroll-padding-inline': '12px', // mobile page padding scrollPaddingInline: '12px', // mobile page padding
// hide scrollbar // hide scrollbar
'&::-webkit-scrollbar': { /* Chromiums */ '&::-webkit-scrollbar': { /* Chromiums */
display: 'none', display: 'none',
}, },
'-ms-overflow-style': 'none', /* IE and Edge */ '-ms-overflow-style': 'none', /* IE and Edge */
'scrollbar-width': 'none', /* Firefox */ scrollbarWidth: 'none', /* Firefox */
}} }}
{ {
...(props.stickyEnabled ? { ...(props.stickyEnabled ? {
......
...@@ -77,7 +77,7 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr ...@@ -77,7 +77,7 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr
} }
return ( return (
<MenuRoot> <MenuRoot unmountOnExit={ false }>
<MenuTrigger asChild> <MenuTrigger asChild>
<IconButton variant="dropdown" size="sm" className={ className } onClick={ handleButtonClick } aria-label="Show address menu"> <IconButton variant="dropdown" size="sm" className={ className } onClick={ handleButtonClick } aria-label="Show address menu">
<IconSvg name="dots" boxSize="18px"/> <IconSvg name="dots" boxSize="18px"/>
......
...@@ -2,11 +2,11 @@ import React from 'react'; ...@@ -2,11 +2,11 @@ import React from 'react';
import type { ItemProps } from '../types'; import type { ItemProps } from '../types';
import { MenuItem } from 'toolkit/chakra/menu';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import { useMetadataUpdateContext } from 'ui/tokenInstance/contexts/metadataUpdate'; import { useMetadataUpdateContext } from 'ui/tokenInstance/contexts/metadataUpdate';
import ButtonItem from '../parts/ButtonItem'; import ButtonItem from '../parts/ButtonItem';
import MenuItem from '../parts/MenuItem';
const MetadataUpdateMenuItem = ({ type }: ItemProps) => { const MetadataUpdateMenuItem = ({ type }: ItemProps) => {
...@@ -30,7 +30,7 @@ const MetadataUpdateMenuItem = ({ type }: ItemProps) => { ...@@ -30,7 +30,7 @@ const MetadataUpdateMenuItem = ({ type }: ItemProps) => {
} }
case 'menu_item': { case 'menu_item': {
return ( return (
<MenuItem onClick={ handleClick } isDisabled={ status === 'WAITING_FOR_RESPONSE' } value="refresh-metadata"> <MenuItem onClick={ handleClick } disabled={ status === 'WAITING_FOR_RESPONSE' } value="refresh-metadata">
<IconSvg name="refresh" boxSize={ 5 }/> <IconSvg name="refresh" boxSize={ 5 }/>
<span>Refresh metadata</span> <span>Refresh metadata</span>
</MenuItem> </MenuItem>
......
...@@ -8,6 +8,7 @@ import type { Transaction } from 'types/api/transaction'; ...@@ -8,6 +8,7 @@ import type { Transaction } from 'types/api/transaction';
import { getResourceKey } from 'lib/api/useApiQuery'; import { getResourceKey } from 'lib/api/useApiQuery';
import getPageType from 'lib/mixpanel/getPageType'; import getPageType from 'lib/mixpanel/getPageType';
import { MenuItem } from 'toolkit/chakra/menu';
import { useDisclosure } from 'toolkit/hooks/useDisclosure'; import { useDisclosure } from 'toolkit/hooks/useDisclosure';
import AddressModal from 'ui/privateTags/AddressModal/AddressModal'; import AddressModal from 'ui/privateTags/AddressModal/AddressModal';
import TransactionModal from 'ui/privateTags/TransactionModal/TransactionModal'; import TransactionModal from 'ui/privateTags/TransactionModal/TransactionModal';
...@@ -15,7 +16,6 @@ import IconSvg from 'ui/shared/IconSvg'; ...@@ -15,7 +16,6 @@ import IconSvg from 'ui/shared/IconSvg';
import AuthGuard from 'ui/snippets/auth/AuthGuard'; import AuthGuard from 'ui/snippets/auth/AuthGuard';
import ButtonItem from '../parts/ButtonItem'; import ButtonItem from '../parts/ButtonItem';
import MenuItem from '../parts/MenuItem';
interface Props extends ItemProps { interface Props extends ItemProps {
entityType?: 'address' | 'tx'; entityType?: 'address' | 'tx';
......
...@@ -3,10 +3,10 @@ import React from 'react'; ...@@ -3,10 +3,10 @@ import React from 'react';
import type { ItemProps } from '../types'; import type { ItemProps } from '../types';
import { MenuItem } from 'toolkit/chakra/menu';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
import ButtonItem from '../parts/ButtonItem'; import ButtonItem from '../parts/ButtonItem';
import MenuItem from '../parts/MenuItem';
const PublicTagMenuItem = ({ hash, type }: ItemProps) => { const PublicTagMenuItem = ({ hash, type }: ItemProps) => {
const router = useRouter(); const router = useRouter();
......
...@@ -7,6 +7,7 @@ import type { ItemProps } from '../types'; ...@@ -7,6 +7,7 @@ import type { ItemProps } from '../types';
import config from 'configs/app'; import config from 'configs/app';
import useApiQuery from 'lib/api/useApiQuery'; import useApiQuery from 'lib/api/useApiQuery';
import { PAGE_TYPE_DICT } from 'lib/mixpanel/getPageType'; import { PAGE_TYPE_DICT } from 'lib/mixpanel/getPageType';
import { MenuItem } from 'toolkit/chakra/menu';
import { useDisclosure } from 'toolkit/hooks/useDisclosure'; import { useDisclosure } from 'toolkit/hooks/useDisclosure';
import AddressVerificationModal from 'ui/addressVerification/AddressVerificationModal'; import AddressVerificationModal from 'ui/addressVerification/AddressVerificationModal';
import IconSvg from 'ui/shared/IconSvg'; import IconSvg from 'ui/shared/IconSvg';
...@@ -14,7 +15,6 @@ import AuthGuard from 'ui/snippets/auth/AuthGuard'; ...@@ -14,7 +15,6 @@ import AuthGuard from 'ui/snippets/auth/AuthGuard';
import useIsAuth from 'ui/snippets/auth/useIsAuth'; import useIsAuth from 'ui/snippets/auth/useIsAuth';
import ButtonItem from '../parts/ButtonItem'; import ButtonItem from '../parts/ButtonItem';
import MenuItem from '../parts/MenuItem';
const TokenInfoMenuItem = ({ hash, type }: ItemProps) => { const TokenInfoMenuItem = ({ hash, type }: ItemProps) => {
const router = useRouter(); const router = useRouter();
......
import React from 'react';
import { MenuItem as MenuItemChakra } from 'toolkit/chakra/menu';
interface Props {
className?: string;
children: React.ReactNode;
onClick: () => void;
value: string;
isDisabled?: boolean;
}
const MenuItem = ({ className, children, onClick, value, isDisabled }: Props) => {
return (
<MenuItemChakra className={ className } onClick={ onClick } disabled={ isDisabled } value={ value }>
{ children }
</MenuItemChakra>
);
};
export default MenuItem;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment