Skip to content

Commit

Permalink
Display default exchange rate button
Browse files Browse the repository at this point in the history
  • Loading branch information
Onitoxan committed Nov 19, 2024
1 parent 85122ad commit c450678
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions apps/hpc-ftsadmin/src/app/components/flow-form/flow-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,7 @@ const FlowAmountButton = ({
const amountOriginalCurrencyInt = currencyToInteger(amountOriginalCurrency);
const exchangeRateFloat = parseFloat(exchangeRate);

if (amountUSDInt && amountOriginalCurrencyInt && !exchangeRateFloat) {
const buttonProps = {
onClick: () =>
setFieldValue('exchangeRate', amountOriginalCurrencyInt / amountUSDInt),
text: t.t(lang, (s) => s.components.flowAmountButton.exchangeRate),
};
return <C.Button color="primary" {...buttonProps} className="text-end" />;
} else if (amountUSDInt && !amountOriginalCurrencyInt && exchangeRateFloat) {
if (amountUSDInt && !amountOriginalCurrencyInt && exchangeRateFloat) {
const buttonProps = {
onClick: () =>
setFieldValue(
Expand All @@ -381,7 +374,12 @@ const FlowAmountButton = ({
};
return <C.Button color="primary" {...buttonProps} className="text-end" />;
}
return;
const buttonProps = {
onClick: () =>
setFieldValue('exchangeRate', amountOriginalCurrencyInt / amountUSDInt),
text: t.t(lang, (s) => s.components.flowAmountButton.exchangeRate),
};
return <C.Button color="primary" {...buttonProps} className="text-end" />;
};

export const FlowForm = (props: FlowFormProps) => {
Expand Down

0 comments on commit c450678

Please sign in to comment.