ChannelHelpers.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { AccountId } from '@polkadot/types/interfaces';
  2. import { ChannelType } from '../schemas/channel/Channel';
  3. import { ChannelPublicationStatusAllValues } from '@joystream/types/content-working-group';
  4. export const ChannelPublicationStatusDropdownOptions =
  5. ChannelPublicationStatusAllValues
  6. .map(x => ({ key: x, value: x, text: x }));
  7. export const isVideoChannel = (channel: ChannelType) => {
  8. return channel.content === 'Video';
  9. };
  10. export const isMusicChannel = (channel: ChannelType) => {
  11. return channel.content === 'Music';
  12. };
  13. export const isAccountAChannelOwner = (channel?: ChannelType, account?: AccountId | string): boolean => {
  14. return (channel && account) ? channel.roleAccount.eq(account) : false;
  15. };
  16. export function isPublicChannel (channel: ChannelType): boolean {
  17. return (
  18. channel.publicationStatus === 'Public' &&
  19. channel.curationStatus !== 'Censored'
  20. );
  21. }
  22. export function isCensoredChannel (channel: ChannelType): boolean {
  23. return channel.curationStatus === 'Censored';
  24. }
  25. export function isVerifiedChannel (channel: ChannelType): boolean {
  26. return channel.verified;
  27. }