Skip to content

Commit

Permalink
Improve loading stage
Browse files Browse the repository at this point in the history
  • Loading branch information
ikprk committed May 26, 2024
1 parent ebd646d commit 9f5f3ea
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions packages/atlas/src/views/viewer/ShortsView/ShortsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export const ShortsView = () => {
activeIndex > idx && idx > activeIndex - 2 ? 'prev' : ''
} ${activeIndex < idx && idx < activeIndex + 2 ? 'next' : ''}`}
>
{!id || activeIndex - 1 > idx || activeIndex + 2 < idx ? (
<div style={{ height: '100%', background: 'red', width: 400, aspectRatio: '9/16' }} />
{activeIndex - 1 > idx || activeIndex + 2 < idx ? (
<div style={{ height: '100%', width: 400, aspectRatio: '9/16' }} />
) : (
<ShortVideoPlayer
forceMuted={forceMuted}
Expand Down Expand Up @@ -141,17 +141,17 @@ const ShortVideoPlayer = ({
setForceMuted,
}: {
isActive: boolean
videoId: string
videoId?: string
forceMuted: boolean
setForceMuted: (val: boolean) => void
playNext: () => void
}) => {
const { video, loading } = useFullVideo(videoId)
const { video, loading } = useFullVideo(videoId ?? '')
const mediaUrls: string[] = video?.media?.resolvedUrls ?? []

return (
<ShortVideoPlayerBox>
{!loading ? (
{!loading && videoId ? (
<StyledBackgroundVideoPlayer
videoId={videoId}
playing={isActive}
Expand All @@ -168,20 +168,22 @@ const ShortVideoPlayer = ({
customLink={absoluteRoutes.viewer.video(videoId)}
/>
) : (
<SkeletonLoader height="100%" width={400} />
<SkeletonLoader height="100%" width="100%" />
)}
<DetailsBox flow="column" gap={2}>
<FlexBox width="fit-content" gap={4}>
<ChannelLink id={video?.channel.id} />
<FollowButton isSmall channelId={video?.channel.id} />
</FlexBox>
<Text margin={{ top: 4 }} variant="t200" as="p">
{video?.title}
</Text>
<Text clampAfterLine={1} variant="t100" as="p" color="colorText">
{video?.description}
</Text>
</DetailsBox>
{video ? (
<DetailsBox flow="column" gap={2}>
<FlexBox width="fit-content" gap={4}>
<ChannelLink id={video?.channel.id} />
<FollowButton isSmall channelId={video?.channel.id} />
</FlexBox>
<Text margin={{ top: 4 }} variant="t200" as="p">
{video?.title}
</Text>
<Text clampAfterLine={1} variant="t100" as="p" color="colorText">
{video?.description}
</Text>
</DetailsBox>
) : null}
</ShortVideoPlayerBox>
)
}
Expand Down

0 comments on commit 9f5f3ea

Please sign in to comment.