Skip to content

Commit

Permalink
Merge branch 'frontend-fix-estimate-symbol'
Browse files Browse the repository at this point in the history
  • Loading branch information
thisconnect committed Nov 7, 2024
2 parents 183ebed + f4626d3 commit 6077981
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
10 changes: 1 addition & 9 deletions frontends/web/src/components/amount/amount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type TProps = {
removeBtcTrailingZeroes?: boolean;
alwaysShowAmounts?: boolean
allowRotateCurrencyOnMobile?: boolean;
estimated?: boolean;
};

const formatSats = (amount: string): JSX.Element => {
Expand Down Expand Up @@ -99,7 +98,6 @@ export const Amount = ({
removeBtcTrailingZeroes,
alwaysShowAmounts = false,
allowRotateCurrencyOnMobile = false,
estimated = false
}: TProps) => {
const { rotateDefaultCurrency } = useContext(RatesContext);
const isMobile = useMediaQuery('(max-width: 768px)');
Expand All @@ -118,7 +116,6 @@ export const Amount = ({
unit={unit}
removeBtcTrailingZeroes={removeBtcTrailingZeroes}
alwaysShowAmounts={alwaysShowAmounts}
estimated={estimated}
/>
</span>
);
Expand All @@ -129,7 +126,6 @@ export const FormattedAmount = ({
unit,
removeBtcTrailingZeroes,
alwaysShowAmounts = false,
estimated = false,
}: TProps) => {
const { hideAmounts } = useContext(AppContext);
const { decimal, group } = useContext(LocalizationContext);
Expand Down Expand Up @@ -161,9 +157,5 @@ export const FormattedAmount = ({
return formatSats(amount);
}

let prefix = '';
if (estimated) {
prefix = '\u2248'; //≈
}
return prefix + formatLocalizedAmount(amount, group, decimal);
return formatLocalizedAmount(amount, group, decimal);
};
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
color: var(--color-green);
}

.txPrefix,
.txUnit {
color: var(--color-secondary);
font-size: 14px;
Expand Down
19 changes: 16 additions & 3 deletions frontends/web/src/components/transactions/transaction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,34 @@ const Amounts = ({
const conversion = amount?.conversions && amount?.conversions[defaultCurrency];
const sign = getTxSign(type);
const txTypeClass = `txAmount-${type}`;
const conversionPrefix = amount.estimated ? '\u2248' : null; // ≈
return (
<span className={`${styles.txAmountsColumn} ${styles[txTypeClass]}`}>
{/* <data value={amount.amount}> */}
<span className={styles.txAmount}>
{sign}
<Amount amount={amount.amount} unit={amount.unit} />
<Amount
amount={amount.amount}
unit={amount.unit}
/>
<span className={styles.txUnit}>
{' '}
{amount.unit}
</span>
</span>
{/* </data> */}
<span className={styles.txConversionAmount}>
{sign}
<Amount amount={conversion || ''} unit={defaultCurrency} estimated={amount.estimated}/>
{conversionPrefix && (
<span className={styles.txPrefix}>
{conversionPrefix}
{' '}
</span>
)}
{conversion && sign}
<Amount
amount={conversion || ''}
unit={defaultCurrency}
/>
<span className={styles.txUnit}>
{' '}
{defaultCurrency}
Expand Down

0 comments on commit 6077981

Please sign in to comment.