mirror of
https://github.com/pezkuwichain/pezkuwi-apps.git
synced 2026-04-24 04:07:59 +00:00
feat: initial Pezkuwi Apps rebrand from polkadot-apps
Rebranded terminology: - Polkadot → Pezkuwi - Kusama → Dicle - Westend → Zagros - Rococo → PezkuwiChain - Substrate → Bizinikiwi - parachain → teyrchain Custom logos with Kurdistan brand colors (#e6007a → #86e62a): - bizinikiwi-hexagon.svg - sora-bizinikiwi.svg - hezscanner.svg - heztreasury.svg - pezkuwiscan.svg - pezkuwistats.svg - pezkuwiassembly.svg - pezkuwiholic.svg
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// Copyright 2017-2025 @pezkuwi/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { DeriveAccountInfo } from '@pezkuwi/api-derive/types';
|
||||
import type { AccountId, Address } from '@pezkuwi/types/interfaces';
|
||||
|
||||
import React, { useMemo } from 'react';
|
||||
|
||||
import { useDeriveAccountInfo, useSystemApi } from '@pezkuwi/react-hooks';
|
||||
|
||||
interface Props {
|
||||
children?: React.ReactNode;
|
||||
className?: string;
|
||||
defaultValue?: string;
|
||||
label?: React.ReactNode;
|
||||
value?: string | AccountId | Address | null | Uint8Array;
|
||||
}
|
||||
|
||||
function extractIndex ({ accountIndex }: Partial<DeriveAccountInfo> = {}): string | null {
|
||||
return accountIndex
|
||||
? accountIndex.toString()
|
||||
: null;
|
||||
}
|
||||
|
||||
function AccountIndex ({ children, className = '', defaultValue, label, value }: Props): React.ReactElement<Props> | null {
|
||||
const api = useSystemApi();
|
||||
const info = useDeriveAccountInfo(value);
|
||||
|
||||
const accountIndex = useMemo(
|
||||
() => extractIndex(info),
|
||||
[info]
|
||||
);
|
||||
|
||||
if (!api?.query.indices) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={`${className} ui--AccountIndex`}>
|
||||
{label || ''}<div className='account-index'>{accountIndex || defaultValue || '-'}</div>{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(AccountIndex);
|
||||
Reference in New Issue
Block a user