Leszek Wiesner преди 4 години
родител
ревизия
e4548e3933

+ 1 - 1
pioneer/packages/joy-forum/src/EditReply.tsx

@@ -161,7 +161,7 @@ const EditForm = withFormik<OuterProps, FormValues>({
   mapPropsToValues: props => {
     const { struct } = props;
     return {
-      text: struct && struct.current_text || ''
+      text: (struct && struct.current_text) || ''
     };
   },
 

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

@@ -13,7 +13,7 @@ export function TracksOfMyMusicAlbum (props: TracksOfMyMusicAlbumProps) {
   const [idxsOfSelectedTracks, setIdxsOfSelectedTracks] = useState(new Set<number>());
 
   const { album, tracks = [] } = props;
-  const tracksCount = tracks && tracks.length || 0;
+  const tracksCount = (tracks && tracks.length) || 0;
 
   const onTrackSelect = (
     trackIdx: number,

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

@@ -8,7 +8,7 @@ export type MyMusicAlbumsProps = {
 
 export function MyMusicAlbums (props: MyMusicAlbumsProps) {
   const { albums = [] } = props;
-  const albumCount = albums && albums.length || 0;
+  const albumCount = (albums && albums.length) || 0;
 
   return <>
     <h2>{`My music albums (${albumCount})`}</h2>

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

@@ -75,13 +75,13 @@ export class ChannelCodec {
 
 export function ChannelToFormValues (entity?: ChannelType): ChannelFormValues {
   return {
-    content: entity && entity.content || 'Video',
-    handle: entity && entity.handle || '',
-    title: entity && entity.title || '',
-    description: entity && entity.description || '',
-    avatar: entity && entity.avatar || '',
-    banner: entity && entity.banner || '',
-    publicationStatus: entity && entity.publicationStatus || 'Public'
+    content: (entity && entity.content) || 'Video',
+    handle: (entity && entity.handle) || '',
+    title: (entity && entity.title) || '',
+    description: (entity && entity.description) || '',
+    avatar: (entity && entity.avatar) || '',
+    banner: (entity && entity.banner) || '',
+    publicationStatus: (entity && entity.publicationStatus) || 'Public'
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/general/ContentLicense.ts

@@ -25,7 +25,7 @@ export class ContentLicenseCodec extends EntityCodec<ContentLicenseType> { }
 
 export function ContentLicenseToFormValues (entity?: ContentLicenseType): ContentLicenseFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/general/CurationStatus.ts

@@ -25,7 +25,7 @@ export class CurationStatusCodec extends EntityCodec<CurationStatusType> { }
 
 export function CurationStatusToFormValues (entity?: CurationStatusType): CurationStatusFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

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

@@ -29,9 +29,9 @@ 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) || []
+    topVideo: (entity && entity.topVideo?.id) || 0,
+    featuredVideos: (entity && entity.featuredVideos?.map(x => x.id)) || [],
+    featuredAlbums: (entity && entity.featuredAlbums?.map(x => x.id)) || []
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/general/Language.ts

@@ -25,7 +25,7 @@ export class LanguageCodec extends EntityCodec<LanguageType> { }
 
 export function LanguageToFormValues (entity?: LanguageType): LanguageFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/general/MediaObject.ts

@@ -25,7 +25,7 @@ export class MediaObjectCodec extends EntityCodec<MediaObjectType> { }
 
 export function MediaObjectToFormValues (entity?: MediaObjectType): MediaObjectFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/general/PublicationStatus.ts

@@ -25,7 +25,7 @@ export class PublicationStatusCodec extends EntityCodec<PublicationStatusType> {
 
 export function PublicationStatusToFormValues (entity?: PublicationStatusType): PublicationStatusFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

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

@@ -94,26 +94,26 @@ export class MusicAlbumCodec extends EntityCodec<MusicAlbumType> { }
 
 export function MusicAlbumToFormValues (entity?: MusicAlbumType): MusicAlbumFormValues {
   return {
-    title: entity && entity.title || '',
-    artist: entity && entity.artist || '',
-    thumbnail: entity && entity.thumbnail || '',
-    description: entity && entity.description || '',
-    firstReleased: entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD') || '',
-    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) || [],
-    language: entity && entity.language?.id || 0,
-    links: entity && entity.links || [],
-    lyrics: entity && entity.lyrics || '',
-    composerOrSongwriter: entity && entity.composerOrSongwriter || '',
-    reviews: entity && entity.reviews || [],
-    publicationStatus: entity && entity.publicationStatus.id || 0,
-    curationStatus: entity && entity.curationStatus?.id || 0,
-    explicit: entity && entity.explicit || false,
-    license: entity && entity.license?.id || 0,
-    attribution: entity && entity.attribution || '',
-    channelId: entity && entity.channelId || 0
+    title: (entity && entity.title) || '',
+    artist: (entity && entity.artist) || '',
+    thumbnail: (entity && entity.thumbnail) || '',
+    description: (entity && entity.description) || '',
+    firstReleased: (entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD')) || '',
+    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)) || [],
+    language: (entity && entity.language?.id) || 0,
+    links: (entity && entity.links) || [],
+    lyrics: (entity && entity.lyrics) || '',
+    composerOrSongwriter: (entity && entity.composerOrSongwriter) || '',
+    reviews: (entity && entity.reviews) || [],
+    publicationStatus: (entity && entity.publicationStatus.id) || 0,
+    curationStatus: (entity && entity.curationStatus?.id) || 0,
+    explicit: (entity && entity.explicit) || false,
+    license: (entity && entity.license?.id) || 0,
+    attribution: (entity && entity.attribution) || '',
+    channelId: (entity && entity.channelId) || 0
   };
 }
 

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

@@ -25,7 +25,7 @@ export class MusicGenreCodec extends EntityCodec<MusicGenreType> { }
 
 export function MusicGenreToFormValues (entity?: MusicGenreType): MusicGenreFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

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

@@ -25,7 +25,7 @@ export class MusicMoodCodec extends EntityCodec<MusicMoodType> { }
 
 export function MusicMoodToFormValues (entity?: MusicMoodType): MusicMoodFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

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

@@ -25,7 +25,7 @@ export class MusicThemeCodec extends EntityCodec<MusicThemeType> { }
 
 export function MusicThemeToFormValues (entity?: MusicThemeType): MusicThemeFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

+ 19 - 19
pioneer/packages/joy-media/src/schemas/music/MusicTrack.ts

@@ -91,25 +91,25 @@ export class MusicTrackCodec extends EntityCodec<MusicTrackType> { }
 
 export function MusicTrackToFormValues (entity?: MusicTrackType): MusicTrackFormValues {
   return {
-    title: entity && entity.title || '',
-    artist: entity && entity.artist || '',
-    thumbnail: entity && entity.thumbnail || '',
-    description: entity && entity.description || '',
-    language: entity && entity.language?.id || 0,
-    firstReleased: entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD') || '',
-    genre: entity && entity.genre?.id || 0,
-    mood: entity && entity.mood?.id || 0,
-    theme: entity && entity.theme?.id || 0,
-    links: entity && entity.links || [],
-    composerOrSongwriter: entity && entity.composerOrSongwriter || '',
-    lyrics: entity && entity.lyrics || '',
-    object: entity && entity.object?.id || 0,
-    publicationStatus: entity && entity.publicationStatus?.id || 0,
-    curationStatus: entity && entity.curationStatus?.id || 0,
-    explicit: entity && entity.explicit || false,
-    license: entity && entity.license?.id || 0,
-    attribution: entity && entity.attribution || '',
-    channelId: entity && entity.channelId || 0
+    title: (entity && entity.title) || '',
+    artist: (entity && entity.artist) || '',
+    thumbnail: (entity && entity.thumbnail) || '',
+    description: (entity && entity.description) || '',
+    language: (entity && entity.language?.id) || 0,
+    firstReleased: (entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD')) || '',
+    genre: (entity && entity.genre?.id) || 0,
+    mood: (entity && entity.mood?.id) || 0,
+    theme: (entity && entity.theme?.id) || 0,
+    links: (entity && entity.links) || [],
+    composerOrSongwriter: (entity && entity.composerOrSongwriter) || '',
+    lyrics: (entity && entity.lyrics) || '',
+    object: (entity && entity.object?.id) || 0,
+    publicationStatus: (entity && entity.publicationStatus?.id) || 0,
+    curationStatus: (entity && entity.curationStatus?.id) || 0,
+    explicit: (entity && entity.explicit) || false,
+    license: (entity && entity.license?.id) || 0,
+    attribution: (entity && entity.attribution) || '',
+    channelId: (entity && entity.channelId) || 0
   };
 }
 

+ 14 - 14
pioneer/packages/joy-media/src/schemas/video/Video.ts

@@ -73,20 +73,20 @@ export class VideoCodec extends EntityCodec<VideoType> { }
 
 export function VideoToFormValues (entity?: VideoType): VideoFormValues {
   return {
-    title: entity && entity.title || '',
-    thumbnail: entity && entity.thumbnail || '',
-    description: entity && entity.description || '',
-    language: entity && entity.language?.id || 0,
-    firstReleased: entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD') || '',
-    category: entity && entity.category?.id || 0,
-    links: entity && entity.links || [],
-    object: entity && entity.object?.id || 0,
-    publicationStatus: entity && entity.publicationStatus?.id || 0,
-    curationStatus: entity && entity.curationStatus?.id || 0,
-    explicit: entity && entity.explicit || false,
-    license: entity && entity.license?.id || 0,
-    attribution: entity && entity.attribution || '',
-    channelId: entity && entity.channelId || 0
+    title: (entity && entity.title) || '',
+    thumbnail: (entity && entity.thumbnail) || '',
+    description: (entity && entity.description) || '',
+    language: (entity && entity.language?.id) || 0,
+    firstReleased: (entity && moment(entity.firstReleased * 1000).format('YYYY-MM-DD')) || '',
+    category: (entity && entity.category?.id) || 0,
+    links: (entity && entity.links) || [],
+    object: (entity && entity.object?.id) || 0,
+    publicationStatus: (entity && entity.publicationStatus?.id) || 0,
+    curationStatus: (entity && entity.curationStatus?.id) || 0,
+    explicit: (entity && entity.explicit) || false,
+    license: (entity && entity.license?.id) || 0,
+    attribution: (entity && entity.attribution) || '',
+    channelId: (entity && entity.channelId) || 0
   };
 }
 

+ 1 - 1
pioneer/packages/joy-media/src/schemas/video/VideoCategory.ts

@@ -25,7 +25,7 @@ export class VideoCategoryCodec extends EntityCodec<VideoCategoryType> { }
 
 export function VideoCategoryToFormValues (entity?: VideoCategoryType): VideoCategoryFormValues {
   return {
-    value: entity && entity.value || ''
+    value: (entity && entity.value) || ''
   };
 }
 

+ 1 - 1
pioneer/packages/joy-utils/src/index.ts

@@ -75,7 +75,7 @@ export const isNum = (x: any): boolean =>
   typeof x === 'number';
 
 export const isEmptyStr = (x: any): boolean =>
-  notDefined(x) || isStr(x) && x.trim().length === 0;
+  notDefined(x) || (isStr(x) && x.trim().length === 0);
 
 export const nonEmptyStr = (x?: any) =>
   isStr(x) && x.trim().length > 0;