Skip to content

Commit 8e8189a

Browse files
authored
Add banner for accounts page for AHM (#11981)
* feat: add banner for accounts page for ah migration * feat: improve banner styling * feat: add banner for Asset Hub migration in Crowdloan component * fix: show commission correct in rc staking tab
1 parent 9549a5a commit 8e8189a

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// Copyright 2017-2025 @polkadot/app-accounts authors & contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import React, { useMemo } from 'react';
5+
6+
import { styled } from '@polkadot/react-components';
7+
import { useStakingAsyncApis } from '@polkadot/react-hooks';
8+
9+
import { useTranslation } from '../translate.js';
10+
import Banner from './Banner.js';
11+
12+
const BannerAssetHubMigration = () => {
13+
const { t } = useTranslation();
14+
const { ahEndPoints, isRelayChain } = useStakingAsyncApis();
15+
16+
const assetHubEndPoint = useMemo(() => {
17+
return ahEndPoints[Math.floor(Math.random() * ahEndPoints.length)];
18+
}, [ahEndPoints]);
19+
20+
if (!isRelayChain) {
21+
return null;
22+
}
23+
24+
return (
25+
<StyledBanner type='warning'>
26+
<p>
27+
{t('After Asset Hub migration, all funds have been moved to Asset Hub. Please switch to the ')}
28+
<a
29+
href={`/?rpc=${assetHubEndPoint}#/accounts`}
30+
rel='noopener noreferrer'
31+
target='_blank'
32+
>
33+
{t('Asset Hub chain')}
34+
</a>
35+
{t(' to view your balances and details.')}
36+
<br />
37+
{t('For more information about Asset Hub migration, check the ')}
38+
<a
39+
href='https://support.polkadot.network/support/solutions/articles/65000190561#What-would-happen-after-the-migration?'
40+
rel='noopener noreferrer'
41+
target='_blank'
42+
>details here</a>.
43+
</p>
44+
</StyledBanner>
45+
);
46+
};
47+
48+
const StyledBanner = styled(Banner)`
49+
border: 1px solid #ffc107;
50+
font-size: 1rem !important;
51+
`;
52+
53+
export default React.memo(BannerAssetHubMigration);

packages/page-accounts/src/Accounts/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import Qr from '../modals/Qr.js';
2828
import { useTranslation } from '../translate.js';
2929
import { SORT_CATEGORY, sortAccounts } from '../util.js';
3030
import Account from './Account.js';
31+
import BannerAssetHubMigration from './BannerAssetHubMigration.js';
3132
import BannerClaims from './BannerClaims.js';
3233
import BannerExtension from './BannerExtension.js';
3334
import Summary from './Summary.js';
@@ -335,6 +336,7 @@ function Overview ({ className = '', onStatusChange }: Props): React.ReactElemen
335336
onStatusChange={onStatusChange}
336337
/>
337338
)}
339+
<BannerAssetHubMigration />
338340
<BannerExtension />
339341
<BannerClaims />
340342
<Summary balance={balances.summary} />
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// Copyright 2017-2025 @polkadot/app-parachains authors & contributors
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
import React from 'react';
5+
6+
import { MarkWarning, styled } from '@polkadot/react-components';
7+
import { useStakingAsyncApis } from '@polkadot/react-hooks';
8+
9+
import { useTranslation } from '../translate.js';
10+
11+
const BannerAssetHubMigration = () => {
12+
const { t } = useTranslation();
13+
const { isRelayChain } = useStakingAsyncApis();
14+
15+
if (!isRelayChain) {
16+
return null;
17+
}
18+
19+
return (
20+
<StyledBanner
21+
className='warning centered'
22+
withIcon={false}
23+
>
24+
<p>
25+
{t('After the Asset Hub migration, crowdloan related activity has been transferred to the `ah_ops` pallet on Asset Hub. You can claim your funds from there, or visit ')}
26+
<a
27+
href='https://polkadot-crowdloan.com/'
28+
rel='noopener noreferrer'
29+
target='_blank'
30+
>
31+
{t('the Polkadot Crowdloan UI')}
32+
</a>
33+
{t(' for more details.')}
34+
</p>
35+
</StyledBanner>
36+
);
37+
};
38+
39+
const StyledBanner = styled(MarkWarning)`
40+
border: 1px solid #ffc107;
41+
background: #ffc10720;
42+
font-size: 1rem !important;
43+
`;
44+
45+
export default React.memo(BannerAssetHubMigration);

packages/page-parachains/src/Crowdloan/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Button, MarkWarning } from '@polkadot/react-components';
99
import { useBestNumber } from '@polkadot/react-hooks';
1010

1111
import { useTranslation } from '../translate.js';
12+
import BannerAssetHubMigration from './BannerAssetHubMigration.js';
1213
import FundAdd from './FundAdd.js';
1314
import Funds from './Funds.js';
1415
import Summary from './Summary.js';
@@ -27,6 +28,7 @@ function Crowdloan ({ auctionInfo, campaigns: { activeCap, activeRaised, funds,
2728

2829
return (
2930
<div className={className}>
31+
<BannerAssetHubMigration />
3032
<MarkWarning
3133
className='warning centered'
3234
content={t('Crowdloans will be deprecated in favor of Coretime. When Coretime is active in Polkadot, this page will be removed.')}

packages/page-staking-async/src/Actions/Account/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ function useStashCalls (api: ApiPromise, stashId: string) {
6161
return { balancesAll, spanCount, stakingAccount };
6262
}
6363

64-
function Account ({ allSlashes, className = '', info: { controllerId, destination, hexSessionIdNext, hexSessionIdQueue, isLoading, isOwnController, isOwnStash, isStashNominating, isStashValidating, nominating, sessionIds, stakingLedger, stashId }, isDisabled, minCommission, targets }: Props): React.ReactElement<Props> {
64+
function Account ({ allSlashes, className = '', info, isDisabled, minCommission, targets }: Props): React.ReactElement<Props> {
65+
const { controllerId, destination, hexSessionIdNext, hexSessionIdQueue, isLoading, isOwnController, isOwnStash, isStashNominating, isStashValidating, nominating, sessionIds, stakingLedger, stashId } = useMemo(() => info, [info]);
6566
const { t } = useTranslation();
6667
const { api } = useApi();
6768
const { isRelayChain } = useStakingAsyncApis();
@@ -211,6 +212,7 @@ function Account ({ allSlashes, className = '', info: { controllerId, destinatio
211212
<td className='all'>
212213
<AddressInfo
213214
address={stashId}
215+
stakingInfo={info}
214216
withBalance={false}
215217
withHexSessionId={hexSessionIdNext !== '0x' && [hexSessionIdQueue, hexSessionIdNext]}
216218
withValidatorPrefs

0 commit comments

Comments
 (0)