From be9b9d6ba3306f81c682a8494ecf2165d2bc01a2 Mon Sep 17 00:00:00 2001 From: Leo dev Date: Thu, 7 Aug 2025 13:52:10 -0500 Subject: [PATCH] Added a newsto the landing page --- src/app/page.tsx | 67 ++++++++++++++++++++++++++++++++++++++-- src/components/Table.tsx | 41 +++++++++++++++++------- 2 files changed, 95 insertions(+), 13 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 6fd9b4a..2a11060 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,18 +1,81 @@ import SpeedrunTable, { Speedrun } from "@/components/Table"; +import { timeAgo } from "@/lib/utils"; + +interface NewsPreview { + title: string; + description: string; + author: string; + date: number; +} + +function NewsPost({ post }: { post: NewsPreview }) { + return ( +
+

{post.title}

+

{post.description}

+
+
+
+

{post.author}

+

+ {timeAgo(post.date)} +

+
+
+
+ ); +} export default function Home() { const users: Speedrun[] = [ - { rank: 1, name: 'Kleo', time: 63, problem: 'Two Sum', date: 1651600541000 }, + { + rank: 1, + name: "Kleo", + time: 63, + problem: "Two Sum", + date: 1651600541000, + }, ]; return ( <>
-
+
+
+
+

LATEST NEWS

+
+ + + +
+
+
); diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 1383c47..b0f6796 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -1,6 +1,6 @@ -import { format, timeAgo } from '@/lib/utils'; -import { formatDate } from 'date-fns'; -import React from 'react'; +import { format, timeAgo } from "@/lib/utils"; +import { formatDate } from "date-fns"; +import React from "react"; export interface Speedrun { rank: number; @@ -20,11 +20,21 @@ const SpeedrunTable: React.FC = ({ data }) => { - - - - - + + + + + @@ -34,9 +44,18 @@ const SpeedrunTable: React.FC = ({ data }) => { className="hover:bg-[#1f1f1f] transition-colors border-b border-[#1e1e1e]" > - - - + + + ))}
#PlayerTimeDateProblem + # + + Player + + Time + + Date + + Problem +
{user.rank}{user.name}{format(user.time)}{timeAgo(user.date)} + {user.name} + + {format(user.time)} + + {timeAgo(user.date)} + {user.problem}