Some more fixes to make sure the summary image actually works.
This commit is contained in:
parent
19915c474e
commit
dd194cda4c
@ -25,7 +25,7 @@ export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
||||
<div className="w-full h-auto shadow-md overflow-hidden flex flex-col bg-purple-200">
|
||||
<div className="flex flex-col md:flex-row md:items-start">
|
||||
<div className="relative w-full h-[150px] md:w-1/3 md:h-[376] bg-purple-100 flex-shrink-0">
|
||||
<Image unoptimized src={summaryData.imageUrl ?? ''} alt={summaryData.title ?? ''} fill className="rounded-md object-cover" />
|
||||
<Image unoptimized src={summaryData.imageUrl ?? ''} alt={summaryData.title ?? ''} fill objectFit="contain" className="rounded-md" />
|
||||
</div>
|
||||
|
||||
<div className="p-4 flex-grow flex flex-col md:ml-4">
|
||||
|
||||
@ -36,7 +36,8 @@ export const preparePodcastItem = (podcast: PodcastDto) => {
|
||||
};
|
||||
};
|
||||
|
||||
export const prepareStreamItem = (stream: StreamDto) => {
|
||||
export const prepareStreamItem = (stream?: StreamDto) => {
|
||||
if (!stream) return undefined;
|
||||
return {
|
||||
...stream,
|
||||
imageUrl: convertUrlToPublic(stream.imageUrl)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { StreamDto } from '../../common/dtos/streamDto';
|
||||
import { getStream } from '../../common/data/db';
|
||||
import { prepareStreamItem } from '../../common/helpers/data';
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
@ -8,7 +9,7 @@ export default async function handler(
|
||||
) {
|
||||
const { stream } = req.query;
|
||||
|
||||
const data = await getStream(stream as string);
|
||||
const data = prepareStreamItem(await getStream(stream as string));
|
||||
|
||||
res.status(200).json(data)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user