25b65c3fb7
* feat(wip): add basic feed operations * ci: bump checks * ci: bump checks * feat: rework stamps and add feed functionalities * refactor: polish and fixes * feat(wip): add formulas * feat: show bzz.link for websites * feat: add stamp empty states and formatBzz * feat: add feed download * chore: update manifest-js version * feat: dev mode support with bee-js 3.1.0 (#273) * feat: dev mode support with bee-js 3.1.0 * fix: added missing package-lock.json file * build: remove PR preview * style: work on design * feat: add TroubleshootConnectionCard * build: remove depcheck Co-authored-by: Attila Gazso <agazso@gmail.com>
44 lines
1.5 KiB
TypeScript
44 lines
1.5 KiB
TypeScript
import type { ReactElement } from 'react'
|
|
import ExpandableElement from '../../components/ExpandableElement'
|
|
import ExpandableList from '../../components/ExpandableList'
|
|
import ExpandableListItem from '../../components/ExpandableListItem'
|
|
import ExpandableListItemKey from '../../components/ExpandableListItemKey'
|
|
import { EnrichedPostageBatch } from '../../providers/Stamps'
|
|
import { getHumanReadableFileSize } from '../../utils/file'
|
|
import { PostageStamp } from './PostageStamp'
|
|
|
|
interface Props {
|
|
postageStamps: EnrichedPostageBatch[] | null
|
|
}
|
|
|
|
function StampsTable({ postageStamps }: Props): ReactElement | null {
|
|
if (postageStamps === null) return null
|
|
|
|
return (
|
|
<ExpandableList label="Postage Stamps" defaultOpen>
|
|
{postageStamps.map(stamp => (
|
|
<ExpandableElement
|
|
key={stamp.batchID}
|
|
expandable={
|
|
<>
|
|
<ExpandableListItemKey label="Batch ID" value={stamp.batchID} />
|
|
<ExpandableListItem label="Depth" value={String(stamp.depth)} />
|
|
<ExpandableListItem
|
|
label="Capacity"
|
|
value={`${getHumanReadableFileSize(2 ** stamp.depth * 4096 * stamp.usage)} / ${getHumanReadableFileSize(
|
|
2 ** stamp.depth * 4096,
|
|
)}`}
|
|
/>
|
|
<ExpandableListItem label="Amount" value={parseInt(stamp.amount, 10).toLocaleString()} />
|
|
</>
|
|
}
|
|
>
|
|
<PostageStamp stamp={stamp} shorten={true} />
|
|
</ExpandableElement>
|
|
))}
|
|
</ExpandableList>
|
|
)
|
|
}
|
|
|
|
export default StampsTable
|