ghost-portal/packages/page-staking/src/Pools/Pools.tsx
Jaco 2a7af81d16
Staking pools (#7089)
* Staking pools

* Fly-by comment fix

* Some infrastructure

* multi

* Create value

* Retrieve singular params instance

* defaultValue for multi query

* Retrieve list of pool ids

* Drive-by param formatting

* Pool list retrieval

* Retrieve pool info

* Adjust trigger placement

* Dump info

* Join modal

* Fix build

* Allow creation & joining

* caveman typing

* Adjust disabled state

* Adjust

* cowboy types

* Some basic stats

* Created/Destoyed events

* Adjust for latest

* Set metadata on creation

* Basic pools
2022-03-28 21:34:08 +03:00

48 lines
1.0 KiB
TypeScript

// Copyright 2017-2022 @polkadot/app-staking authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { BN } from '@polkadot/util';
import type { Params } from './types';
import React, { useMemo } from 'react';
import { Table } from '@polkadot/react-components';
import { useTranslation } from '../translate';
import Pool from './Pool';
interface Props {
className?: string;
ids?: BN[];
params: Params;
}
function Pools ({ className, ids, params }: Props): React.ReactElement<Props> {
const { t } = useTranslation();
const header = useMemo(() => [
[t('pools'), 'start', 2],
[t('points')],
[t('delegators')]
], [t]);
return (
<Table
className={className}
empty={ids && t<string>('No available nomination pools')}
emptySpinner={t<string>('Retrieving nomination pools')}
header={header}
>
{ids?.map((id) => (
<Pool
id={id}
key={id.toString()}
params={params}
/>
))}
</Table>
);
}
export default React.memo(Pools);