|
1 | 1 | import type { Metadata, ResolvingMetadata } from "next"; |
2 | | -import type { PortableTextBlock } from "next-sanity"; |
3 | 2 | import { notFound } from "next/navigation"; |
4 | | -import { Suspense } from "react"; |
5 | | - |
6 | | -import DateComponent from "@/components/date"; |
7 | | -import MoreContent from "@/components/more-content"; |
8 | | -import PortableText from "@/components/portable-text"; |
9 | | - |
10 | 3 | import type { PodcastQueryResult } from "@/sanity/types"; |
11 | 4 | import { sanityFetch } from "@/sanity/lib/live"; |
12 | 5 | import { podcastQuery } from "@/sanity/lib/queries"; |
13 | 6 | import { resolveOpenGraphImage } from "@/sanity/lib/utils"; |
14 | | -import CoverMedia from "@/components/cover-media"; |
15 | | -import MoreHeader from "@/components/more-header"; |
16 | | -import { BreadcrumbLinks } from "@/components/breadrumb-links"; |
17 | | -import SponsorCard from "@/components/sponsor-card"; |
18 | | -import Avatar from "@/components/avatar"; |
19 | | -import Picks from "./picks"; |
20 | | -import PlayerPlayButton from "@/components/player-play-button"; |
21 | | -import PodcastOpenSpotify from "@/components/podcast-open-spotify"; |
22 | | -import PodcastOpenApple from "@/components/podcast-open-apple"; |
23 | | -import PodcastOpenYouTube from "@/components/podcast-open-youtube"; |
24 | | -import CarbonAdBanner from "@/components/carbon-ad-banner"; |
| 7 | +import Podcast from "../Podcast"; |
25 | 8 |
|
26 | 9 | type Params = Promise<{ slug: string }>; |
27 | 10 |
|
@@ -70,113 +53,7 @@ export default async function PodcastPage({ params }: { params: Params }) { |
70 | 53 | return notFound(); |
71 | 54 | } |
72 | 55 |
|
73 | | - const src = podcast?.spotify?.enclosures?.at(0)?.url; |
74 | | - |
75 | 56 | return ( |
76 | | - <div className="container px-5 mx-auto"> |
77 | | - <BreadcrumbLinks |
78 | | - links={[{ title: "Podcasts", href: "/podcasts/page/1" }]} |
79 | | - /> |
80 | | - <article> |
81 | | - <h1 className="mb-12 text-4xl font-bold leading-tight tracking-tighter text-balance md:text-7xl md:leading-none lg:text-8xl"> |
82 | | - {podcast.title} |
83 | | - </h1> |
84 | | - |
85 | | - <div className="mb-8 sm:mx-0 md:mb-16"> |
86 | | - <CoverMedia |
87 | | - cloudinaryImage={podcast?.coverImage} |
88 | | - cloudinaryVideo={podcast?.videoCloudinary} |
89 | | - youtube={podcast?.youtube} |
90 | | - /> |
91 | | - </div> |
92 | | - |
93 | | - <div className="max-w-2xl sm:max-w-none"> |
94 | | - <div className="flex flex-wrap justify-between"> |
95 | | - <div className="flex-1"> |
96 | | - <div className="mb-6"> |
97 | | - {(podcast?.author || podcast?.guest) && ( |
98 | | - <div className="flex flex-wrap gap-2"> |
99 | | - {podcast?.author?.map((a) => ( |
100 | | - <Avatar |
101 | | - key={a._id} |
102 | | - name={a.title} |
103 | | - href={`/author/${a?.slug}`} |
104 | | - coverImage={a?.coverImage} |
105 | | - /> |
106 | | - ))} |
107 | | - {podcast?.guest?.map((a) => ( |
108 | | - <Avatar |
109 | | - key={a._id} |
110 | | - name={a.title} |
111 | | - href={`/guest/${a?.slug}`} |
112 | | - coverImage={a?.coverImage} |
113 | | - /> |
114 | | - ))} |
115 | | - </div> |
116 | | - )} |
117 | | - </div> |
118 | | - <div className="mb-4 text-lg"> |
119 | | - <DateComponent dateString={podcast.date} /> |
120 | | - </div> |
121 | | - </div> |
122 | | - <CarbonAdBanner /> |
123 | | - </div> |
124 | | - |
125 | | - {src && ( |
126 | | - <div className="flex flex-col sm:flex-row justify-start flex-wrap w-full p-2 sm:p-4 border border-foreground gap-2 sm:gap-4 items-center"> |
127 | | - <h2 className="text-xl font-bold w-full text-center sm:text-start"> |
128 | | - Listening Options |
129 | | - </h2> |
130 | | - <PlayerPlayButton podcast={podcast} /> |
131 | | - <span className="text-xl">or</span> |
132 | | - <div className="flex gap-1"> |
133 | | - <PodcastOpenSpotify podcast={podcast} /> |
134 | | - <PodcastOpenApple /> |
135 | | - <PodcastOpenYouTube podcast={podcast} /> |
136 | | - </div> |
137 | | - </div> |
138 | | - )} |
139 | | - </div> |
140 | | - {podcast?.sponsor?.length && ( |
141 | | - <section className="flex flex-col mt-10 mb-10"> |
142 | | - <h2 className="mb-4 text-2xl font-bold">Sponsors</h2> |
143 | | - <hr className="border-accent-2" /> |
144 | | - <div className="my-12 "> |
145 | | - <SponsorCard sponsors={podcast.sponsor} /> |
146 | | - </div> |
147 | | - <hr className="border-accent-2" /> |
148 | | - </section> |
149 | | - )} |
150 | | - |
151 | | - {podcast?.content?.length && ( |
152 | | - <PortableText |
153 | | - className="mx-auto prose-violet lg:prose-xl dark:prose-invert" |
154 | | - value={podcast.content as PortableTextBlock[]} |
155 | | - /> |
156 | | - )} |
157 | | - </article> |
158 | | - {podcast?.pick?.length && ( |
159 | | - <> |
160 | | - <hr className="mb-8 sm:mb-24 border-accent-2 mt-8 sm:mt-28" /> |
161 | | - <div className="flex flex-col md:flex-row md:justify-between"> |
162 | | - <h2 className="mb-8 text-6xl font-bold leading-tight tracking-tighter md:text-7xl"> |
163 | | - Picks |
164 | | - </h2> |
165 | | - </div> |
166 | | - |
167 | | - <section className="p-0 sm:p-12"> |
168 | | - <div className="grid gap-2 sm:gap-8"> |
169 | | - <Picks picks={podcast.pick} /> |
170 | | - </div> |
171 | | - </section> |
172 | | - </> |
173 | | - )} |
174 | | - <aside> |
175 | | - <MoreHeader title="Recent Podcasts" href="/podcasts/page/1" /> |
176 | | - <Suspense> |
177 | | - <MoreContent type={podcast._type} skip={podcast._id} limit={2} /> |
178 | | - </Suspense> |
179 | | - </aside> |
180 | | - </div> |
| 57 | + <Podcast podcast={podcast} /> |
181 | 58 | ); |
182 | 59 | } |
0 commit comments