mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-08-08 01:55:43 +00:00
Add Pezkuwi SDK UI - Polkadot.js Apps clone
- Clone Polkadot.js Apps repository - Update package.json with Pezkuwi branding - Add Pezkuwi endpoint to production chains (wss://pezkuwichain.app:9944) - Create comprehensive README for SDK UI - Set up project structure with all packages Next steps: - Apply Kurdistan colors (Kesk, Sor, Zer, Spi + Black) to UI theme - Replace logos with Pezkuwi branding - Test build and deployment
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
// Copyright 2017-2025 @polkadot/react-components authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { ApiPromise } from '@polkadot/api';
|
||||
import type { QueryableStorageEntry } from '@polkadot/api/types';
|
||||
import type { DropdownOptions } from '../util/types.js';
|
||||
|
||||
import React from 'react';
|
||||
|
||||
import { useApi } from '@polkadot/react-hooks';
|
||||
|
||||
import Dropdown from '../Dropdown.js';
|
||||
import { filterDropdownItems } from '../util/index.js';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
isError?: boolean;
|
||||
onChange: (value: QueryableStorageEntry<'promise'>) => void;
|
||||
options: DropdownOptions;
|
||||
value: QueryableStorageEntry<'promise'>;
|
||||
}
|
||||
|
||||
function transform (api: ApiPromise, { value }: Props): (method: string) => QueryableStorageEntry<'promise'> {
|
||||
return function (method: string): QueryableStorageEntry<'promise'> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
return api.query[value.creator.section]
|
||||
? api.query[value.creator.section][method] as any
|
||||
: value;
|
||||
};
|
||||
}
|
||||
|
||||
function SelectKey (props: Props): React.ReactElement<Props> | null {
|
||||
const { api } = useApi();
|
||||
const { className = '', isError, onChange, options, value } = props;
|
||||
|
||||
if (!options.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Dropdown
|
||||
className={`${className} ui--DropdownLinked-Items`}
|
||||
isError={isError}
|
||||
onChange={onChange}
|
||||
onSearch={filterDropdownItems}
|
||||
options={options}
|
||||
transform={transform(api, props)}
|
||||
value={value.creator.method}
|
||||
withLabel={false}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
export default React.memo(SelectKey);
|
||||
Reference in New Issue
Block a user