diff --git a/src/app/components/CustomIcons/Delegate.tsx b/src/app/components/CustomIcons/Delegate.tsx index f625b99606..3645ca379a 100644 --- a/src/app/components/CustomIcons/Delegate.tsx +++ b/src/app/components/CustomIcons/Delegate.tsx @@ -4,18 +4,20 @@ import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon' export const DelegateIcon: FC = props => { return ( - - - - - - - - - + + + + + + + + + + + ) } diff --git a/src/app/components/CustomIcons/Undelegate.tsx b/src/app/components/CustomIcons/Undelegate.tsx deleted file mode 100644 index 027f80f2f1..0000000000 --- a/src/app/components/CustomIcons/Undelegate.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { FC } from 'react' -import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon' - -export const UndelegateIcon: FC = props => { - return ( - - - - - - - - - - - - - - - - - ) -} diff --git a/src/app/components/CustomIcons/UndelegateFinish.tsx b/src/app/components/CustomIcons/UndelegateFinish.tsx new file mode 100644 index 0000000000..2d0826309e --- /dev/null +++ b/src/app/components/CustomIcons/UndelegateFinish.tsx @@ -0,0 +1,24 @@ +import { FC } from 'react' +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon' + +export const UndelegateFinishIcon: FC = props => { + return ( + + + + + + + + + + + + + + ) +} diff --git a/src/app/components/CustomIcons/UndelegateStart.tsx b/src/app/components/CustomIcons/UndelegateStart.tsx new file mode 100644 index 0000000000..9957bb5ade --- /dev/null +++ b/src/app/components/CustomIcons/UndelegateStart.tsx @@ -0,0 +1,27 @@ +import { FC } from 'react' +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon' + +export const UndelegateStartIcon: FC = props => { + return ( + + + + + + + + + + + + + + + ) +} diff --git a/src/app/components/RuntimeEvents/RuntimeEventDetails.tsx b/src/app/components/RuntimeEvents/RuntimeEventDetails.tsx index a283dc0c61..f5d5549eb1 100644 --- a/src/app/components/RuntimeEvents/RuntimeEventDetails.tsx +++ b/src/app/components/RuntimeEvents/RuntimeEventDetails.tsx @@ -25,7 +25,9 @@ import { COLORS } from '../../../styles/theme/colors' import StreamIcon from '@mui/icons-material/Stream' import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment' import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat' -import { UnknownIcon } from '../CustomIcons/Unknown' +import { UndelegateStartIcon } from '../CustomIcons/UndelegateStart' +import { UndelegateFinishIcon } from '../CustomIcons/UndelegateFinish' +import { DelegateIcon } from '../CustomIcons/Delegate' export const EventTypeIcon: FC<{ eventType: RuntimeEventType @@ -37,9 +39,9 @@ export const EventTypeIcon: FC<{ [RuntimeEventType.coregas_used]: <>, [RuntimeEventType.consensus_accountswithdraw]: , [RuntimeEventType.consensus_accountsdeposit]: , - [RuntimeEventType.consensus_accountsdelegate]: , // TODO: use correct icon - [RuntimeEventType.consensus_accountsundelegate_start]: , // TODO: use correct icon - [RuntimeEventType.consensus_accountsundelegate_done]: , // TODO: use correct icon + [RuntimeEventType.consensus_accountsdelegate]: , + [RuntimeEventType.consensus_accountsundelegate_start]: , + [RuntimeEventType.consensus_accountsundelegate_done]: , [RuntimeEventType.accountsmint]: , [RuntimeEventType.accountsburn]: ( @@ -147,6 +149,7 @@ export const RuntimeEventDetails: FC<{ [RuntimeEventType.accountsmint]: t('runtimeEvent.accountsmint'), [RuntimeEventType.accountsburn]: t('runtimeEvent.accountsburn'), } + const eventName = eventTypeNames[event.type] switch (event.type) { case RuntimeEventType.coregas_used: @@ -237,9 +240,6 @@ export const RuntimeEventDetails: FC<{ case RuntimeEventType.accountstransfer: case RuntimeEventType.consensus_accountsdeposit: case RuntimeEventType.consensus_accountswithdraw: - case RuntimeEventType.consensus_accountsdelegate: // TODO show this properly - case RuntimeEventType.consensus_accountsundelegate_start: // TODO show this properly - case RuntimeEventType.consensus_accountsundelegate_done: // TODO show this properly return (
@@ -264,8 +264,43 @@ export const RuntimeEventDetails: FC<{ /> {addressSwitchOption === AddressSwitchOption.Oasis && } - {/* TODO check is needed because some consensus events temporarily use this for rendering */} - {event.body.amount?.Amount && event.body.amount?.Denomination && ( +
{t('runtimeEvent.fields.amount')}
+
+ {t('common.valueInToken', { + ...getPreciseNumberFormat(event.body.amount.Amount), + ticker: event.body.amount?.Denomination, + })} +
+ +
+ ) + case RuntimeEventType.consensus_accountsdelegate: + return ( +
+ + +
{t('common.from')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && ( + + )} +
+
{t('common.to')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && } +
+ + {event.body.amount?.Amount && event.body.amount.Denomination && ( <>
{t('runtimeEvent.fields.amount')}
@@ -279,6 +314,81 @@ export const RuntimeEventDetails: FC<{
) + case RuntimeEventType.consensus_accountsundelegate_start: + return ( +
+ + +
{t('common.from')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && ( + + )} +
+
{t('common.to')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && } +
+
{t('runtimeEvent.fields.activeShares')}
+
+ {t('common.valueLong', { + ...getPreciseNumberFormat(event.body.shares), + })} +
+
+
+ ) + case RuntimeEventType.consensus_accountsundelegate_done: + return ( +
+ + +
{t('common.from')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && ( + + )} +
+
{t('common.to')}
+
+ + {addressSwitchOption === AddressSwitchOption.Oasis && } +
+
{t('runtimeEvent.fields.amount')}
+
+ {t('common.valueInToken', { + ...getPreciseNumberFormat(event.body.amount.Amount), + ticker: event.body.amount.Denomination, + })} +
+
{t('runtimeEvent.fields.debondingShares')}
+
+ {t('common.valueLong', { + ...getPreciseNumberFormat(event.body.shares), + })} +
+
+
+ ) default: exhaustedTypeWarning('Unexpected event type', event.type) return ( diff --git a/src/app/components/RuntimeTransactionLabel/index.tsx b/src/app/components/RuntimeTransactionLabel/index.tsx index 44b8b7f465..a53a664606 100644 --- a/src/app/components/RuntimeTransactionLabel/index.tsx +++ b/src/app/components/RuntimeTransactionLabel/index.tsx @@ -10,7 +10,7 @@ import { DepositIcon } from './../CustomIcons/Deposit' import { WithdrawIcon } from './../CustomIcons/Withdraw' import { TransferIcon } from './../CustomIcons/Transfer' import { DelegateIcon } from '../CustomIcons/Delegate' -import { UndelegateIcon } from '../CustomIcons/Undelegate' +import { UndelegateStartIcon } from '../CustomIcons/UndelegateStart' const getRuntimeTransactionLabel = (t: TFunction, method: string | undefined) => { switch (method) { @@ -53,7 +53,7 @@ const getRuntimeTransactionIcon = (method: string | undefined) => { case 'consensus.Delegate': return case 'consensus.Undelegate': - return + return case 'accounts.Transfer': return default: diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index b52eafed0c..f5cdce94b9 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -323,7 +323,9 @@ "gasUsed": "Gas used", "fields": { "amount": "Amount", - "owner": "Owner" + "owner": "Owner", + "activeShares": "Active Shares", + "debondingShares": "Debonding Shares" } }, "transactionStats": {