Add AHM warning page (#1601)
This commit is contained in:
parent
f32f39e371
commit
48ef4046ef
81
packages/extension-ui/src/Popup/AssetHubMigration.tsx
Normal file
81
packages/extension-ui/src/Popup/AssetHubMigration.tsx
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
// Copyright 2019-2025 @polkadot/extension-ui authors & contributors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
import React, { useCallback, useContext } from 'react';
|
||||||
|
|
||||||
|
import { ActionContext, Box, Button, ButtonArea, List } from '../components/index.js';
|
||||||
|
import { useTranslation } from '../hooks/index.js';
|
||||||
|
import { Header } from '../partials/index.js';
|
||||||
|
import { styled } from '../styled.js';
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
function AssetHubMigration ({ className }: Props): React.ReactElement<Props> {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const onAction = useContext(ActionContext);
|
||||||
|
|
||||||
|
const _onClick = useCallback(
|
||||||
|
(): void => {
|
||||||
|
window.localStorage.setItem('asset_hub_migration_read', 'ok');
|
||||||
|
onAction();
|
||||||
|
},
|
||||||
|
[onAction]
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Header text={t('Asset Hub Migration Notice')} />
|
||||||
|
<div className={className}>
|
||||||
|
<p>{t('The Asset Hub migration has been completed. Please note the following important changes:')}</p>
|
||||||
|
<Box>
|
||||||
|
<List>
|
||||||
|
<li>{t('All balances have been migrated from the Relay Chain to Asset Hub')}</li>
|
||||||
|
<li>{t('All on-chain functionality has been moved to Asset Hub')}</li>
|
||||||
|
<li>{t('Asset Hub now holds user balances and provides general functionality')}</li>
|
||||||
|
</List>
|
||||||
|
</Box>
|
||||||
|
<p className='warning'>{t('Do not teleport balances to the Relay Chain unless:')}</p>
|
||||||
|
<Box>
|
||||||
|
<List>
|
||||||
|
<li>{t('You are opening HRMP channels, or')}</li>
|
||||||
|
<li>{t('You are starting a Parachain')}</li>
|
||||||
|
</List>
|
||||||
|
</Box>
|
||||||
|
<p>{t('For all other operations, your balances are already on Asset Hub.')}</p>
|
||||||
|
</div>
|
||||||
|
<ButtonArea>
|
||||||
|
<Button onClick={_onClick}>{t('I Understand')}</Button>
|
||||||
|
</ButtonArea>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default styled(AssetHubMigration)<Props>`
|
||||||
|
p {
|
||||||
|
color: var(--subTextColor);
|
||||||
|
margin-bottom: 4px;
|
||||||
|
margin-top: 0;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.warning {
|
||||||
|
color: var(--errorColor);
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 1.1em;
|
||||||
|
margin-top: 6px;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
article {
|
||||||
|
margin: 0.4rem 24px;
|
||||||
|
padding: 8px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
@ -25,6 +25,7 @@ import Derive from './Derive/index.js';
|
|||||||
import ImportSeed from './ImportSeed/index.js';
|
import ImportSeed from './ImportSeed/index.js';
|
||||||
import Metadata from './Metadata/index.js';
|
import Metadata from './Metadata/index.js';
|
||||||
import Signing from './Signing/index.js';
|
import Signing from './Signing/index.js';
|
||||||
|
import AssetHubMigration from './AssetHubMigration.js';
|
||||||
import Export from './Export.js';
|
import Export from './Export.js';
|
||||||
import ExportAll from './ExportAll.js';
|
import ExportAll from './ExportAll.js';
|
||||||
import Forget from './Forget.js';
|
import Forget from './Forget.js';
|
||||||
@ -76,12 +77,14 @@ export default function Popup (): React.ReactElement {
|
|||||||
const [metaRequests, setMetaRequests] = useState<null | MetadataRequest[]>(null);
|
const [metaRequests, setMetaRequests] = useState<null | MetadataRequest[]>(null);
|
||||||
const [signRequests, setSignRequests] = useState<null | SigningRequest[]>(null);
|
const [signRequests, setSignRequests] = useState<null | SigningRequest[]>(null);
|
||||||
const [isWelcomeDone, setWelcomeDone] = useState(false);
|
const [isWelcomeDone, setWelcomeDone] = useState(false);
|
||||||
|
const [isMigrationDone, setMigrationDone] = useState(false);
|
||||||
const [settingsCtx, setSettingsCtx] = useState<SettingsStruct>(startSettings);
|
const [settingsCtx, setSettingsCtx] = useState<SettingsStruct>(startSettings);
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
const _onAction = useCallback(
|
const _onAction = useCallback(
|
||||||
(to?: string): void => {
|
(to?: string): void => {
|
||||||
setWelcomeDone(window.localStorage.getItem('welcome_read') === 'ok');
|
setWelcomeDone(window.localStorage.getItem('welcome_read') === 'ok');
|
||||||
|
setMigrationDone(window.localStorage.getItem('asset_hub_migration_read') === 'ok');
|
||||||
|
|
||||||
if (!to) {
|
if (!to) {
|
||||||
return;
|
return;
|
||||||
@ -130,15 +133,17 @@ export default function Popup (): React.ReactElement {
|
|||||||
return <ErrorBoundary trigger={trigger}>{component}</ErrorBoundary>;
|
return <ErrorBoundary trigger={trigger}>{component}</ErrorBoundary>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Root = isWelcomeDone
|
const Root = !isWelcomeDone
|
||||||
? authRequests?.length
|
? wrapWithErrorBoundary(<Welcome />, 'welcome')
|
||||||
? wrapWithErrorBoundary(<Authorize />, 'authorize')
|
: !isMigrationDone
|
||||||
: metaRequests?.length
|
? wrapWithErrorBoundary(<AssetHubMigration />, 'asset-hub-migration')
|
||||||
? wrapWithErrorBoundary(<Metadata />, 'metadata')
|
: authRequests?.length
|
||||||
: signRequests?.length
|
? wrapWithErrorBoundary(<Authorize />, 'authorize')
|
||||||
? wrapWithErrorBoundary(<Signing />, 'signing')
|
: metaRequests?.length
|
||||||
: wrapWithErrorBoundary(<Accounts />, 'accounts')
|
? wrapWithErrorBoundary(<Metadata />, 'metadata')
|
||||||
: wrapWithErrorBoundary(<Welcome />, 'welcome');
|
: signRequests?.length
|
||||||
|
? wrapWithErrorBoundary(<Signing />, 'signing')
|
||||||
|
: wrapWithErrorBoundary(<Accounts />, 'accounts');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Loading>{accounts && authRequests && metaRequests && signRequests && (
|
<Loading>{accounts && authRequests && metaRequests && signRequests && (
|
||||||
|
|||||||
@ -186,5 +186,16 @@
|
|||||||
"Ethereum Account": "",
|
"Ethereum Account": "",
|
||||||
"It looks like this request is coming from an suspicious origin. Please verify the source carefully.": "",
|
"It looks like this request is coming from an suspicious origin. Please verify the source carefully.": "",
|
||||||
"Password is not strong enough": "",
|
"Password is not strong enough": "",
|
||||||
"Password must be at least {{length}} characters long": ""
|
"Password must be at least {{length}} characters long": "",
|
||||||
|
"Asset Hub Migration Notice": "",
|
||||||
|
"The Asset Hub migration has been completed. Please note the following important changes:": "",
|
||||||
|
"All balances have been migrated from the Relay Chain to Asset Hub": "",
|
||||||
|
"All on-chain functionality has been moved to Asset Hub": "",
|
||||||
|
"Asset Hub now holds user balances and provides general functionality": "",
|
||||||
|
"⚠️ Do not teleport balances to the Relay Chain unless:": "",
|
||||||
|
"You are opening HRMP channels, or": "",
|
||||||
|
"You are starting a Parachain": "",
|
||||||
|
"For all other operations, your balances are already on Asset Hub.": "",
|
||||||
|
"I Understand": "",
|
||||||
|
"Do not teleport balances to the Relay Chain unless:": ""
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user