Skip to content

Commit

Permalink
fix: confirmations is a number always
Browse files Browse the repository at this point in the history
  • Loading branch information
juanky201271 committed Oct 29, 2023
1 parent 079c199 commit 5bce4a4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/AppState/types/TransactionType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import TxDetailType from './TxDetailType';
export default interface TransactionType {
type: 'Sent' | 'Received' | 'SendToSelf'; // like kind
fee?: number;
confirmations: number | null;
confirmations: number;
txid: string;
time: number;
zec_price?: number;
Expand Down
2 changes: 1 addition & 1 deletion app/rpc/RPC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,7 +1395,7 @@ export default class RPC {
currentTxList[0].type = type;
}
if (tx.unconfirmed) {
currentTxList[0].confirmations = null;
currentTxList[0].confirmations = 0;
} else if (!currentTxList[0].confirmations) {
currentTxList[0].confirmations = this.lastServerBlockHeight
? this.lastServerBlockHeight - tx.block_height + 1
Expand Down
6 changes: 1 addition & 5 deletions components/History/components/TxDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ const TxDetail: React.FunctionComponent<TxDetailProps> = ({ tx, closeModal, set_
const { info, translate, language, privacy, addLastSnackbar, server, currency } = context;
const { colors } = useTheme() as unknown as ThemeType;
const spendColor =
tx.confirmations === null || tx.confirmations === 0
? colors.primaryDisabled
: tx.type === 'Received'
? colors.primary
: colors.text;
tx.confirmations === 0 ? colors.primaryDisabled : tx.type === 'Received' ? colors.primary : colors.text;
const [expandAddress, setExpandAddress] = useState(false);
const [expandTxid, setExpandTxid] = useState(false);
moment.locale(language);
Expand Down
9 changes: 2 additions & 7 deletions components/History/components/TxSummaryLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,9 @@ const TxSummaryLine: React.FunctionComponent<TxSummaryLineProps> = ({
const { colors } = useTheme() as unknown as ThemeType;

const amountColor =
tx.confirmations === null || tx.confirmations === 0
? colors.primaryDisabled
: tx.type === 'Received'
? colors.primary
: colors.text;
tx.confirmations === 0 ? colors.primaryDisabled : tx.type === 'Received' ? colors.primary : colors.text;

const txIcon =
tx.confirmations === null || tx.confirmations === 0 ? faRefresh : tx.type === 'Received' ? faArrowDown : faArrowUp;
const txIcon = tx.confirmations === 0 ? faRefresh : tx.type === 'Received' ? faArrowDown : faArrowUp;
moment.locale(language);

// if no address I'm going to put txid here.
Expand Down
10 changes: 5 additions & 5 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5bce4a4

Please sign in to comment.