only show insufficient sol message if connected

This commit is contained in:
saml33 2022-03-22 12:39:37 +11:00
parent 157bc3c176
commit 3ec735f2e9
3 changed files with 7 additions and 5 deletions

View File

@ -110,7 +110,7 @@ const MobileTradePage = () => {
<Swipeable index={viewIndex} onChangeIndex={handleChangeViewIndex}> <Swipeable index={viewIndex} onChangeIndex={handleChangeViewIndex}>
<div> <div>
<div className="mb-2 grid grid-cols-12 grid-rows-1 gap-4 rounded-lg py-2"> <div className="mb-2 grid grid-cols-12 grid-rows-1 gap-4 rounded-lg py-2">
<div className="col-span-7 pt-2"> <div className="col-span-7">
<AdvancedTradeForm /> <AdvancedTradeForm />
</div> </div>
<div className="col-span-5"> <div className="col-span-5">

View File

@ -149,7 +149,9 @@ export default function AdvancedTradeForm({
useEffect(() => { useEffect(() => {
const walletSol = walletTokens.find((a) => a.config.symbol === 'SOL') const walletSol = walletTokens.find((a) => a.config.symbol === 'SOL')
walletSol ? setInsufficientSol(walletSol.uiBalance < 0.01) : null walletSol && connected
? setInsufficientSol(walletSol.uiBalance < 0.01)
: null
}, [walletTokens]) }, [walletTokens])
useEffect(() => { useEffect(() => {
@ -760,7 +762,7 @@ export default function AdvancedTradeForm({
} }
return ( return (
<div className="flex h-full flex-col"> <div>
<ElementTitle className="hidden md:flex"> <ElementTitle className="hidden md:flex">
{marketConfig.name} {marketConfig.name}
<span className="ml-2 rounded border border-th-primary px-1 py-0.5 text-xs text-th-primary"> <span className="ml-2 rounded border border-th-primary px-1 py-0.5 text-xs text-th-primary">
@ -768,7 +770,7 @@ export default function AdvancedTradeForm({
</span> </span>
</ElementTitle> </ElementTitle>
{insufficientSol ? ( {insufficientSol ? (
<div className="pb-3 text-left"> <div className="mb-3 text-left">
<InlineNotification desc={t('add-more-sol')} type="warning" /> <InlineNotification desc={t('add-more-sol')} type="warning" />
</div> </div>
) : null} ) : null}

View File

@ -18,7 +18,7 @@ const OrderSideTabs: FunctionComponent<OrderSideTabsProps> = ({
const { t } = useTranslation('common') const { t } = useTranslation('common')
const market = useMangoStore((s) => s.selectedMarket.current) const market = useMangoStore((s) => s.selectedMarket.current)
return ( return (
<div className={`relative mb-3 -mt-2.5 md:border-b md:border-th-fgd-4`}> <div className={`relative mb-3 md:-mt-2.5 md:border-b md:border-th-fgd-4`}>
<div <div
className={`absolute hidden md:block ${ className={`absolute hidden md:block ${
side === 'buy' side === 'buy'