Files
pwap/pezkuwi-sdk-ui/packages/react-components/src/AddressRow.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

113 lines
2.8 KiB
TypeScript

// Copyright 2017-2026 @pezkuwi/react-components authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AccountId, AccountIndex, Address } from '@pezkuwi/types/interfaces';
import type { RowProps } from './Row.js';
import React from 'react';
import { useAccountInfo } from '@pezkuwi/react-hooks';
import BaseIdentityIcon from '@pezkuwi/react-identicon';
import IdentityIcon from './IdentityIcon/index.js';
import Row from './Row.js';
import { styled } from './styled.js';
export interface Props extends RowProps {
isContract?: boolean;
isValid?: boolean;
fullLength?: boolean;
label?: string;
noDefaultNameOpacity?: boolean;
overlay?: React.ReactNode;
value?: AccountId | AccountIndex | Address | string | null;
withSidebar?: boolean;
withTags?: boolean;
}
const DEFAULT_ADDR = '5'.padEnd(48, 'x');
const ICON_SIZE = 32;
function AddressRow ({ buttons, children, className, defaultName, fullLength = false, isContract = false, isDisabled, isEditableName, isInline, isValid: propsIsValid, overlay, value, withTags = false }: Props): React.ReactElement<Props> | null {
const { accountIndex, isNull, name, onSaveName, onSaveTags, setName, setTags, tags } = useAccountInfo(value ? value.toString() : null, isContract);
const isValid = !isNull && (propsIsValid || value || accountIndex);
const Icon = value ? IdentityIcon : BaseIdentityIcon;
const address = value && isValid ? value : DEFAULT_ADDR;
return (
<StyledRow
address={address}
buttons={buttons}
className={className}
defaultName={defaultName}
icon={
<Icon
size={ICON_SIZE}
value={value ? value.toString() : null}
/>
}
isDisabled={isDisabled}
isEditableName={isEditableName}
isEditableTags
isInline={isInline}
isShortAddr={!fullLength}
name={name}
onChangeName={setName}
onChangeTags={setTags}
onSaveName={onSaveName}
onSaveTags={onSaveTags}
tags={withTags ? tags : undefined}
>
{children}
{overlay}
</StyledRow>
);
}
export { AddressRow, DEFAULT_ADDR };
const StyledRow = styled(Row)`
button.u.ui--Icon.editButton {
padding: 0 .3em .3em .3em;
color: #2e86ab;
background: none;
/*trick to let the button in the flow but keep the content centered regardless*/
margin-left: -2em;
position: relative;
right: -2.3em;
z-index: 1;
}
.editSpan {
white-space: nowrap;
&:before {
content: '';
}
}
.ui--AddressRow-balances {
display: flex;
.column {
display: block;
label,
.result {
display: inline-block;
vertical-align: middle;
}
}
> span {
text-align: left;
}
}
.ui--AddressRow-placeholder {
opacity: var(--opacity-light);
}
`;
export default React.memo(AddressRow);