Skip to content

Commit a9bd90b

Browse files
authored
Merge pull request #570 from Concordium/ui-update/fix-stop-validation
UI update/fix stop validation
2 parents 2d819f1 + bec3b33 commit a9bd90b

File tree

5 files changed

+38
-3
lines changed

5 files changed

+38
-3
lines changed

packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Delegator/Status.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default function DelegatorStatus() {
2222
const nav = useNavigate();
2323

2424
if (accountInfo?.type !== AccountInfoType.Delegator) {
25-
return <Navigate to=".." />;
25+
return <Navigate to={absoluteRoutes.settings.earn.path} />;
2626
}
2727

2828
const { accountDelegation, accountCooldowns } = accountInfo;

packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/Status/Status.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function ValidatorStatus() {
2626
const chainParams = useBlockChainParametersAboveV0();
2727

2828
if (accountInfo?.type !== AccountInfoType.Baker) {
29-
return <Navigate to=".." />;
29+
return <Navigate to={absoluteRoutes.settings.earn.path} />;
3030
}
3131

3232
const { accountBaker, accountCooldowns } = accountInfo;

packages/browser-wallet/src/popup/popupX/pages/EarningRewards/i18n/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const t = {
22
root: {
33
validatorTitle: 'Validation',
44
validatorDescription:
5-
'As a validator, you can participate in the network by baking blocks on the Concordium network. This requires a minimum of {{amount}} CCD and access to a dedicated node.',
5+
'As a validator, you can participate in the network by validating blocks on the Concordium network. This requires a minimum of {{amount}} CCD and access to a dedicated node.',
66
validatorAction: 'Continue to validation setup',
77
delegationTitle: 'Delegation',
88
delegationDescription:

packages/browser-wallet/src/popup/popupX/pages/SubmittedTransaction/SubmittedTransaction.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import {
2323
DelegationStakeChangedEvent,
2424
DelegatorEvent,
2525
ConfigureDelegationSummary,
26+
ConfigureBakerSummary,
27+
BakerStakeChangedEvent,
28+
BakerEvent,
2629
} from '@concordium/web-sdk';
2730
import { useAtomValue } from 'jotai';
2831
import { grpcClientAtom } from '@popup/store/settings';
@@ -62,6 +65,32 @@ function DelegationBody({ events }: DelegationBodyProps) {
6265
return <Text.Capture>{t('updated')}</Text.Capture>;
6366
}
6467

68+
type ValidatorBodyProps = BaseAccountTransactionSummary & ConfigureBakerSummary;
69+
70+
function ValidatorBody({ events }: ValidatorBodyProps) {
71+
const { t } = useTranslation('x', { keyPrefix: 'submittedTransaction.success.configureValidator' });
72+
73+
const stakeChange = events.find((e) =>
74+
[TransactionEventTag.BakerStakeIncreased, TransactionEventTag.BakerStakeDecreased].includes(e.tag)
75+
) as BakerStakeChangedEvent | undefined;
76+
if (stakeChange !== undefined) {
77+
return (
78+
<>
79+
<Text.Capture>{t('changeStake')}</Text.Capture>
80+
<Text.HeadingLarge>{formatCcdAmount(stakeChange.newStake)}</Text.HeadingLarge>
81+
<Text.Capture>CCD</Text.Capture>
82+
</>
83+
);
84+
}
85+
86+
const removal = events.find((e) => [TransactionEventTag.BakerRemoved].includes(e.tag)) as BakerEvent | undefined;
87+
if (removal !== undefined) {
88+
return <Text.Capture>{t('removed')}</Text.Capture>;
89+
}
90+
91+
return <Text.Capture>{t('updated')}</Text.Capture>;
92+
}
93+
6594
type SuccessSummary = Exclude<AccountTransactionSummary, FailedTransactionSummary>;
6695
type FailureSummary = BaseAccountTransactionSummary & FailedTransactionSummary;
6796

@@ -87,6 +116,7 @@ function Success({ tx }: SuccessProps) {
87116
</>
88117
)}
89118
{tx.transactionType === TransactionKindString.ConfigureDelegation && <DelegationBody {...tx} />}
119+
{tx.transactionType === TransactionKindString.ConfigureBaker && <ValidatorBody {...tx} />}
90120
</>
91121
);
92122
}

packages/browser-wallet/src/popup/popupX/pages/SubmittedTransaction/i18n/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ const t = {
55
removed: "You've removed your delegated stake",
66
updated: "You've updated your delegation settings",
77
},
8+
configureValidator: {
9+
changeStake: "You've validating with",
10+
removed: "You've stopped validating",
11+
updated: "You've updated your delegation settings",
12+
},
813
transfer: {
914
label: "You've sent",
1015
},

0 commit comments

Comments
 (0)