diff --git a/ui/app/news/[id]/page.tsx b/ui/app/news/[id]/page.tsx index 44e6efa..b9b0a3c 100644 --- a/ui/app/news/[id]/page.tsx +++ b/ui/app/news/[id]/page.tsx @@ -1,7 +1,6 @@ import { fetchNewsData } from "../../../lib/fetchNewsData"; import NewsDetail from "../../../components/NewsDetail"; - export default async function NewsPage({ params }: { params: { id: string } }) { const newsData = await fetchNewsData(params.id); @@ -10,4 +9,4 @@ export default async function NewsPage({ params }: { params: { id: string } }) { } return ; -} \ No newline at end of file +} diff --git a/ui/app/news/layout.tsx b/ui/app/news/layout.tsx index edc343c..08ce491 100644 --- a/ui/app/news/layout.tsx +++ b/ui/app/news/layout.tsx @@ -9,4 +9,4 @@ const Layout = ({ children }: { children: React.ReactNode }) => { return
{children}
; }; -export default Layout; \ No newline at end of file +export default Layout; diff --git a/ui/components/NewsDetail.tsx b/ui/components/NewsDetail.tsx index 9f411db..f7d7216 100644 --- a/ui/components/NewsDetail.tsx +++ b/ui/components/NewsDetail.tsx @@ -1,13 +1,38 @@ import React from "react"; import ContextItem from "./ContextItem"; +interface ContextItemType { + name: string; + url: string; + description: string; + provider: { + name: string; + image?: { + thumbnail: { + contentUrl: string; + }; + }; + }[]; + datePublished: string; + image?: { + contentUrl: string; + thumbnail: { + contentUrl: string; + width: number; + height: number; + }; + }; + article?: string; + score?: number; +} + interface NewsDetailProps { news: { title: string; sections: { title: string; content: string; - context: any[]; + context: ContextItemType[]; }[]; }; } @@ -32,4 +57,4 @@ const NewsDetail: React.FC = ({ news }) => { ); }; -export default NewsDetail; +export default NewsDetail; \ No newline at end of file diff --git a/ui/components/NewsPage.tsx b/ui/components/NewsPage.tsx index ea2543b..da9404e 100644 --- a/ui/components/NewsPage.tsx +++ b/ui/components/NewsPage.tsx @@ -52,7 +52,7 @@ const NewsPage = () => {

Loading news...

- ) : error ? ( + ) : (error ? (

Failed to load news.

{error}

@@ -77,7 +77,7 @@ const NewsPage = () => { )) )}
- )} + ))} ); };