Skip to content
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

txs: detail sheet updates #5535

Merged
merged 45 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
5c38c17
save
skylarbarrera Jan 30, 2024
dbe39a3
remove selectors and add types
skylarbarrera Jan 30, 2024
ae7a07e
single query, type refactor, pipe it up
skylarbarrera Jan 31, 2024
6ee0333
Merge branch 'develop' into @skylar/txs
skylarbarrera Feb 2, 2024
aef7ea0
Merge branch 'develop' into @skylar/txs
skylarbarrera Feb 2, 2024
b243106
pendingTx state & zustand
skylarbarrera Feb 4, 2024
cdff884
useWatchPendingTxs
skylarbarrera Feb 4, 2024
2090834
usePoll + usage
skylarbarrera Feb 4, 2024
73edda0
queries
skylarbarrera Feb 4, 2024
43ea9f2
use transactions
skylarbarrera Feb 4, 2024
1fb037e
messy types and structure
skylarbarrera Feb 4, 2024
f00741c
addNewTransactions
skylarbarrera Feb 4, 2024
0ead5a0
fix prettier
walmat Feb 5, 2024
820a461
Revert "fix prettier"
skylarbarrera Feb 6, 2024
538f3de
save
skylarbarrera Feb 6, 2024
30d5a0e
lint
skylarbarrera Feb 6, 2024
d3b85f7
Merge branch 'develop' into @skylar/txs
skylarbarrera Feb 6, 2024
89a6898
save
skylarbarrera Feb 7, 2024
e4a27f7
ui tweaks
skylarbarrera Feb 8, 2024
c2648ec
Merge branch 'develop' into @skylar/txs
skylarbarrera Feb 8, 2024
0bc2f3b
clean up state and add nonces
skylarbarrera Feb 8, 2024
734f9c6
ben ui review
skylarbarrera Feb 9, 2024
a96374c
Merge branch 'develop' into @skylar/txs
skylarbarrera Feb 9, 2024
4a6b4b7
pipe up once shit
skylarbarrera Feb 9, 2024
6842d51
clean
skylarbarrera Feb 9, 2024
518a9b0
clean
skylarbarrera Feb 9, 2024
b8c6cc0
rename and fix case
skylarbarrera Feb 11, 2024
144eed2
fix tag color and position
skylarbarrera Feb 11, 2024
0207b90
clean up
skylarbarrera Feb 12, 2024
6cfff41
clean up
skylarbarrera Feb 12, 2024
079e7f3
rm logs
skylarbarrera Feb 12, 2024
9edcfda
save
skylarbarrera Feb 12, 2024
909aa95
fix display
skylarbarrera Feb 12, 2024
21a6805
cleaning
skylarbarrera Feb 12, 2024
8944edb
use new tx parsing for notifs
skylarbarrera Feb 12, 2024
1b10258
Merge remote-tracking branch 'origin/develop' into @skylar/tx-details…
skylarbarrera Mar 19, 2024
3ada07f
oops
skylarbarrera Mar 19, 2024
ea212b6
oop
skylarbarrera Mar 19, 2024
5475c30
change label
skylarbarrera Mar 22, 2024
555082b
use masthead
skylarbarrera Mar 22, 2024
ca23ee3
fix NaN
skylarbarrera Mar 22, 2024
b9d0e82
clean up for v1
skylarbarrera Mar 25, 2024
b438351
i18n + logs
skylarbarrera Mar 25, 2024
7d171b5
Merge remote-tracking branch 'origin/develop' into @skylar/tx-details…
skylarbarrera Mar 25, 2024
b56233c
lint
skylarbarrera Mar 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ rainbow-scripts
.vscode
__generated__
coverage
InjectedJSBundle.js
InjectedJSBundle.js
1 change: 1 addition & 0 deletions src/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,7 @@
"to": "To",
"value": "Value",
"hash": "Tx Hash",
"you": "You",
"network_fee": "Network Fee",
"hash_copied": "\uDBC0\uDC63 Transaction hash copied",
"address_copied": "\uDBC0\uDC63 Address copied",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,74 +1,20 @@
import React, { useMemo } from 'react';
import { Box, Stack } from '@/design-system';
import * as i18n from '@/languages';
import { TransactionDetailsAddressRow } from '@/screens/transaction-details/components/TransactionDetailsAddressRow';
import { useContacts, useUserAccounts } from '@/hooks';
import { isLowerCaseMatch } from '@/utils';
import React from 'react';
import { Box } from '@/design-system';
import { TransactionDetailsDivider } from '@/screens/transaction-details/components/TransactionDetailsDivider';
import { RainbowTransaction } from '@/entities';
import TransactionMasthead from './TransactionMasthead';

