-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Operations parameters fiat amount (#1098)
* Feat: Price provider model (#1084) * Feat: Currency settings (#1076) * Feat: fiat balance assets and staking (#1087) * Feat: amount input currency (#1083) * feat: currency select modal * chore: added icon for currency * feat: added currency mode to amount input * feat: price provider model * feat: load assets prices * chore: code style, export events * feat: integrated currency modal to currenc settings * chore: updated crouped select semantics * chore: fixed General Action test * chore: fixed grouped select active state * feat: tests for models, review fixes * chore: fixed pr comments * chore: added currency form model * fix: fixed modal reload after submit * feat: [wip] amount input currency integration * chore: removed button disabled condition * feat: amount input with currency integration * fix: tests * feat: form model, test * chore: removed GroupedSelect * fix: ui fix: correct input for priceless asset * fix: revert commented code --------- Co-authored-by: Egor B <[email protected]> Co-authored-by: Yaroslav Grachev <[email protected]> Co-authored-by: asmadek <[email protected]> * feat: added fiat amount for transfer and multisig operations * feat: added fiat values to staking operations --------- Co-authored-by: Yaroslav Grachev <[email protected]> Co-authored-by: Aleksandr Makhnev <[email protected]> Co-authored-by: Egor B <[email protected]>
- Loading branch information
1 parent
074a53b
commit 9d88856
Showing
9 changed files
with
87 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 16 additions & 17 deletions
33
src/renderer/pages/Operations/components/TransactionAmount.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,29 @@ | ||
import { useEffect, useState, ComponentProps } from 'react'; | ||
|
||
import { DecodedTransaction, Transaction } from '@renderer/entities/transaction'; | ||
import { chainsService } from '@renderer/entities/network'; | ||
import { Asset, AssetBalance } from '@renderer/entities/asset'; | ||
import { getAssetById } from '@renderer/shared/lib/utils'; | ||
import { AssetBalance } from '@renderer/entities/asset'; | ||
import { cnTw, getAssetById } from '@renderer/shared/lib/utils'; | ||
import { getTransactionAmount } from '../common/utils'; | ||
import { AssetFiatBalance } from '@renderer/entities/price/ui/AssetFiatBalance'; | ||
|
||
type Props = { | ||
tx: Transaction | DecodedTransaction; | ||
className?: string; | ||
}; | ||
|
||
type BalanceProps = Pick<ComponentProps<typeof AssetBalance>, 'className' | 'showIcon' | 'wrapperClassName'>; | ||
|
||
export const TransactionAmount = ({ tx, ...balanceProps }: Props & BalanceProps) => { | ||
const [assets, setAssets] = useState<Asset[]>([]); | ||
|
||
useEffect(() => { | ||
const chain = chainsService.getChainById(tx.chainId); | ||
|
||
setAssets(chain?.assets || []); | ||
}, []); | ||
|
||
const asset = getAssetById(tx.args.asset, assets); | ||
export const TransactionAmount = ({ tx, className }: Props) => { | ||
const asset = tx && getAssetById(tx.args.asset, chainsService.getChainById(tx.chainId)?.assets); | ||
const value = getTransactionAmount(tx); | ||
|
||
if (!asset || !value) return null; | ||
|
||
return <AssetBalance value={value} asset={asset} showIcon {...balanceProps} />; | ||
return ( | ||
<div className={cnTw('flex flex-col gap-y-1 items-center')}> | ||
<AssetBalance | ||
value={value} | ||
asset={asset} | ||
className={cnTw('font-manrope text-text-primary text-[32px] leading-[36px] font-bold', className)} | ||
/> | ||
<AssetFiatBalance asset={asset} amount={value} className="text-headline" /> | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters