Browse Source

Linter autofix

Leszek Wiesner 4 years ago
parent
commit
51f382b9f5
54 changed files with 203 additions and 79 deletions
  1. 1 1
      pioneer/packages/apps/webpack.base.config.js
  2. 9 0
      pioneer/packages/joy-media/src/DiscoveryProvider.tsx
  3. 1 0
      pioneer/packages/joy-media/src/IterableFile.ts
  4. 1 1
      pioneer/packages/joy-media/src/MediaView.tsx
  5. 22 7
      pioneer/packages/joy-media/src/Upload.tsx
  6. 1 0
      pioneer/packages/joy-media/src/channels/ChannelAvatarAndName.tsx
  7. 1 1
      pioneer/packages/joy-media/src/channels/ChannelHelpers.ts
  8. 1 0
      pioneer/packages/joy-media/src/channels/ChannelNameAsLink.tsx
  9. 1 0
      pioneer/packages/joy-media/src/channels/ChannelPreviewStats.tsx
  10. 3 1
      pioneer/packages/joy-media/src/channels/ChannelsByOwner.tsx
  11. 1 0
      pioneer/packages/joy-media/src/channels/ChannelsByOwner.view.tsx
  12. 4 3
      pioneer/packages/joy-media/src/channels/EditChannel.tsx
  13. 1 0
      pioneer/packages/joy-media/src/channels/EditChannel.view.tsx
  14. 1 0
      pioneer/packages/joy-media/src/channels/ViewChannel.tsx
  15. 1 0
      pioneer/packages/joy-media/src/channels/ViewChannel.view.tsx
  16. 2 2
      pioneer/packages/joy-media/src/channels/ViewMusicChannel.tsx
  17. 4 2
      pioneer/packages/joy-media/src/common/FormTabs.tsx
  18. 2 2
      pioneer/packages/joy-media/src/common/MediaDropdownOptions.tsx
  19. 5 0
      pioneer/packages/joy-media/src/common/MediaForms.tsx
  20. 3 0
      pioneer/packages/joy-media/src/common/MediaPlayerView.tsx
  21. 10 5
      pioneer/packages/joy-media/src/common/MediaPlayerWithResolver.tsx
  22. 1 0
      pioneer/packages/joy-media/src/common/images.tsx
  23. 1 1
      pioneer/packages/joy-media/src/explore/PlayContent.tsx
  24. 1 1
      pioneer/packages/joy-media/src/index.tsx
  25. 1 1
      pioneer/packages/joy-media/src/mocks/ContentLicense.mock.ts
  26. 1 1
      pioneer/packages/joy-media/src/mocks/Language.mock.ts
  27. 1 1
      pioneer/packages/joy-media/src/mocks/MediaObject.mock.ts
  28. 1 1
      pioneer/packages/joy-media/src/mocks/MusicGenre.mock.ts
  29. 1 1
      pioneer/packages/joy-media/src/mocks/MusicMood.mock.ts
  30. 1 1
      pioneer/packages/joy-media/src/mocks/MusicTheme.mock.ts
  31. 1 1
      pioneer/packages/joy-media/src/mocks/VideoCategory.mock.ts
  32. 1 0
      pioneer/packages/joy-media/src/music/EditMusicAlbum.tsx
  33. 1 0
      pioneer/packages/joy-media/src/music/EditMusicAlbum.view.tsx
  34. 1 0
      pioneer/packages/joy-media/src/music/MusicAlbumTracks.tsx
  35. 1 0
      pioneer/packages/joy-media/src/music/MusicTrackPreview.tsx
  36. 1 0
      pioneer/packages/joy-media/src/music/MusicTrackReaderPreview.tsx
  37. 11 7
      pioneer/packages/joy-media/src/music/MyMusicTracks.tsx
  38. 3 1
      pioneer/packages/joy-media/src/music/ReorderableTracks.tsx
  39. 2 0
      pioneer/packages/joy-media/src/schemas/channel/Channel.ts
  40. 2 2
      pioneer/packages/joy-media/src/schemas/general/FeaturedContent.ts
  41. 1 1
      pioneer/packages/joy-media/src/schemas/music/MusicAlbum.ts
  42. 22 4
      pioneer/packages/joy-media/src/transport.substrate.ts
  43. 29 17
      pioneer/packages/joy-media/src/transport.ts
  44. 1 0
      pioneer/packages/joy-media/src/upload/EditVideo.view.tsx
  45. 2 0
      pioneer/packages/joy-media/src/upload/UploadAudio.tsx
  46. 1 0
      pioneer/packages/joy-media/src/upload/UploadAudio.view.tsx
  47. 12 2
      pioneer/packages/joy-media/src/upload/UploadVideo.tsx
  48. 1 0
      pioneer/packages/joy-media/src/utils.ts
  49. 1 0
      pioneer/packages/joy-media/src/video/PlayVideo.tsx
  50. 2 1
      pioneer/packages/joy-media/src/video/PlayVideo.view.tsx
  51. 1 1
      pioneer/packages/joy-media/src/video/VideoPreview.tsx
  52. 1 0
      pioneer/packages/joy-utils/src/react/components/InputFileAsync.tsx
  53. 12 6
      pioneer/packages/joy-utils/src/react/hocs/accounts.tsx
  54. 9 3
      pioneer/packages/joy-utils/src/transport/SimpleCache.ts

+ 1 - 1
pioneer/packages/apps/webpack.base.config.js

@@ -49,7 +49,7 @@ function createWebpack (ENV, context) {
   }, {});
 
   // Add @joystream/types as alias to automatically process any changes:
-  alias['@joystream/types'] = path.resolve(context, `../../../types/src`);
+  alias['@joystream/types'] = path.resolve(context, '../../../types/src');
 
   return {
     context,

+ 9 - 0
pioneer/packages/joy-media/src/DiscoveryProvider.tsx

@@ -26,9 +26,11 @@ export type DiscoveryProviderProps = {
 // return string Url with last `/` removed
 function normalizeUrl (url: string | Url): string {
   const st: string = url.toString();
+
   if (st.endsWith('/')) {
     return st.substring(0, st.length - 1);
   }
+
   return st.toString();
 }
 
@@ -79,9 +81,11 @@ function newDiscoveryProvider ({ bootstrapNodes }: BootstrapNodes): DiscoveryPro
           break;
         } catch (err) {
           console.log(err);
+
           if (axios.isCancel(err)) {
             throw err;
           }
+
           continue;
         }
       }
@@ -101,6 +105,7 @@ function newDiscoveryProvider ({ bootstrapNodes }: BootstrapNodes): DiscoveryPro
   const reportUnreachable = (provider: StorageProviderId) => {
     const key = provider.toString();
     const stat = stats.get(key);
+
     if (stat) {
       stat.unreachableReports = stat.unreachableReports + 1;
     }
@@ -122,6 +127,7 @@ export const DiscoveryProviderProvider = (props: React.PropsWithChildren<{}>) =>
 
       console.log('Discovery Provider: Loading bootstrap node from Substrate...');
       const bootstrapNodes = await api.api.query.discovery.bootstrapEndpoints() as Vec<Url>;
+
       setProvider(newDiscoveryProvider({ bootstrapNodes }));
       setLoaded(true);
       console.log('Discovery Provider: Initialized');
@@ -159,6 +165,7 @@ export const useDiscoveryProvider = () =>
 export function withDiscoveryProvider (Component: React.ComponentType<DiscoveryProviderProps>) {
   const ResultComponent: React.FunctionComponent<{}> = (props: React.PropsWithChildren<{}>) => {
     const discoveryProvider = useDiscoveryProvider();
+
     if (!discoveryProvider) {
       return <JoyInfo title={'Please wait...'}>Loading discovery provider.</JoyInfo>;
     }
@@ -169,6 +176,8 @@ export function withDiscoveryProvider (Component: React.ComponentType<DiscoveryP
       </Component>
     );
   };
+
   ResultComponent.displayName = `withDiscoveryProvider(${componentName(Component)})`;
+
   return ResultComponent;
 }

+ 1 - 0
pioneer/packages/joy-media/src/IterableFile.ts

@@ -36,6 +36,7 @@ export class IterableFile implements AsyncIterable<Buffer> {
         e.target.result && resolve(Buffer.from(e.target.result));
         e.target.error && reject(e.target.error);
       };
+
       this.reader.readAsArrayBuffer(blob);
     });
   }

+ 1 - 1
pioneer/packages/joy-media/src/MediaView.tsx

@@ -54,7 +54,7 @@ export function MediaView<A extends Record<string, unknown> = Record<string, unk
     const [resolvedProps, setResolvedProps] = useState({} as B);
     const [propsResolved, setPropsResolved] = useState(false);
 
-    const initialDeps = triggers.map(propName => serializeTrigger(initialProps[propName]));
+    const initialDeps = triggers.map((propName) => serializeTrigger(initialProps[propName]));
     const rerenderDeps = [...initialDeps, myAddress];
 
     useEffect(() => {

+ 22 - 7
pioneer/packages/joy-media/src/Upload.tsx

@@ -5,7 +5,7 @@ import { History } from 'history';
 import { Progress, Message } from 'semantic-ui-react';
 
 import { mockRegistry } from '@joystream/types';
-import { InputFileAsync } from '@polkadot/joy-utils/react/components';
+import { InputFileAsync, TxButton, JoyInfo, Loading } from '@polkadot/joy-utils/react/components';
 import { ApiProps } from '@polkadot/react-api/types';
 import { I18nProps } from '@polkadot/react-components/types';
 import { SubmittableResult } from '@polkadot/api';
@@ -19,14 +19,13 @@ import { ContentId, DataObject } from '@joystream/types/media';
 import { MyAccountProps } from '@polkadot/joy-utils/react/hocs/accounts';
 import { withOnlyMembers } from '@polkadot/joy-utils/react/hocs/guards';
 import { DiscoveryProviderProps, withDiscoveryProvider } from './DiscoveryProvider';
-import { TxButton } from '@polkadot/joy-utils/react/components';
+
 import IpfsHash from 'ipfs-only-hash';
 import { ChannelId } from '@joystream/types/content-working-group';
 import { EditVideoView } from './upload/EditVideo.view';
-import { JoyInfo } from '@polkadot/joy-utils/react/components';
+
 import { IterableFile } from './IterableFile';
 import { StorageProviderId } from '@joystream/types/working-group';
-import { Loading } from '@polkadot/joy-utils/react/components';
 
 const MAX_FILE_SIZE_MB = 500;
 const MAX_FILE_SIZE_BYTES = MAX_FILE_SIZE_MB * 1024 * 1024;
@@ -77,6 +76,7 @@ class Upload extends React.PureComponent<Props, State> {
     });
 
     const { cancelSource } = this.state;
+
     cancelSource.cancel('unmounting');
   }
 
