ChannelPreviewStats.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import React from 'react';
  2. import { Statistic } from 'semantic-ui-react';
  3. import { ChannelEntity } from '../entities/ChannelEntity';
  4. import { formatNumber } from '@polkadot/util';
  5. type Props = {
  6. channel: ChannelEntity;
  7. };
  8. export const ChannelPreviewStats = (props: Props) => {
  9. const { channel } = props;
  10. const statSize = 'tiny';
  11. let itemsPublishedLabel = '';
  12. if (channel.content === 'Video') {
  13. itemsPublishedLabel = 'Videos';
  14. } else if (channel.content === 'Music') {
  15. itemsPublishedLabel = 'Music tracks';
  16. }
  17. return (
  18. <div className='ChannelStats'>
  19. <div>
  20. <Statistic size={statSize}>
  21. <Statistic.Label>Reward earned</Statistic.Label>
  22. <Statistic.Value>
  23. {formatNumber(channel.rewardEarned)}
  24. &nbsp;<span style={{ fontSize: '1.5rem' }}>JOY</span>
  25. </Statistic.Value>
  26. </Statistic>
  27. </div>
  28. <div style={{ marginTop: '1rem' }}>
  29. <Statistic size={statSize}>
  30. <Statistic.Label>{itemsPublishedLabel}</Statistic.Label>
  31. <Statistic.Value>{formatNumber(channel.contentItemsCount)}</Statistic.Value>
  32. </Statistic>
  33. </div>
  34. </div>
  35. );
  36. };