diff --git a/app/g/[id]/page.tsx b/app/g/[id]/page.tsx new file mode 100644 index 0000000..29c9700 --- /dev/null +++ b/app/g/[id]/page.tsx @@ -0,0 +1,66 @@ +import GistsCode from 'app/gists/gists-code'; +import LinkAnchor from 'components/mdx/link-anchor'; +import dayjs from 'dayjs'; +import relativeTime from 'dayjs/plugin/relativeTime'; +import { getSignalGist } from 'lib/fetcher'; +import Image from 'next/image'; +import Link from 'next/link'; +import { notFound } from 'next/navigation'; +import avatar from 'public/images/img/avatar.svg'; + +export const revalidate = 600; + +dayjs.extend(relativeTime); + +export default async function Page({ + params, +}: { + params: { + id: string; + }; +}) { + if (typeof params.id !== 'string') notFound(); + const gist = await getSignalGist(params.id); + if (!gist || !gist.files) notFound(); + + return ( + <> +
+
+
+ Avatar +

+ + {gist.login} + + /{Object.keys(gist.files)[0]} +

+
+ +

+ Last active: {dayjs(gist.updated_at).fromNow()} +

+ +
+

{gist.description}

+ + {Object.keys(gist.files).map((f) => ( + + ))} +
+
+
+ + ); +} \ No newline at end of file diff --git a/app/g/layout.tsx b/app/g/layout.tsx new file mode 100644 index 0000000..0bcc9e5 --- /dev/null +++ b/app/g/layout.tsx @@ -0,0 +1,11 @@ +import { ReactNode } from 'react'; + +export const revalidate = 600; + +export default async function PageLayout({ + children, +}: { + children: ReactNode; +}) { + return <>{children}; +} \ No newline at end of file diff --git a/app/gists/layout.tsx b/app/gists/layout.tsx index 2c1688e..9c94570 100644 --- a/app/gists/layout.tsx +++ b/app/gists/layout.tsx @@ -1,7 +1,7 @@ -import UserInfo from './user-info'; -import { ReactNode, Suspense } from 'react'; -import UserInfoLoading from './user-info-skeleton'; import { Metadata } from 'next'; +import { ReactNode, Suspense } from 'react'; +import UserInfo from './user-info'; +import UserInfoLoading from './user-info-skeleton'; export const revalidate = 600; export const metadata: Metadata = { @@ -29,4 +29,4 @@ export default async function PageLayout({ ); -} +} \ No newline at end of file