diff --git a/app/page.tsx b/app/page.tsx index 3bdd9c6..a658400 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -3,6 +3,15 @@ import Link from "next/link"; import styles from './styles/Home.module.css'; import React, { useEffect, useState } from "react"; +interface IFeed { + title: string; + link: string; + isoDate: string; + contentSnippet: string; + source: string; + color: string; +} + const navigation = [ { name: "Projects", href: "/projects" }, { name: "About", href: "/about" }, @@ -136,26 +145,31 @@ export default function Home() {

Latest Post 👇

- {feeds && feeds.map((issue, i) => ( - -
-
- {issue.source} -
-
- {/* {moment(issue.isoDate).fromNow()} */} -
-
-
{issue.title}
-
- {(issue.contentSnippet || '').substring(0, 100)} - {(issue.contentSnippet || '').length > 100 ? '...' : ''} -
-
- ))} + { + feeds && feeds.map((issue, i) => { + const { title, link, isoDate, contentSnippet, source, color } = issue as IFeed; + return ( + +
+
+ {source} +
+
+ {/* {moment(issue.isoDate).fromNow()} */} +
+
+
{title}
+
+ {(contentSnippet || '').substring(0, 100)} + {(contentSnippet || '').length > 100 ? '...' : ''} +
+
+ ) + }) + }
diff --git a/app/projects/page.tsx b/app/projects/page.tsx index c7330f2..b98ae9c 100644 --- a/app/projects/page.tsx +++ b/app/projects/page.tsx @@ -10,7 +10,10 @@ import { Eye } from "lucide-react"; export const revalidate = 60; export default async function ProjectsPage() { - const views = {}; + interface IView { + [slug: string]: number; + } + const views: IView = {}; const featured = allProjects.filter( diff --git a/pages/api/feeds.ts b/pages/api/feeds.ts index bd21ba9..b8e4542 100644 --- a/pages/api/feeds.ts +++ b/pages/api/feeds.ts @@ -18,9 +18,10 @@ export default async function feeds( const parser = new Parser(); const newsletter = await parser.parseURL('https://lowk.substack.com/feed'); res.status(200).json({ - updatedAt: `Last issue: ${fromNow( - new Date(newsletter.items[0].pubDate) - )}`, + // updatedAt: `Last issue: ${fromNow( + // new Date(newsletter.items[0].pubDate) + // )}`, + // @ts-ignore feeds: [ ...newsletter.items.map((item: any) => ({ ...item, @@ -62,6 +63,7 @@ function fromNow( ]; const now = typeof nowDate === 'object' + // @ts-ignore ? nowDate.getTime() : new Date(nowDate).getTime(); const diff = @@ -72,6 +74,7 @@ function fromNow( const x = Math.round(Math.abs(diff) / interval.divisor); const isFuture = diff < 0; return interval.unit + // @ts-ignore ? rft.format(isFuture ? x : -x, interval.unit) : interval.text; }