Quickly fixing a couple of eslint stuff.
This commit is contained in:
parent
91fcddabb5
commit
5ee1d252fe
@ -1,6 +1,6 @@
|
|||||||
import { useRouter } from 'next/navigation';
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
export default function AddPodcastCard({ stream }: { stream: string }) {
|
export default function AddPodcastCard({ stream }: { stream?: string | string[] }) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { PodcastDto } from '../common/dtos/podcastDto';
|
import { PodcastDto } from '../../../common/dtos/podcastDto';
|
||||||
|
|
||||||
export default function PodcastCard({
|
export default function PodcastCard({
|
||||||
imageUrl = "https://placehold.co/400",
|
imageUrl = "https://placehold.co/400",
|
||||||
@ -12,7 +12,7 @@ export default function PodcastCard({
|
|||||||
return (
|
return (
|
||||||
<div className="w-full h-[150px] shadow-md rounded-sm overflow-hidden flex m-4 mb-1">
|
<div className="w-full h-[150px] shadow-md rounded-sm overflow-hidden flex m-4 mb-1">
|
||||||
<div className="w-[150px] h-full bg-purple-100 flex-shrink-0 relative">
|
<div className="w-[150px] h-full bg-purple-100 flex-shrink-0 relative">
|
||||||
<Image unoptimized src={imageUrl} alt={title} layout="fill" objectFit="cover" />
|
<Image unoptimized src={imageUrl} alt={title ?? ''} layout="fill" objectFit="cover" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="p-4 flex-grow flex flex-col bg-purple-200">
|
<div className="p-4 flex-grow flex flex-col bg-purple-200">
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import { PodcastDto } from '../../../common/dtos/podcastDto';
|
|||||||
import AddPodcastCard from './addPodcastCard';
|
import AddPodcastCard from './addPodcastCard';
|
||||||
|
|
||||||
type PodcastListProps = {
|
type PodcastListProps = {
|
||||||
stream: string;
|
stream?: string | string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function PodcastList({ stream }: PodcastListProps) {
|
export default function PodcastList({ stream }: PodcastListProps) {
|
||||||
@ -30,6 +30,7 @@ export default function PodcastList({ stream }: PodcastListProps) {
|
|||||||
uploadDate={podcast.uploadDate}
|
uploadDate={podcast.uploadDate}
|
||||||
url={podcast.url}
|
url={podcast.url}
|
||||||
author={podcast.author}
|
author={podcast.author}
|
||||||
|
imageUrl={podcast.imageUrl}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
))
|
))
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { StreamDto } from '../common/dtos/steamDto';
|
import { StreamDto } from '../../../common/dtos/streamDto';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
type PodcastSummaryType = {
|
type PodcastSummaryType = {
|
||||||
stream: string;
|
stream?: string | string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
||||||
const [summaryData, setSummaryData] = useState<StreamDto>(null);
|
const [summaryData, setSummaryData] = useState<StreamDto>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/${stream}`)
|
fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/${stream}`)
|
||||||
@ -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="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="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">
|
<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 className="rounded-md object-cover" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="p-4 flex-grow flex flex-col md:ml-4">
|
<div className="p-4 flex-grow flex flex-col md:ml-4">
|
||||||
|
|||||||
@ -11,7 +11,7 @@ type PodcastDto = {
|
|||||||
author: string;
|
author: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function StreamPublishForm({ stream }: { stream?: string }) {
|
export default function StreamPublishForm({ stream }: { stream?: string | string[] }) {
|
||||||
const { register, handleSubmit, formState: { errors } } = useForm<PodcastDto>();
|
const { register, handleSubmit, formState: { errors } } = useForm<PodcastDto>();
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<PodcastDto> = (data) => {
|
const onSubmit: SubmitHandler<PodcastDto> = (data) => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
export type PodcastDto = {
|
export type PodcastDto = {
|
||||||
podcastId: string;
|
podcastId?: string;
|
||||||
streamId: string;
|
streamId?: string;
|
||||||
imageUrl?: string;
|
imageUrl?: string;
|
||||||
title?: string;
|
title?: string;
|
||||||
description?: string;
|
description?: string;
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export const preparePodcastItem = (podcast: PodcastDto) => {
|
|||||||
imageUrl: convertUrlToPublic(podcast.imageUrl),
|
imageUrl: convertUrlToPublic(podcast.imageUrl),
|
||||||
url: fileUrl,
|
url: fileUrl,
|
||||||
enclosure: {
|
enclosure: {
|
||||||
url: fileUrl,
|
url: fileUrl ?? '',
|
||||||
type: getFileMimeType(podcast.url ?? ''),
|
type: getFileMimeType(podcast.url ?? ''),
|
||||||
size: fileSize
|
size: fileSize
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,10 +5,11 @@ import { v4 as uuidv4 } from 'uuid';
|
|||||||
import multiparty from 'multiparty';
|
import multiparty from 'multiparty';
|
||||||
import { getPodcasts, publishPodcast } from '../../../common/data/db';
|
import { getPodcasts, publishPodcast } from '../../../common/data/db';
|
||||||
import { PodcastDto } from '../../../common/dtos/podcastDto';
|
import { PodcastDto } from '../../../common/dtos/podcastDto';
|
||||||
|
import { preparePodcastItem } from '../../../common/helpers/data';
|
||||||
|
|
||||||
const get = async (req: NextApiRequest, res: NextApiResponse<PodcastDto[]>) => {
|
const get = async (req: NextApiRequest, res: NextApiResponse<PodcastDto[]>) => {
|
||||||
const stream = req.query.stream as string,
|
const stream = req.query.stream as string,
|
||||||
podcasts = await getPodcasts(stream);
|
podcasts = (await getPodcasts(stream as string)).map(preparePodcastItem);
|
||||||
|
|
||||||
res.status(200).json(podcasts);
|
res.status(200).json(podcasts);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user