mirror of
https://github.com/ershisan99/podcaster.git
synced 2026-01-23 05:12:06 +00:00
feat: render description's html
chore: refactor to get episodes data from rss feed
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useParams } from "react-router-dom";
|
||||
import { usePodcastEpisodesQuery } from "../services/podcasts/podcast.hooks";
|
||||
import { usePodcastQuery } from "../services/podcasts/podcast.hooks";
|
||||
|
||||
export function Episode() {
|
||||
const { podcastId, episodeId } = useParams<{
|
||||
@@ -7,7 +7,7 @@ export function Episode() {
|
||||
episodeId: string;
|
||||
}>();
|
||||
|
||||
const { data: episodesData } = usePodcastEpisodesQuery(podcastId);
|
||||
const { data: episodesData } = usePodcastQuery(podcastId);
|
||||
|
||||
const episode = episodesData?.episodes.find(
|
||||
(episode) => episode.id.toString() === episodeId,
|
||||
@@ -15,7 +15,10 @@ export function Episode() {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>{episode?.description}</div>
|
||||
<div
|
||||
className={"prose"}
|
||||
dangerouslySetInnerHTML={{ __html: episode?.description ?? "" }}
|
||||
></div>
|
||||
<div>
|
||||
<audio controls src={episode?.audioUrl}>
|
||||
Audio is not supported by your browser
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
import { Outlet, useParams } from "react-router-dom";
|
||||
import {
|
||||
usePodcastEpisodesQuery,
|
||||
useTopPodcastsQuery,
|
||||
} from "../services/podcasts/podcast.hooks";
|
||||
import { usePodcastQuery } from "../services/podcasts/podcast.hooks";
|
||||
import { PodcastInfoCard } from "../components/podcast-info-card";
|
||||
|
||||
export function Podcast() {
|
||||
const { podcastId } = useParams<{ podcastId: string }>();
|
||||
|
||||
const { data: podcasts } = useTopPodcastsQuery();
|
||||
const { data: episodesData } = usePodcastEpisodesQuery(podcastId);
|
||||
const { data: podcast } = usePodcastQuery(podcastId);
|
||||
|
||||
if (!podcastId) {
|
||||
throw new Error(
|
||||
@@ -17,12 +13,6 @@ export function Podcast() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!podcasts) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const podcast = podcasts.find((podcast) => podcast.id === podcastId);
|
||||
|
||||
if (!podcast) {
|
||||
return <h1>Podcast not found</h1>;
|
||||
}
|
||||
@@ -33,7 +23,7 @@ export function Podcast() {
|
||||
author={podcast.author}
|
||||
title={podcast.title}
|
||||
description={podcast.description}
|
||||
imageURL={episodesData?.podcast.images.large ?? ""}
|
||||
imageURL={podcast.images.large}
|
||||
/>
|
||||
<Outlet />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user