Files
pwap/pezkuwi-sdk-ui/packages/react-components/src/Forget.tsx
T
pezkuwichain 971df8edba Rebrand: Remove 3rd party chains, update domains to PezkuwiChain
- Remove all 3rd party parachain configurations from endpoints:
  - productionRelayPolkadot.ts: Keep only system parachains
  - productionRelayDicle.ts: Keep only system parachains
  - testingRelayZagros.ts: Keep only system parachains
  - testingRelayTeyrChain.ts: Keep only system parachains

- Update domain references:
  - polkadot.js.org → pezkuwichain.app
  - wiki.polkadot.network → wiki.pezkuwichain.io
  - dotapps.io → pezkuwichain.app
  - statement.polkadot.network → docs.pezkuwichain.io/statement
  - support.polkadot.network → docs.pezkuwichain.io

- Update repository references:
  - github.com/pezkuwi-js/apps → github.com/pezkuwichain/pwap

- Rename system parachains to Pezkuwi ecosystem:
  - PolkadotAssetHub → PezkuwiAssetHub
  - polkadotBridgeHub → pezkuwiBridgeHub
  - polkadotCollectives → pezkuwiCollectives
  - polkadotCoretime → pezkuwiCoretime
  - polkadotPeople → pezkuwiPeople

- Update network name in claims utility:
  - Polkadot → Pezkuwi
2026-01-09 03:08:11 +03:00

106 lines
3.4 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import React from 'react';
import Button from './Button/index.js';
import Modal from './Modal/index.js';
import AddressRow from './AddressRow.js';
import { useTranslation } from './translate.js';
type Mode = 'account' | 'address' | 'contract' | 'code';
interface Props {
address?: string;
children?: React.ReactNode;
name?: string;
mode?: Mode;
onClose: () => void;
onForget: () => void;
}
function getContent (mode: Mode, t: (key: string) => string): React.ReactNode | null {
switch (mode) {
case 'account':
return (
<>
<p>{t('You are about to remove this account from your list of available accounts. Once completed, should you need to access it again, you will have to re-create the account either via seed or via a backup file.')}</p>
<p>{t('This operation does not remove the history of the account from the chain, nor any associated funds from the account. The forget operation only limits your access to the account on this browser.')}</p>
</>
);
case 'address':
return (
<>
<p>{t('You are about to remove this address from your address book. Once completed, should you need to access it again, you will have to re-add the address.')}</p>
<p>{t('This operation does not remove the history of the account from the chain, nor any associated funds from the account. The forget operation only limits your access to the address on this browser.')}</p>
</>
);
case 'contract':
return (
<>
<p>{t('You are about to remove this contract from your list of available contracts. Once completed, should you need to access it again, you will have to manually add the contract\'s address in the Instantiate tab.')}</p>
<p>{t('This operation does not remove the history of the contract from the chain, nor any associated funds from its account. The forget operation only limits your access to the contract on this browser.')}</p>
</>
);
default:
return null;
}
}
function getHeaderText (mode: Mode, t: (key: string) => string): string {
switch (mode) {
case 'account':
return t('Confirm account removal');
case 'address':
return t('Confirm address removal');
case 'contract':
return t('Confirm contract removal');
case 'code':
return t('Confirm code removal');
}
}
function renderContent (props: Props, t: (key: string) => string): React.ReactNode | null {
const { address, mode = 'account' } = props;
switch (mode) {
case 'account':
case 'address':
case 'contract':
return (
<AddressRow
isInline
value={address || ''}
>
{getContent(mode, t)}
</AddressRow>
);
default:
return null;
}
}
function Forget (props: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const { children, mode = 'account', onClose, onForget } = props;
return (
<Modal
className='app--accounts-Modal'
header={getHeaderText(mode, t)}
onClose={onClose}
>
<Modal.Content>{children || renderContent(props, t)}</Modal.Content>
<Modal.Actions>
<Button
icon='trash'
label={t('Forget')}
onClick={onForget}
/>
</Modal.Actions>
</Modal>
);
}
export default React.memo(Forget);