Skip to content

Commit

Permalink
fix: collectibles UI bugs (#632)
Browse files Browse the repository at this point in the history
* fix: only show rare sat bundle info on confirm screen when it is a rare sat

* fix: fix infinite loop when no stx address

* fix: remove unnecessary refetches
  • Loading branch information
teebszet authored Oct 30, 2023
1 parent a57930b commit 416ba66
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
13 changes: 7 additions & 6 deletions src/app/components/confirmBtcTransactionComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import {
getBtcFiatEquivalent,
ResponseError,
satsToBtc,
signBtcTransaction,
UTXO,
} from '@secretkeylabs/xverse-core';
import { signBtcTransaction } from '@secretkeylabs/xverse-core/transactions';
import {
Recipient,
SignedBtcTx,
Expand Down Expand Up @@ -82,7 +82,7 @@ const Button = styled.button((props) => ({
}));

const ButtonText = styled.div((props) => ({
...props.theme.body_medium_m,
...props.theme.typography.body_medium_m,
color: props.theme.colors.white_0,
textAlign: 'center',
}));
Expand All @@ -100,15 +100,15 @@ const ErrorContainer = styled.div((props) => ({
}));

const ErrorText = styled.h1((props) => ({
...props.theme.body_xs,
color: props.theme.colors.feedback.error,
...props.theme.typography.body_s,
color: props.theme.colors.danger_medium,
}));

interface ReviewTransactionTitleProps {
isOridnalTx: boolean;
}
const ReviewTransactionText = styled.h1<ReviewTransactionTitleProps>((props) => ({
...props.theme.headline_s,
...props.theme.typography.headline_s,
color: props.theme.colors.white_0,
marginBottom: props.theme.spacing(16),
textAlign: props.isOridnalTx ? 'center' : 'left',
Expand Down Expand Up @@ -318,7 +318,7 @@ function ConfirmBtcTransactionComponent({
const newFee = new BigNumber(modifiedFee);
setCurrentFee(newFee);
const seed = await getSeed();
setCurrentFeeRate(new BigNumber(feeRate));
setCurrentFeeRate(new BigNumber(feeRate ?? ''));
if (ordinalTxUtxo) ordinalMutate({ txFee: modifiedFee, seedPhrase: seed });
else if (isRestoreFundFlow) {
mutateSignNonOrdinalBtcTransaction({ txFee: modifiedFee, seedPhrase: seed });
Expand Down Expand Up @@ -414,6 +414,7 @@ function ConfirmBtcTransactionComponent({
) : (
recipients?.map((recipient, index) => (
<RecipientComponent
key={recipient.address}
recipientIndex={index + 1}
address={recipient.address}
value={satsToBtc(recipient.amountSats).toString()}
Expand Down
4 changes: 2 additions & 2 deletions src/app/screens/confirmOrdinalTransaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function ConfirmOrdinalTransaction() {
const [currentFee, setCurrentFee] = useState(fee);
const [currentFeeRate, setCurrentFeeRate] = useState(feePerVByte);

const bundleId = selectedSatBundle ? getBundleId(selectedSatBundle) : '';
const bundleSubText = selectedSatBundle ? getBundleSubText(selectedSatBundle) : '';
const bundleId = isRareSat && selectedSatBundle ? getBundleId(selectedSatBundle) : '';
const bundleSubText = isRareSat && selectedSatBundle ? getBundleSubText(selectedSatBundle) : '';

const {
isLoading,
Expand Down
10 changes: 0 additions & 10 deletions src/app/screens/nftDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,6 @@ const useNftDashboard = (): NftDashboardState => {
const { t } = useTranslation('translation', { keyPrefix: 'NFT_DASHBOARD_SCREEN' });
const dispatch = useDispatch();
const {
stxAddress,
ordinalsAddress,
hasActivatedOrdinalsKey,
hasActivatedRareSatsKey,
rareSatsNoticeDismissed,
Expand All @@ -168,14 +166,6 @@ const useNftDashboard = (): NftDashboardState => {
const inscriptionsQuery = useAddressInscriptionCollections();
const rareSatsQuery = useAddressRareSats();

useEffect(() => {
stacksNftsQuery.refetch();
}, [stxAddress, stacksNftsQuery]);

useEffect(() => {
inscriptionsQuery.refetch();
}, [ordinalsAddress, inscriptionsQuery]);

const ordinalsLength = inscriptionsQuery.data?.pages?.[0]?.total ?? 0;
const totalNfts = stacksNftsQuery.data?.pages?.[0]?.total ?? 0;

Expand Down
2 changes: 1 addition & 1 deletion src/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ const Theme = {
},

/**
* @deprecated use theme.typography
* @deprecated use theme.typography.body_s
*/
body_xs: {
fontFamily: 'DMSans-Regular',
Expand Down

0 comments on commit 416ba66

Please sign in to comment.