fix: podcast episodes layout

This commit is contained in:
Hossein Mehrabi 2023-10-19 16:31:28 +03:30
parent 6cc544394f
commit 37a1876b07
No known key found for this signature in database
GPG Key ID: 45C04964191AFAA1
1 changed files with 14 additions and 7 deletions

View File

@ -16,14 +16,23 @@ interface Props {
} }
const PodcastShowContainer = (props: Props) => { const PodcastShowContainer = (props: Props) => {
const { show, latestEpisodes, highlightedEpisodes } = props const { show } = props
const query = useRecentEpisodes({ const query = useRecentEpisodes({
limit: 8, limit: 8,
showSlug: show.slug, showSlug: show.slug,
initialData: latestEpisodes, initialData: props.latestEpisodes,
}) })
const highlightedPosts = [...props.highlightedEpisodes, ...query.posts].slice(
0,
2,
)
const latestPosts = query.posts.filter(
(post) => !highlightedPosts.includes(post),
)
return ( return (
<> <>
<PodcastsGrid> <PodcastsGrid>
@ -33,7 +42,7 @@ const PodcastShowContainer = (props: Props) => {
<EpisodesList <EpisodesList
shows={[show]} shows={[show]}
displayShow={false} displayShow={false}
episodes={highlightedEpisodes} episodes={highlightedPosts}
header={<Typography variant="body2">All episodes</Typography>} header={<Typography variant="body2">All episodes</Typography>}
bordered="except-first-row" bordered="except-first-row"
pattern={[ pattern={[
@ -59,10 +68,8 @@ const PodcastShowContainer = (props: Props) => {
<EpisodesList <EpisodesList
shows={[show]} shows={[show]}
displayShow={false} displayShow={false}
episodes={query.posts} episodes={latestPosts}
bordered={ bordered={highlightedPosts.length > 0 ? true : 'except-first-row'}
highlightedEpisodes.length > 0 ? true : 'except-first-row'
}
pattern={[ pattern={[
{ {
cols: 4, cols: 4,