14.05.2026 rip
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { GAS_PRICE, USDT_RATE } from '@shared/config/constants'
|
import { GAS_PRICE, USDT_RATE } from '@shared/config/constants'
|
||||||
import { useConverter } from '../model/useConverter'
|
import { useConverter } from '../model/useConverter'
|
||||||
|
import { findTier, progressPercent } from '../model/tiers'
|
||||||
import { AgreementCheckbox } from './AgreementCheckbox'
|
import { AgreementCheckbox } from './AgreementCheckbox'
|
||||||
import { CommissionTable } from './CommissionTable'
|
import { CommissionTable } from './CommissionTable'
|
||||||
import styles from './Converter.module.css'
|
import styles from './Converter.module.css'
|
||||||
@@ -8,6 +9,14 @@ import { Title } from '@shared/ui/Title/Title'
|
|||||||
export function Converter() {
|
export function Converter() {
|
||||||
const c = useConverter({ usdtRate: USDT_RATE })
|
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 (
|
return (
|
||||||
<section className={styles.section} id="converter">
|
<section className={styles.section} id="converter">
|
||||||
<div className={styles.wrap}>
|
<div className={styles.wrap}>
|
||||||
@@ -50,7 +59,13 @@ export function Converter() {
|
|||||||
|
|
||||||
<div className={styles.field}>
|
<div className={styles.field}>
|
||||||
<div className={styles.fieldInput}>
|
<div className={styles.fieldInput}>
|
||||||
<input type="text" value={c.usdtVal} readOnly placeholder="0" />
|
<input
|
||||||
|
type="text"
|
||||||
|
value={c.rubVal}
|
||||||
|
onChange={(e) => c.updateRub(e.target.value)}
|
||||||
|
placeholder="0"
|
||||||
|
inputMode="decimal"
|
||||||
|
/>
|
||||||
<div className={styles.currency}>
|
<div className={styles.currency}>
|
||||||
<span className={`${styles.currencyIcon} ${styles.currencyUsdt}`}>₮</span> USDT
|
<span className={`${styles.currencyIcon} ${styles.currencyUsdt}`}>₮</span> USDT
|
||||||
</div>
|
</div>
|
||||||
@@ -77,13 +92,7 @@ export function Converter() {
|
|||||||
|
|
||||||
<div className={styles.field}>
|
<div className={styles.field}>
|
||||||
<div className={styles.fieldInput}>
|
<div className={styles.fieldInput}>
|
||||||
<input
|
<input type="text" value={rubOutput} readOnly placeholder="0" />
|
||||||
type="text"
|
|
||||||
value={c.rubVal}
|
|
||||||
onChange={(e) => c.updateRub(e.target.value)}
|
|
||||||
placeholder="0"
|
|
||||||
inputMode="decimal"
|
|
||||||
/>
|
|
||||||
<div className={styles.currency}>
|
<div className={styles.currency}>
|
||||||
<span className={`${styles.currencyIcon} ${styles.currencyRub}`}>₽</span> RUB
|
<span className={`${styles.currencyIcon} ${styles.currencyRub}`}>₽</span> RUB
|
||||||
</div>
|
</div>
|
||||||
@@ -92,10 +101,10 @@ export function Converter() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<CommissionTable
|
<CommissionTable
|
||||||
amount={c.numRub}
|
amount={approxRub}
|
||||||
progress={c.progress}
|
progress={progressPercent(approxRub)}
|
||||||
commission={c.commission}
|
commission={commission}
|
||||||
effectiveRate={c.effectiveRate}
|
effectiveRate={effectiveRate}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user