diff --git a/src/widgets/currency-converter/ui/Converter.tsx b/src/widgets/currency-converter/ui/Converter.tsx index 5e2d03a..38804e5 100644 --- a/src/widgets/currency-converter/ui/Converter.tsx +++ b/src/widgets/currency-converter/ui/Converter.tsx @@ -1,5 +1,6 @@ import { GAS_PRICE, USDT_RATE } from '@shared/config/constants' import { useConverter } from '../model/useConverter' +import { findTier, progressPercent } from '../model/tiers' import { AgreementCheckbox } from './AgreementCheckbox' import { CommissionTable } from './CommissionTable' import styles from './Converter.module.css' @@ -8,6 +9,14 @@ import { Title } from '@shared/ui/Title/Title' export function Converter() { const c = useConverter({ usdtRate: USDT_RATE }) + // c.rubVal / c.numRub used as USDT input; RUB is computed + const numUsdt = c.numRub + const approxRub = numUsdt * USDT_RATE + const { pct } = findTier(approxRub) + const effectiveRate = USDT_RATE * (1 + pct / 100) + const rubOutput = numUsdt > 0 ? (numUsdt * effectiveRate).toFixed(2) : '' + const commission = (approxRub * pct) / 100 + return (
@@ -50,7 +59,13 @@ export function Converter() {
- + c.updateRub(e.target.value)} + placeholder="0" + inputMode="decimal" + />
USDT
@@ -77,13 +92,7 @@ export function Converter() {
- c.updateRub(e.target.value)} - placeholder="0" - inputMode="decimal" - /> +
RUB
@@ -92,10 +101,10 @@ export function Converter() {