type Props = {
transaction: RainbowTransaction;
presentToast?: () => void;
};

export const TransactionDetailsFromToSection: React.FC<Props> = ({ transaction, presentToast }) => {
const from = transaction.from ?? undefined;
const to = transaction.to ?? undefined;
const { contacts } = useContacts();
const fromContact = from ? contacts[from] : undefined;
const toContact = to ? contacts[to] : undefined;

const { userAccounts, watchedAccounts } = useUserAccounts();

const fromAccount = useMemo(() => {
if (!from) {
return undefined;
} else {
return (
userAccounts.find(account => isLowerCaseMatch(account.address, from)) ??
watchedAccounts.find(account => isLowerCaseMatch(account.address, from))
);
}
}, [from]);
const toAccount = useMemo(() => {
if (!to) {
return undefined;
} else {
return (
userAccounts.find(account => isLowerCaseMatch(account.address, to)) ??
watchedAccounts.find(account => isLowerCaseMatch(account.address, to))
);
}
}, [to]);

if (!from && !to) {
return null;
}
return (
<>
<TransactionDetailsDivider />
<Box paddingVertical="10px">
<Stack>
{from && (
<TransactionDetailsAddressRow
onAddressCopied={presentToast}
address={from}
title={i18n.t(i18n.l.transaction_details.from)}
contact={fromContact}
account={fromAccount}
/>
)}
{to && (
<TransactionDetailsAddressRow
onAddressCopied={presentToast}
address={to}
title={i18n.t(i18n.l.transaction_details.to)}
contact={toContact}
account={toAccount}
/>
)}
</Stack>
<TransactionMasthead transaction={transaction} />
</Box>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Props = {
};

export const TransactionDetailsStatusActionsAndTimestampSection: React.FC<Props> = ({ transaction, hideIcon }) => {
const { minedAt, status, from } = transaction;
const { minedAt, status, type, from } = transaction;
const dispatch = useDispatch();
const { navigate, goBack } = useNavigation();
const accountAddress = useSelector((state: AppState) => state.settings.accountAddress);
Expand Down Expand Up @@ -112,7 +112,7 @@ export const TransactionDetailsStatusActionsAndTimestampSection: React.FC<Props>
</Box>
<Box paddingBottom="24px">
<Stack alignHorizontal="center" space="16px">
{status && !hideIcon && (
{type && !hideIcon && (
<Box borderRadius={30} style={{ overflow: 'hidden' }}>
<RadialGradient
style={{
Expand All @@ -131,10 +131,12 @@ export const TransactionDetailsStatusActionsAndTimestampSection: React.FC<Props>
</RadialGradient>
</Box>
)}

<Stack alignHorizontal="center" space="24px">
{status && (
{type && (
<Text size="22pt" weight="heavy" color={color}>
{capitalize(status)}
{/* @ts-ignore */}
{i18n.t(i18n.l.transactions.type[transaction?.title])}
</Text>
)}
{date && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ export const TransactionDetailsValueAndFeeSection: React.FC<Props> = ({ transact
const change = transaction?.changes?.[0];

const value = change?.value || transaction.balance?.display;
const valueDisplay = convertRawAmountToBalance(value || '', assetData!).display || '';
const nativeCurrencyValue = convertAmountAndPriceToNativeDisplay(
change?.asset?.balance?.amount || '',
change?.asset?.price?.value || '',
nativeCurrency
).display;
const valueDisplay = value ? convertRawAmountToBalance(value || '', assetData!).display : '';
const nativeCurrencyValue = change?.asset?.price?.value
? convertAmountAndPriceToNativeDisplay(change?.asset?.balance?.amount || '', change?.asset?.price?.value || '', nativeCurrency).display
: '';
const feeValue = fee?.value.display ?? '';
const feeNativeCurrencyValue = fee?.native?.display ?? '';

Expand Down
Loading
Loading