ghost-portal/packages/page-assets/src/Overview/Asset.tsx
Jaco e63eeb506c
Rework (some) component styled injection (#8795)
* Rework (some) component styled injection

* Small build fixes

* Additional build fixes

* Additional

* Fixes

* Remove unused SelectedDrag

* Remover unneeded props passing

* Fix build

* Remove unneeded inline-block
2023-01-14 15:22:42 +02:00

52 lines
1.6 KiB
TypeScript

// Copyright 2017-2023 @polkadot/app-assets authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { AssetInfo } from '../types';
import React, { useMemo } from 'react';
import { AddressSmall, Table } from '@polkadot/react-components';
import { FormatBalance } from '@polkadot/react-query';
import Mint from './Mint';
interface Props {
className?: string;
value: AssetInfo;
}
function Asset ({ className, value: { details, id, isIssuerMe, metadata } }: Props): React.ReactElement<Props> {
const format = useMemo(
(): [number, string] => metadata
? [metadata.decimals.toNumber(), metadata.symbol.toUtf8()]
: [0, '---'],
[metadata]
);
return (
<tr className={className}>
<Table.Column.Id value={id} />
<td className='together'>{metadata?.name.toUtf8()}</td>
<td className='address media--1000'>{details && <AddressSmall value={details.owner} />}</td>
<td className='address media--1300'>{details && <AddressSmall value={details.admin} />}</td>
<td className='address media--1600'>{details && <AddressSmall value={details.issuer} />}</td>
<td className='address media--1900'>{details && <AddressSmall value={details.freezer} />}</td>
<td className='number all'>{details && (
<FormatBalance
format={format}
value={details.supply}
/>
)}</td>
<td className='button'>{details && metadata && isIssuerMe && (
<Mint
details={details}
id={id}
metadata={metadata}
/>
)}</td>
</tr>
);
}
export default React.memo(Asset);