Added a code workspace file. Feed should come back with the correct url. Styled the feed and site buttons.
This commit is contained in:
parent
5676477b18
commit
5e1cab4c49
8
ever-givin-pod.code-workspace
Normal file
8
ever-givin-pod.code-workspace
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"folders": [
|
||||||
|
{
|
||||||
|
"path": "."
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"settings": {}
|
||||||
|
}
|
||||||
@ -3,13 +3,21 @@
|
|||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
import { StreamDto } from '../../../common/dtos/streamDto';
|
import { StreamDto } from '../../../common/dtos/streamDto';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
import { useRouter } from 'next/navigation';
|
||||||
|
|
||||||
type PodcastSummaryType = {
|
type PodcastSummaryType = {
|
||||||
stream?: string | string[];
|
stream?: string | string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
||||||
const [summaryData, setSummaryData] = useState<StreamDto>();
|
|
||||||
|
const [summaryData, setSummaryData] = useState<StreamDto>(),
|
||||||
|
router = useRouter(),
|
||||||
|
handleNavigation = (url?: string) => {
|
||||||
|
if (url) {
|
||||||
|
router.push(url);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/${stream}`)
|
fetch(`${process.env.NEXT_PUBLIC_API_BASE_URL}/api/${stream}`)
|
||||||
@ -50,23 +58,19 @@ export default function PodcastSummary({ stream }: PodcastSummaryType) {
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mt-4">
|
<div className="mt-4 flex justify-start space-x-4">
|
||||||
<a
|
<button
|
||||||
href={summaryData.feedUrl}
|
onClick={() => handleNavigation(summaryData.feedUrl)}
|
||||||
target="_blank"
|
className='bg-purple-300 hover:bg-purple-400 text-sm px-4 py-2 rounded-sm'
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="text-blue-500 hover:underline text-sm block"
|
|
||||||
>
|
>
|
||||||
View Feed
|
RSS Feed
|
||||||
</a>
|
</button>
|
||||||
<a
|
<button
|
||||||
href={summaryData.siteUrl}
|
onClick={() => handleNavigation(summaryData.siteUrl)}
|
||||||
target="_blank"
|
className='bg-purple-300 hover:bg-purple-400 text-sm px-4 py-2 rounded-sm'
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="text-blue-500 hover:underline text-sm block mt-2"
|
|
||||||
>
|
>
|
||||||
Visit Site
|
Visit Site
|
||||||
</a>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -42,16 +42,8 @@ export const prepareStreamItem = (stream?: StreamDto) => {
|
|||||||
const imageUrl = stream.imageUrl ? convertUrlToPublic(stream.imageUrl) : undefined;
|
const imageUrl = stream.imageUrl ? convertUrlToPublic(stream.imageUrl) : undefined;
|
||||||
return {
|
return {
|
||||||
...stream,
|
...stream,
|
||||||
imageUrl//,
|
imageUrl,
|
||||||
// customElements: [
|
feedUrl: `${process.env.NEXT_PUBLIC_API_BASE_URL}/api/${stream.id}/feed`,
|
||||||
// {
|
|
||||||
// image: [
|
|
||||||
// { url: imageUrl },
|
|
||||||
// { title: stream.title }//,
|
|
||||||
// //{ link: stream.link }
|
|
||||||
// ]
|
|
||||||
// }
|
|
||||||
//]
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user