Skip to content
This repository has been archived by the owner on Jul 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #53 from paritytech/w3f-deploy-1.0.9.1
Browse files Browse the repository at this point in the history
v1.0.9.1
  • Loading branch information
miabarbir authored Sep 14, 2023
2 parents 919ef80 + a20e66d commit ff27b60
Show file tree
Hide file tree
Showing 12 changed files with 905 additions and 913 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@ledgerhq/hw-transport-webhid": "^6.27.19",
"@polkadot-cloud/community": "0.1.11",
"@polkadot-cloud/core": "^0.1.20",
"@polkadot-cloud/react": "^0.1.39",
"@polkadot-cloud/core": "^0.1.27",
"@polkadot-cloud/react": "^0.1.44",
"@polkadot-cloud/utils": "^0.0.11",
"@polkadot/api": "^10.9.1",
"@polkadot/keyring": "^12.1.1",
Expand Down
29 changes: 13 additions & 16 deletions src/contexts/Payouts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,13 @@ export const PayoutsProvider = ({
.dividedBy(total)
.plus(isValidator ? valCut : 0);

unclaimed[era] = {
...unclaimed[era],
[validator]: unclaimedPayout.toString(),
};
j++;
if (!unclaimedPayout.isZero()) {
unclaimed[era] = {
...unclaimed[era],
[validator]: unclaimedPayout.toString(),
};
j++;
}
}

// This is not currently useful for preventing re-syncing. Need to know the eras that have
Expand Down Expand Up @@ -305,8 +307,9 @@ export const PayoutsProvider = ({
// Fetch payouts if active account is nominating.
useEffect(() => {
if (!activeEra.index.isZero()) {
if (
isNominating() &&
if (!isNominating()) {
setStateWithRef('synced', setPayoutsSynced, payoutsSyncedRef);
} else if (
unclaimedPayouts === null &&
payoutsSyncedRef.current !== 'syncing'
) {
Expand All @@ -315,18 +318,12 @@ export const PayoutsProvider = ({
checkEra(activeEra.index.minus(1));
}
}
}, [isNominating(), activeEra]);
}, [unclaimedPayouts, isNominating(), activeEra]);

// Clear payout state on network / active account change.
useEffect(() => {
if (unclaimedPayouts !== null) {
setUnclaimedPayouts(null);
}
if (!isNominating()) {
setStateWithRef('synced', setPayoutsSynced, payoutsSyncedRef);
} else {
setStateWithRef('unsynced', setPayoutsSynced, payoutsSyncedRef);
}
setUnclaimedPayouts(null);
setStateWithRef('unsynced', setPayoutsSynced, payoutsSyncedRef);
}, [network, activeAccount]);

return (
Expand Down
12 changes: 6 additions & 6 deletions src/library/Help/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import { faTimes } from '@fortawesome/free-solid-svg-icons';
import {
ButtonPrimaryInvert,
ModalCanvas,
CanvasContainer,
ModalContent,
ModalScroll,
CanvasScroll,
} from '@polkadot-cloud/react';
import { camelize } from '@polkadot-cloud/utils';
import { useAnimation } from 'framer-motion';
Expand Down Expand Up @@ -131,7 +131,7 @@ export const Help = () => {
});

return (
<ModalCanvas
<CanvasContainer
initial={{
opacity: 0,
scale: 1.05,
Expand All @@ -154,7 +154,7 @@ export const Help = () => {
zIndex: 20,
}}
>
<ModalScroll>
<CanvasScroll>
<ModalContent>
<div className="buttons">
<ButtonPrimaryInvert
Expand Down Expand Up @@ -206,10 +206,10 @@ export const Help = () => {
</>
)}
</ModalContent>
</ModalScroll>
</CanvasScroll>
<button type="button" className="close" onClick={() => closeHelp()}>
&nbsp;
</button>
</ModalCanvas>
</CanvasContainer>
);
};
2 changes: 1 addition & 1 deletion src/locale/cn/modals.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"checking": "检验中...",
"chooseLanguage": "选择语言",
"claim": "申领",
"claimAll": "申领所有",
"claimCommission": "申领佣金",
"claimOutstandingCommission": "在提名池奖励帐户中申领任何未付佣金",
"claimPayouts": "申领收益",
Expand Down Expand Up @@ -91,6 +90,7 @@
"feedbackPage": "我们的反馈页面在",
"for": "委托人 {{who}}",
"forget": "清除",
"free": "可用余额",
"getAnotherAccount": "获取更多帐户",
"gettingAccount": "正在获取帐户",
"gettingAddress": "正在获取地址...",
Expand Down
1 change: 1 addition & 0 deletions src/locale/cn/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
"proxy": "代理账户",
"recentPayouts": "最近收益",
"reserve": "储备",
"reserveBalance": "预存金额",
"reserved": "己储备",
"start": "开始",
"subscanDisabled": "Subscan己断开",
Expand Down
2 changes: 1 addition & 1 deletion src/locale/en/modals.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"checking": "Checking...",
"chooseLanguage": "Choose Language",
"claim": "Claim",
"claimAll": "Claim All",
"claimCommission": "Claim Commission",
"claimOutstandingCommission": " Claim any outstanding commission in the pool reward account.",
"claimPayouts": "Claim Payouts",
Expand Down Expand Up @@ -96,6 +95,7 @@
"feedbackPage": "We host a feedback page on",
"for": "For {{who}}",
"forget": "Forget",
"free": "Free",
"getAnotherAccount": "Get Another Account",
"gettingAccount": "Getting Account",
"gettingAddress": "Getting Address...",
Expand Down
1 change: 1 addition & 0 deletions src/locale/en/pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
"proxy": "Proxy",
"recentPayouts": "Recent Payouts",
"reserve": "Reserve",
"reserveBalance": "Reserve Balance",
"reserved": "Reserved",
"start": "Start",
"subscanDisabled": "Subscan Disabled",
Expand Down
2 changes: 1 addition & 1 deletion src/modals/Accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const AccountButton = ({
</section>
<section className="foot">
<span className="balance">
{`Free: ${planckToUnit(freeBalance, units)
{`${t('free')}: ${planckToUnit(freeBalance, units)
.decimalPlaces(3)
.toFormat()} ${unit}`}
</span>
Expand Down
7 changes: 2 additions & 5 deletions src/modals/Accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import { useConnect } from 'contexts/Connect';
import { useExtensions } from 'contexts/Extensions';
import { usePoolMemberships } from 'contexts/Pools/PoolMemberships';
import { useProxies } from 'contexts/Proxies';
import {
useEffectIgnoreInitial,
useOverlay,
} from '@polkadot-cloud/react/hooks';
import { useOverlay } from '@polkadot-cloud/react/hooks';
import { AccountButton } from './Account';
import { Delegates } from './Delegates';
import { AccountSeparator, AccountWrapper } from './Wrappers';
Expand Down Expand Up @@ -118,7 +115,7 @@ export const Accounts = () => {

useEffect(() => setLocalAccounts(accounts), [accounts]);

useEffectIgnoreInitial(() => {
useEffect(() => {
if (modalStatus === 'open') setModalResize();
}, [activeAccount, accounts, bondedAccounts, balances, ledgers, extensions]);

Expand Down
27 changes: 1 addition & 26 deletions src/modals/ClaimPayouts/Overview.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright 2023 @paritytech/polkadot-staking-dashboard authors & contributors
// SPDX-License-Identifier: GPL-3.0-only

import { ButtonSubmit, ModalNotes } from '@polkadot-cloud/react';
import { ModalNotes } from '@polkadot-cloud/react';
import { forwardRef } from 'react';
import { usePayouts } from 'contexts/Payouts';
import BigNumber from 'bignumber.js';
import { useTranslation } from 'react-i18next';
import { Item } from './Item';
import { ContentWrapper } from './Wrappers';
Expand All @@ -15,33 +14,9 @@ export const Overview = forwardRef(
const { t } = useTranslation('modals');
const { unclaimedPayouts } = usePayouts();

const claimAllPayouts = Object.entries(unclaimedPayouts || {}).map(
([era, validatorPayout]) => ({
era,
payout: Object.entries(validatorPayout)
.reduce(
(acc: BigNumber, [, amount]) => acc.plus(amount),
new BigNumber(0)
)
.toString(),
validators: Object.keys(validatorPayout),
})
);

return (
<ContentWrapper>
<div className="padding" ref={ref}>
<div style={{ margin: '1rem 0 0.5rem 0' }}>
<ButtonSubmit
disabled={Object.values(unclaimedPayouts || {}).length === 0}
text={t('claimAll')}
onClick={() => {
setPayouts(claimAllPayouts);
setSection(1);
}}
/>
</div>

{Object.entries(unclaimedPayouts || {}).map(
([era, unclaimedPayout]: any, i: number) => (
<Item
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Overview/BalanceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export const BalanceChart = () => {
label=""
button={
<ButtonTertiary
text="Reserve Balance"
text={t('overview.reserveBalance')}
onClick={() =>
openModal({ key: 'UpdateReserve', size: 'sm' })
}
Expand Down
Loading

0 comments on commit ff27b60

Please sign in to comment.