-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #562 from Concordium/ui-update/validation-status
UI update/validation status
- Loading branch information
Showing
25 changed files
with
206 additions
and
72 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
1 change: 0 additions & 1 deletion
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Baker/BakerKeys/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Baker/Intro/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Baker/OpenPool/index.ts
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Baker/Register/index.ts
This file was deleted.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
...arningRewards/Baker/Intro/BakerIntro.scss → ...wards/Validator/Intro/ValidatorIntro.scss
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,4 +1,4 @@ | ||
.baker-intro-container { | ||
.validator-intro-container { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
|
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
1 change: 1 addition & 0 deletions
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/Intro/index.ts
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ValidatorIntro'; |
4 changes: 2 additions & 2 deletions
4
...ingRewards/Baker/BakerKeys/BakerKeys.scss → ...Rewards/Validator/Keys/ValidatorKeys.scss
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
26 changes: 13 additions & 13 deletions
26
...ningRewards/Baker/BakerKeys/BakerKeys.tsx → ...gRewards/Validator/Keys/ValidatorKeys.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
1 change: 1 addition & 0 deletions
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/Keys/index.ts
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ValidatorKeys'; |
File renamed without changes.
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
1 change: 1 addition & 0 deletions
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/OpenPool/index.ts
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './OpenPool'; |
4 changes: 2 additions & 2 deletions
4
...Rewards/Baker/Register/RegisterBaker.scss → ...Validator/Register/RegisterValidator.scss
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
1 change: 1 addition & 0 deletions
1
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/Register/index.ts
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './RegisterValidator'; |
74 changes: 74 additions & 0 deletions
74
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/Status.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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import { AccountInfoType } from '@concordium/web-sdk'; | ||
import { absoluteRoutes } from '@popup/popupX/constants/routes'; | ||
import Button from '@popup/popupX/shared/Button'; | ||
import Card from '@popup/popupX/shared/Card'; | ||
import Page from '@popup/popupX/shared/Page'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useSelectedAccountInfo } from '@popup/shared/AccountInfoListenerContext/AccountInfoListenerContext'; | ||
import { Navigate, useNavigate } from 'react-router-dom'; | ||
import AccountCooldowns from '../AccountCooldowns'; | ||
import { showRestake, showValidatorAmount, showValidatorOpenStatus } from './util'; | ||
|
||
export default function ValidatorStatus() { | ||
const { t } = useTranslation('x', { keyPrefix: 'earn.validator' }); | ||
const accountInfo = useSelectedAccountInfo(); | ||
const nav = useNavigate(); | ||
|
||
if (accountInfo?.type !== AccountInfoType.Baker) { | ||
return <Navigate to=".." />; | ||
} | ||
|
||
const { accountBaker, accountCooldowns } = accountInfo; | ||
|
||
if (accountBaker.version === 0) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Page> | ||
<Page.Top heading={t('status.title')} /> | ||
<Card> | ||
<Card.Row> | ||
<Card.RowDetails | ||
title={t('values.amount.label')} | ||
value={showValidatorAmount(accountBaker.stakedAmount)} | ||
/> | ||
</Card.Row> | ||
<Card.Row> | ||
<Card.RowDetails title={t('values.id.label')} value={accountBaker.bakerId.toString()} /> | ||
</Card.Row> | ||
<Card.Row> | ||
<Card.RowDetails | ||
title={t('values.restake.label')} | ||
value={showRestake(accountBaker.restakeEarnings)} | ||
/> | ||
</Card.Row> | ||
<Card.Row> | ||
<Card.RowDetails | ||
title={t('values.openStatus.label')} | ||
value={showValidatorOpenStatus(accountBaker.bakerPoolInfo.openStatus)} | ||
/> | ||
</Card.Row> | ||
<Card.Row> | ||
<Card.RowDetails | ||
title={t('values.metadataUrl.label')} | ||
value={accountBaker.bakerPoolInfo.metadataUrl} | ||
/> | ||
</Card.Row> | ||
</Card> | ||
<AccountCooldowns cooldowns={accountCooldowns} /> | ||
<Page.Footer> | ||
<Button.Main | ||
className="m-t-10" | ||
label={t('status.buttonUpdate')} | ||
onClick={() => nav(absoluteRoutes.settings.earn.delegator.update.path)} | ||
/> | ||
<Button.Main | ||
label={t('status.buttonStop')} | ||
// onClick={() => nav(absoluteRoutes.settings.earn.delegator.stop.path)} | ||
/> | ||
</Page.Footer> | ||
</Page> | ||
); | ||
} |
26 changes: 26 additions & 0 deletions
26
packages/browser-wallet/src/popup/popupX/pages/EarningRewards/Validator/util.ts
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { CcdAmount, OpenStatusText } from '@concordium/web-sdk'; | ||
import { formatCcdAmount } from '@popup/popupX/shared/utils/helpers'; | ||
import i18n from '@popup/shell/i18n'; | ||
|
||
export function showValidatorAmount(amount: CcdAmount.Type): string { | ||
return `${formatCcdAmount(amount)} CCD`; | ||
} | ||
|
||
export function showValidatorOpenStatus(status: OpenStatusText): string { | ||
switch (status) { | ||
case OpenStatusText.OpenForAll: | ||
return i18n.t('x:earn.validator.values.openStatus.open'); | ||
case OpenStatusText.ClosedForAll: | ||
return i18n.t('x:earn.validator.values.openStatus.closed'); | ||
case OpenStatusText.ClosedForNew: | ||
return i18n.t('x:earn.validator.values.openStatus.closedNew'); | ||
default: | ||
throw new Error('Unsupported status'); | ||
} | ||
} | ||
|
||
export function showRestake(value: boolean): string { | ||
return value | ||
? i18n.t('x:earn.validator.values.restake.validation') | ||
: i18n.t('x:earn.validator.values.restake.public'); | ||
} |
Oops, something went wrong.