Skip to content

Commit

Permalink
Merge pull request #538 from secretkeylabs/denys/eng-2473-regression-…
Browse files Browse the repository at this point in the history
…issues-v0140-rc1

Fix regression issues v0.14.0-rc.1
  • Loading branch information
dhriaznov committed Aug 1, 2023
2 parents 3379fd1 + d36c030 commit e31964b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/app/hooks/useResetUserFlow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const resetUserFlowChannel = 'resetUserFlow';
const userFlowConfig: Record<string, { resetTo: string }> = {
'/send-btc': { resetTo: '/send-btc' },
'/confirm-btc-tx': { resetTo: '/send-btc' },
'/send-brc20': { resetTo: '/send-brc20' },
'/confirm-inscription-request': { resetTo: '/send-brc20' },
'/send-brc20': { resetTo: '/account-list' },
'/confirm-inscription-request': { resetTo: '/account-list' },
'/ordinal-detail': { resetTo: '/nft-dashboard' },
'/send-ordinal': { resetTo: '/nft-dashboard' },
'/confirm-ordinal-tx': { resetTo: '/nft-dashboard' },
Expand Down
2 changes: 1 addition & 1 deletion src/app/screens/accountList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function AccountList(): JSX.Element {
account.stxAddress === selectedAccount?.stxAddress;

const handleBackButtonClick = () => {
navigate(-1);
navigate('/');
};

async function onCreateAccount() {
Expand Down
6 changes: 3 additions & 3 deletions src/app/screens/nftDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { InscriptionsList } from '@secretkeylabs/xverse-core/types';
import AlertMessage from '@components/alertMessage';
import useAddressInscriptions from '@hooks/queries/ordinals/useAddressInscriptions';
import useStacksCollectibles from '@hooks/queries/useStacksCollectibles';
import ShowOrdinalReceiveAlert from '@components/showOrdinalReceiveAlert';
import Nft from './nft';
import ReceiveNftModal from './receiveNft';
import ShowOrdinalReceiveAlert from '@components/showOrdinalReceiveAlert';

const Container = styled.div`
display: flex;
Expand Down Expand Up @@ -241,12 +241,12 @@ function NftDashboard() {
totalCount = ordinalsLength + totalCount;
}
return totalCount;
}, [ordinals, nftsList]);
}, [nftsList, hasActivatedOrdinalsKey, ordinalsLength]);

const isGalleryOpen: boolean = useMemo(() => document.documentElement.clientWidth > 360, []);

useEffect(() => {
if (hasActivatedOrdinalsKey === undefined && ordinals && ordinalsLength) {
if (hasActivatedOrdinalsKey === undefined && ordinalsLength) {
setShowActivateOrdinalsAlert(true);
}
}, [hasActivatedOrdinalsKey, ordinalsLength]);
Expand Down
15 changes: 8 additions & 7 deletions src/app/screens/nftDashboard/receiveNft/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ import { useState } from 'react';
import { isLedgerAccount } from '@utils/helper';
import ReceiveCardComponent from '../../../components/receiveCardComponent';

interface Props {
visible: boolean;
onClose: () => void;
setOrdinalReceiveAlert: () => void;
isGalleryOpen: boolean;
}

const ColumnContainer = styled.div((props) => ({
display: 'flex',
flexDirection: 'column',
Expand Down Expand Up @@ -55,9 +48,17 @@ const VerifyOrViewContainer = styled.div((props) => ({
}));

const VerifyButtonContainer = styled.div((props) => ({
minWidth: 300,
marginBottom: props.theme.spacing(6),
}));

interface Props {
visible: boolean;
onClose: () => void;
setOrdinalReceiveAlert: () => void;
isGalleryOpen: boolean;
}

function ReceiveNftModal({ visible, onClose, isGalleryOpen, setOrdinalReceiveAlert }: Props) {
const { t } = useTranslation('translation', { keyPrefix: 'NFT_DASHBOARD_SCREEN' });
const navigate = useNavigate();
Expand Down
15 changes: 5 additions & 10 deletions src/app/screens/sendBrc20/brc20TransferInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ const InfoTitle = styled.h1((props) => ({
...props.theme.headline_m,
marginTop: props.theme.spacing(8),
}));

const InfoSubtitle = styled.h2((props) => ({
...props.theme.body_m,
color: props.theme.colors.white[200],
marginTop: props.theme.spacing(6),
}));

const TransferStepTitle = styled.h3((props) => ({
...props.theme.body_bold_m,
marginTop: props.theme.spacing(20),
}));

const TransferStep = styled.p((props) => ({
...props.theme.body_m,
color: props.theme.colors.white[200],
Expand All @@ -34,17 +37,9 @@ function Brc20TransferInfo() {
<Container>
<InfoTitle>{t('SEND_INFO_TITLE')}</InfoTitle>
<InfoSubtitle>{t('SEND_INFO_SUBTITLE')}</InfoSubtitle>
<TransferStepTitle>
1.
{' '}
{t('SEND_STEP_1_TITLE')}
</TransferStepTitle>
<TransferStepTitle>1. {t('SEND_STEP_1_TITLE')}</TransferStepTitle>
<TransferStep>{t('SEND_STEP_1')}</TransferStep>
<TransferStepTitle>
2.
{' '}
{t('SEND_STEP_2_TITLE')}
</TransferStepTitle>
<TransferStepTitle>2. {t('SEND_STEP_2_TITLE')}</TransferStepTitle>
<TransferStep>{t('SEND_STEP_2')}</TransferStep>
</Container>
);
Expand Down
20 changes: 8 additions & 12 deletions src/app/screens/sendBrc20/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import ActionButton from '@components/button';
import Brc20TransferForm from './brc20TransferForm';
import Brc20TransferInfo from './brc20TransferInfo';

const BRC20TokenTagContainer = styled.div({
const BRC20TokenTagContainer = styled.div((props) => ({
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
marginTop: 6,
});
marginTop: props.theme.spacing(3),
}));

const BRC20TokenTag = styled.div((props) => ({
background: props.theme.colors.white[400],
Expand Down Expand Up @@ -66,13 +66,15 @@ function SendBrc20Screen() {
const [amountToSend, setAmountToSend] = useState('');
const [isCreatingOrder, setIsCreatingOrder] = useState(false);
const [showForm, setShowForm] = useState(false);

const location = useLocation();

const coinName = location.search ? location.search.split('coinName=')[1] : undefined;
const fungibleToken =
location.state?.fungibleToken || brcCoinsList?.find((coin) => coin.name === coinName);

const isSendButtonEnabled = amountToSend !== '' && amountToSend <= fungibleToken.balance;
const isActionButtonEnabled = showForm ? isSendButtonEnabled : true;

const { subscribeToResetUserFlow } = useResetUserFlow();
useEffect(() => subscribeToResetUserFlow('/send-brc20'), []);

Expand All @@ -96,13 +98,6 @@ function SendBrc20Screen() {
}
};

const checkIfEnableButton = () => {
if (amountToSend !== '' || amountToSend <= fungibleToken.balance) {
return true;
}
return false;
};

const handleInscribeTransferOrder = async () => {
try {
const order = await createBrc20TransferOrder(
Expand Down Expand Up @@ -206,13 +201,14 @@ function SendBrc20Screen() {
) : (
<Brc20TransferInfo />
)}
<SendButtonContainer enabled={checkIfEnableButton()}>
<SendButtonContainer enabled={isActionButtonEnabled}>
<ActionButton
text={
showForm ? t('SEND_BRC_20.SEND_NEXT_BUTTON') : t('SEND_BRC_20.SEND_INFO_START_BUTTON')
}
processing={isCreatingOrder}
onPress={handleNext}
disabled={!isActionButtonEnabled}
/>
</SendButtonContainer>
<BottomBar tab="dashboard" />
Expand Down

0 comments on commit e31964b

Please sign in to comment.