|
@@ -103,10 +103,11 @@ export type VideoTileBaseProps = {
|
|
|
views?: number | null
|
|
|
thumbnailUrl?: string | null
|
|
|
hasThumbnailUploadFailed?: boolean
|
|
|
+ isLoadingThumbnail?: boolean
|
|
|
+ isLoadingAvatar?: boolean
|
|
|
isLoading?: boolean
|
|
|
videoHref?: string
|
|
|
channelHref?: string
|
|
|
- contentKey?: string
|
|
|
className?: string
|
|
|
} & VideoTileBaseMetaProps &
|
|
|
VideoTilePublisherProps
|
|
@@ -134,6 +135,8 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
onCoverResize,
|
|
|
channelHref,
|
|
|
videoHref,
|
|
|
+ isLoadingThumbnail,
|
|
|
+ isLoadingAvatar,
|
|
|
isLoading = true,
|
|
|
showChannel = true,
|
|
|
showMeta = true,
|
|
@@ -146,7 +149,6 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
onPullupClick,
|
|
|
onClick,
|
|
|
onRemoveButtonClick,
|
|
|
- contentKey,
|
|
|
className,
|
|
|
onOpenInTabClick,
|
|
|
onEditVideoClick,
|
|
@@ -202,17 +204,17 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
return (
|
|
|
<Container main={main} className={className}>
|
|
|
<CoverWrapper main={main}>
|
|
|
- <CoverContainer clickable={clickable}>
|
|
|
+ <CoverContainer ref={imgRef} clickable={clickable}>
|
|
|
<SwitchTransition>
|
|
|
<CSSTransition
|
|
|
- key={isLoading ? 'placeholder' : `content-${contentKey}`}
|
|
|
+ key={isLoadingThumbnail ? 'cover-placeholder' : 'cover'}
|
|
|
timeout={parseInt(transitions.timings.sharp)}
|
|
|
classNames={transitions.names.fade}
|
|
|
>
|
|
|
- {isLoading ? (
|
|
|
+ {isLoadingThumbnail ? (
|
|
|
<CoverSkeletonLoader />
|
|
|
) : (
|
|
|
- <CoverImageContainer ref={imgRef}>
|
|
|
+ <CoverImageContainer>
|
|
|
<Anchor to={videoHref ?? ''} onClick={createAnchorClickHandler(videoHref)}>
|
|
|
{thumbnailUrl && !failedLoadImage ? (
|
|
|
<CoverImage
|
|
@@ -276,16 +278,16 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
<ProgressBar style={{ width: `${progress}%` }} />
|
|
|
</ProgressOverlay>
|
|
|
)}
|
|
|
- <SwitchTransition>
|
|
|
- <CSSTransition
|
|
|
- key={isLoading ? 'placeholder' : `content-${contentKey}`}
|
|
|
- timeout={parseInt(transitions.timings.sharp)}
|
|
|
- classNames={transitions.names.fade}
|
|
|
- >
|
|
|
- <InfoContainer main={main}>
|
|
|
- {displayChannel && (
|
|
|
+ <InfoContainer main={main}>
|
|
|
+ {displayChannel && (
|
|
|
+ <SwitchTransition>
|
|
|
+ <CSSTransition
|
|
|
+ key={isLoadingAvatar ? 'avatar-placeholder' : 'avatar'}
|
|
|
+ timeout={parseInt(transitions.timings.sharp)}
|
|
|
+ classNames={transitions.names.fade}
|
|
|
+ >
|
|
|
<AvatarContainer scalingFactor={scalingFactor}>
|
|
|
- {isLoading ? (
|
|
|
+ {isLoading || isLoadingAvatar ? (
|
|
|
<SkeletonLoader rounded />
|
|
|
) : (
|
|
|
<Anchor to={channelHref ?? ''} onClick={createAnchorClickHandler(channelHref)}>
|
|
@@ -297,7 +299,15 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
</Anchor>
|
|
|
)}
|
|
|
</AvatarContainer>
|
|
|
- )}
|
|
|
+ </CSSTransition>
|
|
|
+ </SwitchTransition>
|
|
|
+ )}
|
|
|
+ <SwitchTransition>
|
|
|
+ <CSSTransition
|
|
|
+ key={isLoading ? 'text-placeholder' : 'text'}
|
|
|
+ timeout={parseInt(transitions.timings.sharp)}
|
|
|
+ classNames={transitions.names.fade}
|
|
|
+ >
|
|
|
<TextContainer>
|
|
|
{isLoading ? (
|
|
|
<SkeletonLoader height={main ? 45 : 18} width="60%" />
|
|
@@ -344,51 +354,51 @@ export const VideoTileBase: React.FC<VideoTileBaseProps> = ({
|
|
|
</MetaContainer>
|
|
|
)}
|
|
|
</TextContainer>
|
|
|
- {!isLoading && (
|
|
|
- <>
|
|
|
- <KebabMenuIconContainer
|
|
|
- onClick={(event) => openContextMenu(event, 200)}
|
|
|
- isActive={contextMenuOpts.isActive}
|
|
|
- >
|
|
|
- <SvgGlyphMore />
|
|
|
- </KebabMenuIconContainer>
|
|
|
- <ContextMenu contextMenuOpts={contextMenuOpts}>
|
|
|
- {publisherMode ? (
|
|
|
- <>
|
|
|
- {onOpenInTabClick && (
|
|
|
- <ContextMenuItem icon={<SvgGlyphPlay />} onClick={onOpenInTabClick}>
|
|
|
- Play in Joystream
|
|
|
- </ContextMenuItem>
|
|
|
- )}
|
|
|
- {onCopyVideoURLClick && (
|
|
|
- <ContextMenuItem icon={<SvgGlyphCopy />} onClick={onCopyVideoURLClick}>
|
|
|
- Copy video URL
|
|
|
- </ContextMenuItem>
|
|
|
- )}
|
|
|
- {onEditVideoClick && (
|
|
|
- <ContextMenuItem icon={<SvgGlyphEdit />} onClick={onEditVideoClick}>
|
|
|
- {isDraft ? 'Edit draft' : 'Edit video'}
|
|
|
- </ContextMenuItem>
|
|
|
- )}
|
|
|
- {onDeleteVideoClick && (
|
|
|
- <ContextMenuItem icon={<SvgGlyphTrash />} onClick={onDeleteVideoClick}>
|
|
|
- {isDraft ? 'Delete draft' : 'Delete video'}
|
|
|
- </ContextMenuItem>
|
|
|
- )}
|
|
|
- </>
|
|
|
- ) : (
|
|
|
- onCopyVideoURLClick && (
|
|
|
- <ContextMenuItem onClick={onCopyVideoURLClick} icon={<SvgGlyphCopy />}>
|
|
|
- Copy video URL
|
|
|
- </ContextMenuItem>
|
|
|
- )
|
|
|
+ </CSSTransition>
|
|
|
+ </SwitchTransition>
|
|
|
+ {!isLoading && (
|
|
|
+ <>
|
|
|
+ <KebabMenuIconContainer
|
|
|
+ onClick={(event) => openContextMenu(event, 200)}
|
|
|
+ isActive={contextMenuOpts.isActive}
|
|
|
+ >
|
|
|
+ <SvgGlyphMore />
|
|
|
+ </KebabMenuIconContainer>
|
|
|
+ <ContextMenu contextMenuOpts={contextMenuOpts}>
|
|
|
+ {publisherMode ? (
|
|
|
+ <>
|
|
|
+ {onOpenInTabClick && (
|
|
|
+ <ContextMenuItem icon={<SvgGlyphPlay />} onClick={onOpenInTabClick}>
|
|
|
+ Play in Joystream
|
|
|
+ </ContextMenuItem>
|
|
|
+ )}
|
|
|
+ {onCopyVideoURLClick && (
|
|
|
+ <ContextMenuItem icon={<SvgGlyphCopy />} onClick={onCopyVideoURLClick}>
|
|
|
+ Copy video URL
|
|
|
+ </ContextMenuItem>
|
|
|
)}
|
|
|
- </ContextMenu>
|
|
|
- </>
|
|
|
- )}
|
|
|
- </InfoContainer>
|
|
|
- </CSSTransition>
|
|
|
- </SwitchTransition>
|
|
|
+ {onEditVideoClick && (
|
|
|
+ <ContextMenuItem icon={<SvgGlyphEdit />} onClick={onEditVideoClick}>
|
|
|
+ {isDraft ? 'Edit draft' : 'Edit video'}
|
|
|
+ </ContextMenuItem>
|
|
|
+ )}
|
|
|
+ {onDeleteVideoClick && (
|
|
|
+ <ContextMenuItem icon={<SvgGlyphTrash />} onClick={onDeleteVideoClick}>
|
|
|
+ {isDraft ? 'Delete draft' : 'Delete video'}
|
|
|
+ </ContextMenuItem>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ onCopyVideoURLClick && (
|
|
|
+ <ContextMenuItem onClick={onCopyVideoURLClick} icon={<SvgGlyphCopy />}>
|
|
|
+ Copy video URL
|
|
|
+ </ContextMenuItem>
|
|
|
+ )
|
|
|
+ )}
|
|
|
+ </ContextMenu>
|
|
|
+ </>
|
|
|
+ )}
|
|
|
+ </InfoContainer>
|
|
|
</Container>
|
|
|
)
|
|
|
}
|