@@ -101,6 +101,7 @@ class Upload extends React.PureComponent<Props, State> {
 
   private renderError () {
     const { error } = this.state;
+
     return (
       <Message error className='JoyMainStatus'>
         <Message.Header>Failed to upload your file</Message.Header>
@@ -112,6 +113,7 @@ class Upload extends React.PureComponent<Props, State> {
 
   private resetForm = () => {
     const { cancelSource } = this.state;
+
     this.setState({
       ...defaultState(),
       cancelSource
@@ -120,6 +122,7 @@ class Upload extends React.PureComponent<Props, State> {
 
   private renderUploading () {
     const { file, newContentId, progress, error } = this.state;
+
     if (!file || !file.name) return <JoyInfo title='Loading...' />;
 
     const success = !error && progress >= 100;
@@ -139,7 +142,7 @@ class Upload extends React.PureComponent<Props, State> {
   }
 
   private renderSendingTx () {
-    return <JoyInfo title="Please wait..."><Loading text="Waiting for the transaction confirmation..." /></JoyInfo>
+    return <JoyInfo title='Please wait...'><Loading text='Waiting for the transaction confirmation...' /></JoyInfo>;
   }
 
   private renderDiscovering () {
@@ -152,6 +155,7 @@ class Upload extends React.PureComponent<Props, State> {
     const success = !error && progress >= 100;
 
     let label = '';
+
     if (active) {
       label = 'Your file is uploading. Please keep this page open until it\'s done.';
     } else if (success) {
@@ -175,7 +179,7 @@ class Upload extends React.PureComponent<Props, State> {
 
     return <div className='UploadSelectForm'>
       <InputFileAsync
-        label=""
+        label=''
         withLabel={false}
         className={`UploadInputFile ${file_name ? 'FileSelected' : ''}`}
         placeholder={
@@ -203,7 +207,7 @@ class Upload extends React.PureComponent<Props, State> {
             sendTx();
           }}
           txSuccessCb={ this.onDataObjectCreated }
-          txFailedCb={() => { this.setState({ sendingTx: false }) }}
+          txFailedCb={() => { this.setState({ sendingTx: false }); }}
         />
       </div>}
     </div>;
@@ -258,11 +262,13 @@ class Upload extends React.PureComponent<Props, State> {
 
   private buildTxParams = () => {
     const { file, newContentId, ipfs_cid } = this.state;
+
     if (!file || !ipfs_cid) return [];
 
     // TODO get corresponding data type id based on file content
     const dataObjectTypeId = new BN(1);
     const { myMemberId } = this.props;
+
     return [myMemberId, newContentId, dataObjectTypeId, new BN(file.size), ipfs_cid];
   }
 
@@ -272,6 +278,7 @@ class Upload extends React.PureComponent<Props, State> {
     const { api } = this.props;
     const { newContentId } = this.state;
     let dataObject: Option<DataObject>;
+
     try {
       dataObject = await api.query.dataDirectory.dataObjectByContentId(newContentId) as Option<DataObject>;
     } catch (err) {
@@ -279,6 +286,7 @@ class Upload extends React.PureComponent<Props, State> {
         error: err,
         discovering: false
       });
+
       return;
     }
 
@@ -290,6 +298,7 @@ class Upload extends React.PureComponent<Props, State> {
 
     if (dataObject.isSome) {
       const storageProvider = dataObject.unwrap().liaison;
+
       this.uploadFileTo(storageProvider);
     } else {
       this.setState({
@@ -301,11 +310,13 @@ class Upload extends React.PureComponent<Props, State> {
 
   private uploadFileTo = async (storageProvider: StorageProviderId) => {
     const { file, newContentId, cancelSource } = this.state;
+
     if (!file || !file.size) {
       this.setState({
         error: new Error('No file to upload!'),
         discovering: false
       });
+
       return;
     }
 
@@ -320,6 +331,7 @@ class Upload extends React.PureComponent<Props, State> {
       cancelToken: cancelSource.token,
       onUploadProgress: (progressEvent: any) => {
         const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
+
         this.setState({
           progress: percentCompleted
         });
@@ -328,6 +340,7 @@ class Upload extends React.PureComponent<Props, State> {
 
     const { discoveryProvider } = this.props;
     let url: string;
+
     try {
       url = await discoveryProvider.resolveAssetEndpoint(storageProvider, contentId, cancelSource.token);
     } catch (err) {
@@ -351,9 +364,11 @@ class Upload extends React.PureComponent<Props, State> {
       await axios.put<{ message: string }>(url, file, config);
     } catch (err) {
       this.setState({ progress: 0, error: err, uploading: false });
+
       if (axios.isCancel(err)) {
         return;
       }
+
       if (!err.response || (err.response.status >= 500 && err.response.status <= 504)) {
         // network connection error
         discoveryProvider.reportUnreachable(storageProvider);

+ 1 - 0
pioneer/packages/joy-media/src/channels/ChannelAvatarAndName.tsx

@@ -9,6 +9,7 @@ type Props = {
 
 export const ChannelAvatarAndName = (props: Props) => {
   const { channel } = props;
+
   return (
     <div className={'ChannelPreview small'}>
       <ChannelAvatar channel={channel} size='small' />

+ 1 - 1
pioneer/packages/joy-media/src/channels/ChannelHelpers.ts

@@ -4,7 +4,7 @@ import { ChannelPublicationStatusAllValues } from '@joystream/types/content-work
 
 export const ChannelPublicationStatusDropdownOptions =
   ChannelPublicationStatusAllValues
-    .map(x => ({ key: x, value: x, text: x }));
+    .map((x) => ({ key: x, value: x, text: x }));
 
 export const isVideoChannel = (channel: ChannelType) => {
   return channel.content === 'Video';

+ 1 - 0
pioneer/packages/joy-media/src/channels/ChannelNameAsLink.tsx

@@ -10,6 +10,7 @@ type Props = {
 
 export const ChannelNameAsLink = (props: Props) => {
   const { channel, className, style } = props;
+
   return (
     <Link to={`/media/channels/${channel.id}`} className={className} style={style}>
       {channel.title || channel.handle}

+ 1 - 0
pioneer/packages/joy-media/src/channels/ChannelPreviewStats.tsx

@@ -13,6 +13,7 @@ export const ChannelPreviewStats = (props: Props) => {
   const statSize = 'tiny';
 
   let itemsPublishedLabel = '';
+
   if (channel.content === 'Video') {
     itemsPublishedLabel = 'Videos';
   } else if (channel.content === 'Music') {

+ 3 - 1
pioneer/packages/joy-media/src/channels/ChannelsByOwner.tsx

@@ -19,7 +19,8 @@ const TabsAndChannels = (props: ChannelsByOwnerProps) => {
 
   let videoChannelsCount = 0;
   let musicChannelsCount = 0;
-  allChannels.forEach(x => {
+
+  allChannels.forEach((x) => {
     if (x.content === 'Video') {
       videoChannelsCount++;
     } else if (x.content === 'Music') {
@@ -38,6 +39,7 @@ const TabsAndChannels = (props: ChannelsByOwnerProps) => {
 
   const switchTab = (activeIndex: number) => {
     const activeContentType = contentTypeByTabIndex[activeIndex];
+
     if (activeContentType === undefined) {
       setChannels(allChannels);
     } else {

+ 1 - 0
pioneer/packages/joy-media/src/channels/ChannelsByOwner.view.tsx

@@ -13,6 +13,7 @@ export const ChannelsByOwnerView = MediaView<Props>({
   resolveProps: async (props) => {
     const { transport, accountId } = props;
     const channels = await transport.channelsByAccount(accountId);
+
     return { channels };
   }
 });

+ 4 - 3
pioneer/packages/joy-media/src/channels/EditChannel.tsx

@@ -4,7 +4,7 @@ import { Form, withFormik } from 'formik';
 import { History } from 'history';
 
 import { Option } from '@polkadot/types';
-import { TxButton } from '@polkadot/joy-utils/react/components';
+import { TxButton, JoyError, Section } from '@polkadot/joy-utils/react/components';
 import { onImageError } from '../common/images';
 import { withMediaForm, MediaFormProps } from '../common/MediaForms';
 import { ChannelType, ChannelClass as Fields, buildChannelValidationSchema, ChannelFormValues, ChannelToFormValues, ChannelGenericProp } from '../schemas/channel/Channel';
@@ -16,8 +16,7 @@ import { ChannelPublicationStatusDropdownOptions, isAccountAChannelOwner } from
 import { TxCallback } from '@polkadot/react-components/Status/types';
 import { SubmittableResult } from '@polkadot/api';
 import { ChannelValidationConstraints } from '../transport';
-import { JoyError } from '@polkadot/joy-utils/react/components';
-import { Section } from '@polkadot/joy-utils/react/components';
+
 import { useApi } from '@polkadot/react-hooks';
 
 export type OuterProps = {
@@ -200,11 +199,13 @@ export const EditForm = withFormik<OuterProps, FormValues>({
   // Transform outer props into form values
   mapPropsToValues: (props): FormValues => {
     const { entity } = props;
+
     return ChannelToFormValues(entity);
   },
 
   validationSchema: (props: OuterProps): any => {
     const { constraints } = props;
+
     if (!constraints) return null;
 
     return buildChannelValidationSchema(constraints);

+ 1 - 0
pioneer/packages/joy-media/src/channels/EditChannel.view.tsx

@@ -15,6 +15,7 @@ export const EditChannelView = MediaView<Props>({
     const { transport, id } = props;
     const entity = id && await transport.channelById(id);
     const constraints = await transport.channelValidationConstraints();
+
     return { entity, constraints };
   }
 });

+ 1 - 0
pioneer/packages/joy-media/src/channels/ViewChannel.tsx

@@ -31,6 +31,7 @@ export function ViewChannel (props: ViewChannelProps) {
 
   if (isVideoChannel(channel)) {
     const previews = toVideoPreviews(videos);
+
     return <ViewVideoChannel channel={channel} videos={previews} />;
   } else if (isMusicChannel(channel)) {
     return <ViewMusicChannel channel={channel} albums={albums} tracks={tracks} />;

+ 1 - 0
pioneer/packages/joy-media/src/channels/ViewChannel.view.tsx

@@ -14,6 +14,7 @@ export const ViewChannelView = MediaView<Props>({
     const { transport, id } = props;
     const channel = await transport.channelById(id);
     const videos = await transport.videosByChannelId(id);
+
     return { channel, videos };
   }
 });

+ 2 - 2
pioneer/packages/joy-media/src/channels/ViewMusicChannel.tsx

@@ -27,7 +27,7 @@ export function ViewMusicChannel (props: Props) {
     !albums.length
       ? <NoAlbums />
       : <Section title={'Music albums'}>
-        {albums.map(x => <MusicAlbumPreview key={x.id} {...x} />)}
+        {albums.map((x) => <MusicAlbumPreview key={x.id} {...x} />)}
       </Section>
   );
 
@@ -35,7 +35,7 @@ export function ViewMusicChannel (props: Props) {
     !tracks.length
       ? <NoTracks />
       : <Section title={'Music tracks'}>
-        {tracks.map(x => <MusicTrackReaderPreview key={x.id} {...x} />)}
+        {tracks.map((x) => <MusicTrackReaderPreview key={x.id} {...x} />)}
       </Section>
   );
 

+ 4 - 2
pioneer/packages/joy-media/src/common/FormTabs.tsx

@@ -20,7 +20,7 @@ export function FormTabs <FormValues> (props: FormTabsProps<FormValues>) {
 
   return <Tab
     menu={{ secondary: true, pointing: true, color: 'blue' }}
-    panes={panes.map(tab => {
+    panes={panes.map((tab) => {
       const {
         id,
         fields = [],
@@ -29,8 +29,10 @@ export function FormTabs <FormValues> (props: FormTabsProps<FormValues>) {
       } = tab;
 
       const tabErrors: any[] = [];
-      fields.forEach(f => {
+
+      fields.forEach((f) => {
         const err = errors[f.id];
+
         if (err) {
           tabErrors.push(err);
         }

+ 2 - 2
pioneer/packages/joy-media/src/common/MediaDropdownOptions.tsx

@@ -5,10 +5,10 @@ import { TextValueEntity } from '@joystream/types/versioned-store/EntityCodec';
 import { InternalEntities } from '../transport';
 
 const buildOptions = (entities: TextValueEntity[]): DropdownItemProps[] =>
-  entities.map(x => ({ key: x.id, value: x.id, text: x.value }));
+  entities.map((x) => ({ key: x.id, value: x.id, text: x.value }));
 
 const buildLanguageOptions = (entities: LanguageType[]): DropdownItemProps[] =>
-  entities.map(x => ({ key: x.id, value: x.id, text: ISO6391.getName(x.value) }));
+  entities.map((x) => ({ key: x.id, value: x.id, text: ISO6391.getName(x.value) }));
 
 export class MediaDropdownOptions {
   public languageOptions: DropdownItemProps[]

+ 5 - 0
pioneer/packages/joy-media/src/common/MediaForms.tsx

@@ -78,6 +78,7 @@ export function withMediaForm<OuterProps, FormValues>
 
   function MediaText (props: MediaTextProps<OuterProps, FormValues>) {
     const { field: f } = props;
+
     return !f ? null : <LabelledText name={f.id} label={f.name} tooltip={f.description} required={f.required} {...props} />;
   }
 
@@ -138,6 +139,7 @@ export function withMediaForm<OuterProps, FormValues>
 
       const isFieldChanged = (field: FieldName | FieldObject): boolean => {
         const fieldName = typeof field === 'string' ? field : (field as FieldObject).id;
+
         return (
           dirty &&
           touched[fieldName] === true &&
@@ -159,6 +161,7 @@ export function withMediaForm<OuterProps, FormValues>
 
       const onTxFailed: TxFailedCallback = (txResult: SubmittableResult | null) => {
         setSubmitting(false);
+
         if (txResult === null) {
           // Tx cancelled
 
@@ -187,6 +190,8 @@ export function withMediaForm<OuterProps, FormValues>
 
       return <Component {...allProps} />;
     };
+
   ResultComponent.displayName = `withMediaForm(${componentName(Component)})`;
+
   return ResultComponent;
 }

+ 3 - 0
pioneer/packages/joy-media/src/common/MediaPlayerView.tsx

@@ -78,6 +78,7 @@ function Player (props: PlayerProps) {
 
   if (prefix === 'video') {
     const video = { url, name, pic: cover };
+
     return <DPlayer
       video={video}
       {...PLAYER_COMMON_PARAMS}
@@ -86,6 +87,7 @@ function Player (props: PlayerProps) {
     />;
   } else if (prefix === 'audio') {
     const audio = { url, name, cover };
+
     return <APlayer
       audio={audio}
       {...PLAYER_COMMON_PARAMS}
@@ -101,6 +103,7 @@ function InnerComponent (props: MediaPlayerViewProps) {
   const { video, resolvedAssetUrl: url } = props;
 
   const { dataObjectOpt, channel } = props;
+
   if (!dataObjectOpt || dataObjectOpt.isNone) {
     return null;
   }

+ 10 - 5
pioneer/packages/joy-media/src/common/MediaPlayerWithResolver.tsx

@@ -39,22 +39,24 @@ function InnerComponent (props: Props) {
     const allRelationships: Option<DataObjectStorageRelationship>[] = await Promise.all(rids.map((id) => api.query.dataObjectStorageRegistry.relationships(id))) as any;
 
     // Providers that have signalled onchain that they have the asset
-    let readyProviders = allRelationships.filter(r => r.isSome).map(r => r.unwrap())
-      .filter(r => r.ready)
-      .map(r => r.storage_provider);
+    let readyProviders = allRelationships.filter((r) => r.isSome).map((r) => r.unwrap())
+      .filter((r) => r.ready)
+      .map((r) => r.storage_provider);
 
     // runtime doesn't currently guarantee unique set
-    readyProviders = _.uniqBy(readyProviders, provider => provider.toString());
+    readyProviders = _.uniqBy(readyProviders, (provider) => provider.toString());
 
     if (!readyProviders.length) {
       setError(new Error('No Storage Providers found storing this content'));
+
       return;
     }
 
     const activeProviders = (await transport.workingGroups.allWorkers('Storage')).map(([id]) => id);
+
     // filter out providers no longer active - relationships of providers that have left
     // are not pruned onchain.
-    readyProviders = _.intersectionBy(activeProviders, readyProviders, provider => provider.toString());
+    readyProviders = _.intersectionBy(activeProviders, readyProviders, (provider) => provider.toString());
 
     console.log(`Found ${readyProviders.length} providers ready to serve content: ${readyProviders}`);
 
@@ -67,9 +69,11 @@ function InnerComponent (props: Props) {
     // loop over providers until we find one that responds
     while (readyProviders.length) {
       const provider = readyProviders.shift();
+
       if (!provider) continue;
 
       let assetUrl: string | undefined;
+
       try {
         assetUrl = await discoveryProvider.resolveAssetEndpoint(provider, contentId.encode(), cancelSource.token);
       } catch (err) {
@@ -132,6 +136,7 @@ function InnerComponent (props: Props) {
   }
 
   const playerProps = { ...props, contentType, resolvedAssetUrl };
+
   return <MediaPlayerView {...playerProps} />;
 }
 

+ 1 - 0
pioneer/packages/joy-media/src/common/images.tsx

@@ -10,6 +10,7 @@ type ImageOnErrorEvent = EventTarget & {
 
 export function onImageError (event: React.SyntheticEvent<HTMLImageElement, Event>) {
   const target = event.target as ImageOnErrorEvent;
+
   // Set onerror callback to undefined to prevent infinite callbacks when image src path fails:
   target.onerror = undefined;
   target.src = DEFAULT_THUMBNAIL_URL;

+ 1 - 1
pioneer/packages/joy-media/src/explore/PlayContent.tsx

@@ -85,7 +85,7 @@ export function PlayContent (props: Props) {
     {featuredAlbums.length > 0 &&
       <div className='JoyPlayAlbum_RightSidePanel'>
         <h3>Featured albums</h3>
-        {featuredAlbums.map(x => <MusicAlbumPreview key={x.id} {...x} size={170} />)}
+        {featuredAlbums.map((x) => <MusicAlbumPreview key={x.id} {...x} size={170} />)}
       </div>
     }
   </div>;

+ 1 - 1
pioneer/packages/joy-media/src/index.tsx

@@ -46,7 +46,7 @@ function App (props: Props) {
     //   name: `account/${myAddress}/videos`,
     //   text: t('My videos')
     // }
-  ].filter(x => x !== undefined) as TabItem[];
+  ].filter((x) => x !== undefined) as TabItem[];
 
   return (
     <SubstrateTransportProvider>

+ 1 - 1
pioneer/packages/joy-media/src/mocks/ContentLicense.mock.ts

@@ -9,6 +9,6 @@ const values = [
 ];
 
 export const AllContentLicenses: ContentLicenseType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as ContentLicenseType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as ContentLicenseType[]; // A hack to fix TS compilation.
 
 export const ContentLicense = AllContentLicenses[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/Language.mock.ts

@@ -6,6 +6,6 @@ const values = [
 ];
 
 export const AllLanguages: LanguageType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as LanguageType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as LanguageType[]; // A hack to fix TS compilation.
 
 export const Language = AllLanguages[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/MediaObject.mock.ts

@@ -12,6 +12,6 @@ const values = [
 ];
 
 export const AllMediaObjects: MediaObjectType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as MediaObjectType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as MediaObjectType[]; // A hack to fix TS compilation.
 
 export const MediaObject = AllMediaObjects[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/MusicGenre.mock.ts

@@ -26,6 +26,6 @@ const values = [
 ];
 
 export const AllMusicGenres: MusicGenreType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as MusicGenreType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as MusicGenreType[]; // A hack to fix TS compilation.
 
 export const MusicGenre = AllMusicGenres[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/MusicMood.mock.ts

@@ -294,6 +294,6 @@ const values = [
 ];
 
 export const AllMusicMoods: MusicMoodType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as MusicMoodType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as MusicMoodType[]; // A hack to fix TS compilation.
 
 export const MusicMood = AllMusicMoods[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/MusicTheme.mock.ts

@@ -187,6 +187,6 @@ const values = [
 ];
 
 export const AllMusicThemes: MusicThemeType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as MusicThemeType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as MusicThemeType[]; // A hack to fix TS compilation.
 
 export const MusicTheme = AllMusicThemes[0];

+ 1 - 1
pioneer/packages/joy-media/src/mocks/VideoCategory.mock.ts

@@ -20,6 +20,6 @@ const values = [
 ];
 
 export const AllVideoCategories: VideoCategoryType[] =
-  values.map(value => ({ id: newEntityId(), value })) as unknown as VideoCategoryType[]; // A hack to fix TS compilation.
+  values.map((value) => ({ id: newEntityId(), value })) as unknown as VideoCategoryType[]; // A hack to fix TS compilation.
 
 export const VideoCategory = AllVideoCategories[0];

+ 1 - 0
pioneer/packages/joy-media/src/music/EditMusicAlbum.tsx

@@ -166,6 +166,7 @@ export const EditForm = withFormik<OuterProps, FormValues>({
   // Transform outer props into form values
   mapPropsToValues: (props): FormValues => {
     const { entity } = props;
+
     return MusicAlbumToFormValues(entity);
   },
 

+ 1 - 0
pioneer/packages/joy-media/src/music/EditMusicAlbum.view.tsx

@@ -8,6 +8,7 @@ export const EditMusicAlbumView = MediaView<OuterProps>({
     const { transport, id } = props;
     const entity = id ? await transport.musicAlbumById(id) : undefined;
     const opts = await transport.dropdownOptions();
+
     return { entity, opts };
   }
 });

+ 1 - 0
pioneer/packages/joy-media/src/music/MusicAlbumTracks.tsx

@@ -21,6 +21,7 @@ export function TracksOfMyMusicAlbum (props: TracksOfMyMusicAlbumProps) {
     data: CheckboxProps
   ) => {
     const set = new Set(idxsOfSelectedTracks);
+
     data.checked
       ? set.add(trackIdx)
       : set.delete(trackIdx)

+ 1 - 0
pioneer/packages/joy-media/src/music/MusicTrackPreview.tsx

@@ -35,6 +35,7 @@ export function MusicTrackPreview (props: EditableMusicTrackPreviewProps) {
     } catch (err) {
       console.log('Error during checkbox change:', err);
     }
+
     setChecked(d.checked || false);
   };
 

+ 1 - 0
pioneer/packages/joy-media/src/music/MusicTrackReaderPreview.tsx

@@ -14,6 +14,7 @@ export function MusicTrackReaderPreview (props: MusicTrackReaderPreviewProps) {
   const { size = 200, orientation = 'vertical' } = props;
 
   const descStyle: CSSProperties = {};
+
   if (orientation === 'vertical') {
     descStyle.maxWidth = size;
   }

+ 11 - 7
pioneer/packages/joy-media/src/music/MyMusicTracks.tsx

@@ -1,8 +1,8 @@
 import React, { useState } from 'react';
 import { Button, CheckboxProps, Dropdown, Message } from 'semantic-ui-react';
 
-import { Pluralize } from '@polkadot/joy-utils/react/components';
-import { Section } from '@polkadot/joy-utils/react/components';
+import { Pluralize, Section } from '@polkadot/joy-utils/react/components';
+
 import { EditableMusicTrackPreviewProps, MusicTrackPreview } from './MusicTrackPreview';
 import { ReorderableTracks } from './ReorderableTracks';
 import { MusicAlbumPreviewProps } from './MusicAlbumPreview';
@@ -36,14 +36,16 @@ export function MyMusicTracks (props: MyMusicTracksProps) {
   const selectedCount = idsOfSelectedTracks.size;
 
   let longestAlbumName = '';
-  albums.forEach(x => {
+
+  albums.forEach((x) => {
     if (longestAlbumName.length < x.title.length) {
       longestAlbumName = x.title;
     }
   });
 
-  const albumsDropdownOptions = albums.map(x => {
+  const albumsDropdownOptions = albums.map((x) => {
     const { id } = x;
+
     return {
       key: id,
       value: id,
@@ -67,7 +69,8 @@ export function MyMusicTracks (props: MyMusicTracksProps) {
     return <div style={style}>
       <Dropdown
         onChange={(_e, { value: id }) => {
-          const selectedAlbum = albums.find(x => x.id === id);
+          const selectedAlbum = albums.find((x) => x.id === id);
+
           if (selectedAlbum) {
             setAlbumName(selectedAlbum.title);
             setShowSecondScreen(true);
@@ -125,7 +128,7 @@ export function MyMusicTracks (props: MyMusicTracksProps) {
     </Section>;
   };
 
-  const selectedTracks = tracks.filter(track => idsOfSelectedTracks.has(track.id));
+  const selectedTracks = tracks.filter((track) => idsOfSelectedTracks.has(track.id));
 
   const renderReorderTracks = () => {
     return <Section title={`Add tracks to album "${albumName}"`}>
@@ -138,8 +141,9 @@ export function MyMusicTracks (props: MyMusicTracksProps) {
 
       <ReorderableTracks
         tracks={selectedTracks}
-        onRemove={track => {
+        onRemove={(track) => {
           const set = new Set(idsOfSelectedTracks);
+
           set.delete(track.id);
           setIdsOfSelectedTracks(set);
         }}

+ 3 - 1
pioneer/packages/joy-media/src/music/ReorderableTracks.tsx

@@ -6,6 +6,7 @@ import { EditableMusicTrackPreviewProps, MusicTrackPreview } from './MusicTrackP
 const reorder = (list: OrderableItem[], startIndex: number, endIndex: number) => {
   const result = Array.from(list);
   const [removed] = result.splice(startIndex, 1);
+
   result.splice(endIndex, 0, removed);
 
   return result;
@@ -72,7 +73,8 @@ export const ReorderableTracks = (props: Props) => {
                       withRemoveButton
                       onRemove={() => {
                         onRemove(item);
-                        const lessItems = items.filter(x => x.id !== item.id);
+                        const lessItems = items.filter((x) => x.id !== item.id);
+
                         setItems(lessItems);
                       }}
                     />

+ 2 - 0
pioneer/packages/joy-media/src/schemas/channel/Channel.ts

@@ -12,10 +12,12 @@ function textValidation (constraint?: ValidationConstraint) {
   }
 
   const { min, max } = constraint;
+
   return Yup.string()
     .min(min, `Text is too short. Minimum length is ${min} chars.`)
     .max(max, `Text is too long. Maximum length is ${max} chars.`);
 }
+
 export const buildChannelValidationSchema = (constraints?: ChannelValidationConstraints) =>
   Yup.object().shape({
     handle: textValidation(constraints?.handle).required('This field is required'),

+ 2 - 2
pioneer/packages/joy-media/src/schemas/general/FeaturedContent.ts

@@ -30,8 +30,8 @@ export class FeaturedContentCodec extends EntityCodec<FeaturedContentType> { }
 export function FeaturedContentToFormValues (entity?: FeaturedContentType): FeaturedContentFormValues {
   return {
     topVideo: (entity && entity.topVideo?.id) || 0,
-    featuredVideos: (entity && entity.featuredVideos?.map(x => x.id)) || [],
-    featuredAlbums: (entity && entity.featuredAlbums?.map(x => x.id)) || []
+    featuredVideos: (entity && entity.featuredVideos?.map((x) => x.id)) || [],
+    featuredAlbums: (entity && entity.featuredAlbums?.map((x) => x.id)) || []
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/music/MusicAlbum.ts

@@ -102,7 +102,7 @@ export function MusicAlbumToFormValues (entity?: MusicAlbumType): MusicAlbumForm
     genre: (entity && entity.genre?.id) || 0,
     mood: (entity && entity.mood?.id) || 0,
     theme: (entity && entity.theme?.id) || 0,
-    tracks: (entity && entity.tracks?.map(x => x.id)) || [],
+    tracks: (entity && entity.tracks?.map((x) => x.id)) || [],
     language: (entity && entity.language?.id) || 0,
     links: (entity && entity.links) || [],
     lyrics: (entity && entity.lyrics) || '',

+ 22 - 4
pioneer/packages/joy-media/src/transport.substrate.ts

@@ -124,9 +124,11 @@ export class SubstrateTransport extends MediaTransport {
 
   async allChannelIds (): Promise<ChannelId[]> {
     let nextId = (await this.nextChannelId()).toNumber();
+
     if (nextId < 1) nextId = 1;
 
     const allIds: ChannelId[] = [];
+
     for (let id = FIRST_CHANNEL_ID; id < nextId; id++) {
       allIds.push(this.api.createType('ChannelId', id));
     }
@@ -151,11 +153,13 @@ export class SubstrateTransport extends MediaTransport {
 
   async allChannels (): Promise<ChannelEntity[]> {
     const ids = await this.allChannelIds();
+
     return await this.channelCache.getOrLoadByIds(ids);
   }
 
   protected async getValidationConstraint (constraintName: string): Promise<ValidationConstraint> {
     const constraint = await this.cwgQuery()[constraintName]<InputValidationLengthConstraint>();
+
     return {
       min: constraint.min.toNumber(),
       max: constraint.max.toNumber()
@@ -176,6 +180,7 @@ export class SubstrateTransport extends MediaTransport {
       this.getValidationConstraint('channelAvatarConstraint'),
       this.getValidationConstraint('channelBannerConstraint')
     ]);
+
     return {
       handle,
       title,
@@ -196,6 +201,7 @@ export class SubstrateTransport extends MediaTransport {
     const nextId = (await this.nextClassId()).toNumber();
 
     const allIds: ClassId[] = [];
+
     for (let id = FIRST_CLASS_ID; id < nextId; id++) {
       allIds.push(this.api.createType('ClassId', id));
     }
@@ -209,25 +215,30 @@ export class SubstrateTransport extends MediaTransport {
 
   async allClasses (): Promise<Class[]> {
     const ids = await this.allClassIds();
+
     return await this.classCache.getOrLoadByIds(ids);
   }
 
   async getEntityCodecResolver (): Promise<EntityCodecResolver> {
     if (!this.entityCodecResolver) {
       const classes = await this.allClasses();
+
       this.entityCodecResolver = new EntityCodecResolver(classes);
     }
+
     return this.entityCodecResolver;
   }
 
   async classNamesToIdSet (classNames: ClassName[]): Promise<Set<string>> {
     const classNameToIdMap = await this.classIdByNameMap();
+
     return new Set(classNames
-      .map(name => {
+      .map((name) => {
         const classId = classNameToIdMap[name];
+
         return classId ? classId.toString() : undefined;
       })
-      .filter(classId => typeof classId !== 'undefined') as string[]
+      .filter((classId) => typeof classId !== 'undefined') as string[]
     );
   }
 
@@ -242,6 +253,7 @@ export class SubstrateTransport extends MediaTransport {
     const nextId = (await this.nextEntityId()).toNumber();
 
     const allIds: EntityId[] = [];
+
     for (let id = FIRST_ENTITY_ID; id < nextId; id++) {
       allIds.push(this.api.createType('EntityId', id));
     }
@@ -259,7 +271,8 @@ export class SubstrateTransport extends MediaTransport {
   private async loadPlainEntitiesByIds (ids: AnyEntityId[]): Promise<PlainEntity[]> {
     const entities = await this.loadEntitiesByIds(ids);
     const cacheClassIds = await this.classNamesToIdSet(ClassNamesThatCanBeCached);
-    entities.forEach(e => {
+
+    entities.forEach((e) => {
       if (cacheClassIds.has(e.class_id.toString())) {
         this.idsOfEntitiesToKeepInCache.add(e.id.toString());
       }
@@ -274,20 +287,23 @@ export class SubstrateTransport extends MediaTransport {
 
   async allPlainEntities (): Promise<PlainEntity[]> {
     const ids = await this.allEntityIds();
+
     return await this.entityCache.getOrLoadByIds(ids);
   }
 
   async findPlainEntitiesByClassName<T extends PlainEntity> (className: ClassName): Promise<T[]> {
     const res: T[] = [];
     const clazz = await this.classByName(className);
+
     if (!clazz) {
       console.warn(`No class found by name '${className}'`);
+
       return res;
     }
 
     const allIds = await this.allEntityIds();
     const filteredEntities = (await this.entityCache.getOrLoadByIds(allIds))
-      .filter(entity => clazz.id.eq(entity.classId)) as T[];
+      .filter((entity) => clazz.id.eq(entity.classId)) as T[];
 
     console.log(`Found ${filteredEntities.length} plain entities by class name '${className}'`);
 
@@ -302,6 +318,7 @@ export class SubstrateTransport extends MediaTransport {
     const loadableClassIds = await this.classNamesToIdSet(ClassNamesThatRequireLoadingInternals);
 
     const converted: PlainEntity[] = [];
+
     for (const entity of entities) {
       const classIdStr = entity.class_id.toString();
       const codec = entityCodecResolver.getCodecByClassId(entity.class_id);
@@ -334,6 +351,7 @@ export class SubstrateTransport extends MediaTransport {
 
   async featuredContent (): Promise<FeaturedContentType | undefined> {
     const arr = await this.findPlainEntitiesByClassName('FeaturedContent');
+
     return arr && arr.length ? arr[0] : undefined;
   }
 

+ 29 - 17
pioneer/packages/joy-media/src/transport.ts

@@ -57,6 +57,7 @@ export const EntityCodecByClassNameMap = {
 
 function insensitiveEq (text1: string, text2: string): boolean {
   const prepare = (txt: string) => txt.replace(/[\s]+/mg, '').toLowerCase();
+
   return prepare(text1) === prepare(text2);
 }
 
@@ -83,9 +84,12 @@ export abstract class MediaTransport {
     if (typeof operation !== 'function') {
       throw new Error('Operation is not a function');
     }
+
     this.openSession();
     const res = await operation();
+
     this.closeSession();
+
     return res;
   }
 
@@ -93,12 +97,12 @@ export abstract class MediaTransport {
 
   async channelById (id: ChannelId): Promise<ChannelEntity | undefined> {
     return (await this.allChannels())
-      .find(x => id && id.eq(x.id));
+      .find((x) => id && id.eq(x.id));
   }
 
   async channelsByAccount (accountId: AccountId): Promise<ChannelEntity[]> {
     return (await this.allChannels())
-      .filter(x => accountId && accountId.eq(x.roleAccount));
+      .filter((x) => accountId && accountId.eq(x.roleAccount));
   }
 
   abstract channelValidationConstraints(): Promise<ChannelValidationConstraints>
@@ -114,12 +118,15 @@ export abstract class MediaTransport {
     if (!this.cachedClassIdByNameMap) {
       const map: ClassIdByNameMap = {};
       const classes = await this.allClasses();
+
       classes.forEach((c) => {
         const className = unifyClassName(c.name);
+
         map[className] = c.id;
       });
       this.cachedClassIdByNameMap = map;
     }
+
     return this.cachedClassIdByNameMap;
   }
 
@@ -128,6 +135,7 @@ export abstract class MediaTransport {
   async topVideo (): Promise<VideoType | undefined> {
     const content = await this.featuredContent();
     const topVideoId = content?.topVideo as unknown as number | undefined;
+
     return !topVideoId ? undefined : await this.videoById(createMock('EntityId', topVideoId));
   }
 
@@ -136,7 +144,8 @@ export abstract class MediaTransport {
     const videoIds = (content?.featuredVideos || []) as unknown as number[];
     const videos = await Promise.all(videoIds.map((id) =>
       this.videoById(createMock('EntityId', id))));
-    return videos.filter(x => x !== undefined) as VideoType[];
+
+    return videos.filter((x) => x !== undefined) as VideoType[];
   }
 
   async featuredAlbums (): Promise<MusicAlbumType[]> {
@@ -144,7 +153,8 @@ export abstract class MediaTransport {
     const albumIds = (content?.featuredAlbums || []) as unknown as EntityId[];
     const albums = await Promise.all(albumIds.map((id) =>
       this.musicAlbumById(createMock('EntityId', id))));
-    return albums.filter(x => x !== undefined) as MusicAlbumType[];
+
+    return albums.filter((x) => x !== undefined) as MusicAlbumType[];
   }
 
   abstract allMediaObjects(): Promise<MediaObjectType[]>
@@ -157,8 +167,8 @@ export abstract class MediaTransport {
 
   async videosByChannelId (channelId: ChannelId, limit?: number, additionalFilter?: (x: VideoType) => boolean): Promise<VideoType[]> {
     let videos = (await this.allVideos())
-      .filter(x => channelId && channelId.eq(x.channelId) && (additionalFilter || (() => true))(x))
-      .sort(x => -1 * x.id);
+      .filter((x) => channelId && channelId.eq(x.channelId) && (additionalFilter || (() => true))(x))
+      .sort((x) => -1 * x.id);
 
     if (limit && limit > 0) {
       videos = videos.slice(0, limit);
@@ -169,30 +179,30 @@ export abstract class MediaTransport {
 
   async videosByAccount (accountId: AccountId): Promise<VideoType[]> {
     const accountChannels = await this.channelsByAccount(accountId);
-    const accountChannelIds = new Set(accountChannels.map(x => x.id));
+    const accountChannelIds = new Set(accountChannels.map((x) => x.id));
 
     return (await this.allVideos())
-      .filter(x => x.channelId && accountChannelIds.has(x.channelId));
+      .filter((x) => x.channelId && accountChannelIds.has(x.channelId));
   }
 
   async mediaObjectById (id: EntityId): Promise<MediaObjectType | undefined> {
     return (await this.allMediaObjects())
-      .find(x => id && id.eq(x.id));
+      .find((x) => id && id.eq(x.id));
   }
 
   async videoById (id: EntityId): Promise<VideoType | undefined> {
     return (await this.allVideos())
-      .find(x => id && id.eq(x.id));
+      .find((x) => id && id.eq(x.id));
   }
 
   async musicTrackById (id: EntityId): Promise<MusicTrackType | undefined> {
     return (await this.allMusicTracks())
-      .find(x => id && id.eq(x.id));
+      .find((x) => id && id.eq(x.id));
   }
 
   async musicAlbumById (id: EntityId): Promise<MusicAlbumType | undefined> {
     return (await this.allMusicAlbums())
-      .find(x => id && id.eq(x.id));
+      .find((x) => id && id.eq(x.id));
   }
 
   async allPublicChannels (): Promise<ChannelEntity[]> {
@@ -208,7 +218,7 @@ export abstract class MediaTransport {
   async allPublicVideoChannels (): Promise<ChannelEntity[]> {
     return (await this.allVideoChannels())
       .filter(isPublicChannel)
-      .sort(x => -1 * x.id);
+      .sort((x) => -1 * x.id);
   }
 
   async latestPublicVideoChannels (limit = 6): Promise<ChannelEntity[]> {
@@ -217,26 +227,27 @@ export abstract class MediaTransport {
 
   async allPublicVideos (): Promise<VideoType[]> {
     const idOfPublicPS = (await this.allPublicationStatuses())
-      .find(x =>
+      .find((x) =>
         insensitiveEq(x.value, 'Public')
       )?.id;
 
     const idsOfCuratedCS = (await this.allCurationStatuses())
-      .filter(x =>
+      .filter((x) =>
         insensitiveEq(x.value, 'Under review') ||
         insensitiveEq(x.value, 'Removed')
-      ).map(x => x.id);
+      ).map((x) => x.id);
 
     const isPublicAndNotCurated = (video: VideoType) => {
       const isPublic = video.publicationStatus.id === idOfPublicPS;
       const isNotCurated = !idsOfCuratedCS.includes(video.curationStatus?.id || -1);
       const isPubChannel = video.channel ? isPublicChannel(video.channel) : true;
+
       return isPublic && isNotCurated && isPubChannel;
     };
 
     return (await this.allVideos())
       .filter(isPublicAndNotCurated)
-      .sort(x => -1 * x.id);
+      .sort((x) => -1 * x.id);
   }
 
   async latestPublicVideos (limit = 12): Promise<VideoType[]> {
@@ -285,6 +296,7 @@ export abstract class MediaTransport {
     const res = new MediaDropdownOptions(
       await this.allInternalEntities()
     );
+
     // console.log('Transport.dropdownOptions', res)
     return res;
   }

+ 1 - 0
pioneer/packages/joy-media/src/upload/EditVideo.view.tsx

@@ -18,6 +18,7 @@ export const EditVideoView = MediaView<Props>({
     const entityClass = await transport.videoClass();
     const entity = id && await transport.videoById(id);
     const opts = await transport.dropdownOptions();
+
     return { channel, mediaObjectClass, entityClass, entity, opts };
   }
 });

+ 2 - 0
pioneer/packages/joy-media/src/upload/UploadAudio.tsx

@@ -157,9 +157,11 @@ export const EditForm = withFormik<OuterProps, FormValues>({
   mapPropsToValues: (props): FormValues => {
     const { entity, fileName } = props;
     const res = MusicTrackToFormValues(entity);
+
     if (!res.title && fileName) {
       res.title = fileName;
     }
+
     return res;
   },
 

+ 1 - 0
pioneer/packages/joy-media/src/upload/UploadAudio.view.tsx

@@ -7,6 +7,7 @@ export const UploadAudioView = MediaView<OuterProps>({
     const { transport, id } = props;
     const entity = id ? await transport.musicTrackById(id) : undefined;
     const opts = await transport.dropdownOptions();
+
     return { entity, opts };
   }
 });

+ 12 - 2
pioneer/packages/joy-media/src/upload/UploadVideo.tsx

@@ -118,6 +118,7 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
       let fieldValue = values[fieldName] as any;
 
       let shouldIncludeValue = true;
+
       if (entity) {
         // If we updating existing entity, then update only changed props:
         shouldIncludeValue = isFieldChanged(fieldName);
@@ -144,9 +145,11 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
         if (typeof fieldValue === 'string') {
           fieldValue = fieldValue.trim();
         }
+
         if (isDateField(fieldName)) {
           fieldValue = humanDateToUnixTs(fieldValue);
         }
+
         res[fieldName] = fieldValue;
       }
     });
@@ -166,6 +169,7 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
 
   const newlyCreatedMediaObjectProp = () => {
     const inClassIndexOfMediaObject = entityCodec.inClassIndexOfProp(Fields.object.id);
+
     if (!inClassIndexOfMediaObject) {
       throw new Error('Cannot not find an in-class index of "object" prop on Video entity.');
     }
@@ -183,8 +187,9 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
     props: VecClassPropertyValue,
     extra: ParametrizedClassPropertyValue[] = []
   ): ParameterizedClassPropertyValues => {
-    const parametrizedProps = props.map(p => {
+    const parametrizedProps = props.map((p) => {
       const { in_class_index, value } = p;
+
       return api.createType('ParametrizedClassPropertyValue', {
         in_class_index,
         value: api.createType('ParametrizedPropertyValue', { PropertyValue: value })
@@ -192,7 +197,7 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
     });
 
     if (extra && extra.length) {
-      extra.forEach(x => parametrizedProps.push(x));
+      extra.forEach((x) => parametrizedProps.push(x));
     }
 
     return api.createType('Vec<ParametrizedClassPropertyValue>', parametrizedProps);
@@ -296,6 +301,7 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
 
   const redirectToPlaybackPage = (newEntityId?: EntityId) => {
     const entityId = newEntityId || id;
+
     if (history && entityId) {
       history.push('/media/videos/' + entityId.toString());
     }
@@ -316,6 +322,7 @@ const InnerForm = (props: MediaFormProps<OuterProps, FormValues>) => {
 
     // Extract id from from event:
     const newId = videoEntityCreatedEvent[0] as EntityId;
+
     console.log('New video entity id:', newId && newId.toString());
 
     redirectToPlaybackPage(newId);
@@ -431,12 +438,15 @@ export const EditForm = withFormik<OuterProps, FormValues>({
   mapPropsToValues: (props): FormValues => {
     const { entity, channelId, fileName } = props;
     const res = VideoToFormValues(entity);
+
     if (!res.title && fileName) {
       res.title = fileName;
     }
+
     if (channelId) {
       res.channelId = channelId.toNumber();
     }
+
     return res;
   },
 

+ 1 - 0
pioneer/packages/joy-media/src/utils.ts

@@ -1,4 +1,5 @@
 export function fileNameWoExt (fileName: string): string {
   const lastDotIdx = fileName.lastIndexOf('.');
+
   return fileName.substring(0, lastDotIdx);
 }

+ 1 - 0
pioneer/packages/joy-media/src/video/PlayVideo.tsx

@@ -30,6 +30,7 @@ type ListOfVideoPreviewProps = {
 
 function VertialListOfVideoPreviews (props: ListOfVideoPreviewProps) {
   const { videos = [] } = props;
+
   return <>{videos.map((video) =>
     <VideoPreview key={`VideoPreview-${video.id}`} {...video} size='small' orientation='horizontal' withChannel />
   )}</>;

+ 2 - 1
pioneer/packages/joy-media/src/video/PlayVideo.view.tsx

@@ -14,11 +14,12 @@ export const PlayVideoView = MediaView<Props>({
     const { transport, api, id } = props;
 
     const video = await transport.videoById(id);
+
     if (!video) return {};
 
     const channelId = api.createType('ChannelId', video.channelId);
     const channel = await transport.channelById(channelId);
-    const moreChannelVideos = (await transport.videosByChannelId(channelId, 5, x => x.id !== video.id));
+    const moreChannelVideos = (await transport.videosByChannelId(channelId, 5, (x) => x.id !== video.id));
     const featuredVideos = await transport.featuredVideos();
     const mediaObject = video.object;
 

+ 1 - 1
pioneer/packages/joy-media/src/video/VideoPreview.tsx

@@ -77,7 +77,7 @@ export function VideoPreview (props: VideoPreviewProps) {
 }
 
 export function toVideoPreviews (items: VideoType[]): VideoPreviewProps[] {
-  return items.map(x => ({
+  return items.map((x) => ({
     id: x.id,
     title: x.title,
     thumbnail: x.thumbnail

+ 1 - 0
pioneer/packages/joy-utils/src/react/components/InputFileAsync.tsx

@@ -42,6 +42,7 @@ function InputFileAsync ({ accept, className, clearContent, help, isDisabled, is
   const _onDrop = (files: File[]): void => {
     if (!files.length) return;
     const blob = files[0];
+
     onChange && onChange(blob);
     dropRef && setFile({
       ...blob

+ 12 - 6
pioneer/packages/joy-utils/src/react/hocs/accounts.tsx

@@ -7,14 +7,14 @@ import { withCalls, withMulti, withObservable, ApiContext } from '@polkadot/reac
 import { SubjectInfo } from '@polkadot/ui-keyring/observable/types';
 
 import { MemberId, Membership } from '@joystream/types/members';
-import { LeadId, Lead } from '@joystream/types/content-working-group';
+import { LeadId, Lead, CuratorId, Curator } from '@joystream/types/content-working-group';
 
 import { queryMembershipToProp } from '@polkadot/joy-members/utils';
 import useMyAccount from '../hooks/useMyAccount';
 import { componentName } from '../helpers';
 import { queryToProp } from '@polkadot/joy-utils/functions/misc';
 import { entriesByIds } from '@polkadot/joy-utils/transport/base';
-import { CuratorId, Curator } from '@joystream/types/content-working-group';
+
 import { useApi } from '@polkadot/react-hooks';
 import usePromise from '../hooks/usePromise';
 import { Error } from '../components/PromiseComponent';
@@ -119,7 +119,9 @@ function resolveLead<P extends MyAccountProps> (Component: React.ComponentType<P
 
     return <Component {...props} {...newProps} />;
   };
+
   ResultComponent.displayName = `resolveLead(${componentName(Component)})`;
+
   return ResultComponent;
 }
 
@@ -134,7 +136,6 @@ const withContentWorkingGroupDetails = withCalls<MyAccountProps>(
 const withContentWorkingGroup = <P extends MyAccountProps>(Component: React.ComponentType<P>) =>
   withMulti(Component, withContentWorkingGroupDetails, resolveLead, resolveLeadEntry);
 
-
 function withCurationActor<P extends MyAccountProps> (Component: React.ComponentType<P>) {
   const ResultComponent: React.FunctionComponent<P> = (props: P) => {
     const {
@@ -144,10 +145,10 @@ function withCurationActor<P extends MyAccountProps> (Component: React.Component
       allAccounts
     } = props;
     const { isApiReady, api } = useApi();
-    const [ curatorEntries, curatorsError, curatorsLoading ] = usePromise<[CuratorId, Curator][]>(
+    const [curatorEntries, curatorsError, curatorsLoading] = usePromise<[CuratorId, Curator][]>(
       () => isApiReady
         ? entriesByIds<CuratorId, Curator>(api.query.contentWorkingGroup.curatorById)
-        : new Promise(resolve => resolve([])),
+        : new Promise((resolve) => resolve([])),
       [],
       [isApiReady]
     );
@@ -181,18 +182,21 @@ function withCurationActor<P extends MyAccountProps> (Component: React.Component
     // First priority - currently selected account
     let actor = curationActorByAccount(myAccountId);
     let actorKey: AccountId | null = myAccountId;
+
     // Second priority - check other keys and find best role
     // TODO: Prioritize current member?
     // TODO: Perhaps just don't do that at all and force the user to select the correct key to avoid confision?
     if (!actor) {
-      const allActorsWithKeys = Object.keys(allAccounts).map(accKey => ({
+      const allActorsWithKeys = Object.keys(allAccounts).map((accKey) => ({
         actor: curationActorByAccount(allAccounts[accKey].json.address),
         key: api.createType('AccountId', allAccounts[accKey].json.address)
       }));
       let actorWithKey = allActorsWithKeys.find(({ actor }) => actor?.isOfType('Lead'));
+
       if (!actorWithKey) {
         actorWithKey = allActorsWithKeys.find(({ actor }) => actor?.isOfType('Curator'));
       }
+
       actor = actorWithKey?.actor || null;
       actorKey = actorWithKey?.key || null;
     }
@@ -204,7 +208,9 @@ function withCurationActor<P extends MyAccountProps> (Component: React.Component
       return <Component {...props} />;
     }
   };
+
   ResultComponent.displayName = `withCurationActor(${componentName(Component)})`;
+
   return ResultComponent;
 }
 

+ 9 - 3
pioneer/packages/joy-utils/src/transport/SimpleCache.ts

@@ -29,6 +29,7 @@ export class SimpleCache<Id extends IdLike, Obj extends HasId> {
 
   clear (): void {
     const prevCacheSize = this.cache.size;
+
     this.cache = new Map();
     console.info(`Removed all ${prevCacheSize} entries from ${this.cacheName}`);
   }
@@ -37,14 +38,16 @@ export class SimpleCache<Id extends IdLike, Obj extends HasId> {
     const prevCacheSize = this.cache.size;
     const keepIdsSet = keepIds instanceof Set
       ? keepIds
-      : new Set(keepIds.map(id => id.toString()));
+      : new Set(keepIds.map((id) => id.toString()));
 
     const newCache: Map<string, Obj> = new Map();
+
     for (const [id, o] of this.cache.entries()) {
       if (keepIdsSet.has(id)) {
         newCache.set(id, o);
       }
     }
+
     this.cache = newCache;
     console.info(`Removed ${prevCacheSize - newCache.size} entries out of ${prevCacheSize} from ${this.cacheName}`);
   }
@@ -57,8 +60,9 @@ export class SimpleCache<Id extends IdLike, Obj extends HasId> {
     const idsNoFoundInCache: Id[] = [];
     const cachedObjects: Obj[] = [];
 
-    ids.map(id => {
+    ids.map((id) => {
       const fromCache = this.cache.get(id.toString());
+
       if (fromCache) {
         cachedObjects.push(fromCache);
       } else {
@@ -67,10 +71,12 @@ export class SimpleCache<Id extends IdLike, Obj extends HasId> {
     });
 
     let loadedObjects: Obj[] = [];
+
     if (idsNoFoundInCache.length > 0) {
       loadedObjects = await this.loadByIds(idsNoFoundInCache);
-      loadedObjects.map(o => {
+      loadedObjects.map((o) => {
         const id = anyIdToString(o.id);
+
         this.cache.set(id, o);
       });
     }