From 84e6c24472a64b32b033771bad7f32fab7d217b8 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Thu, 27 Feb 2025 23:05:04 -0800 Subject: [PATCH] cringe --- src/app/page.tsx | 142 ++++++++++++++++++------------- src/components/layout/header.tsx | 28 +++--- 2 files changed, 96 insertions(+), 74 deletions(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index c8d71a2..6d7c615 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,67 +1,87 @@ -import ThingCurve from "@/components/3d/curves/thing"; -import RenderedSection from "@/components/3d/renderedsection"; -import AgeHCyclesDisplay from "@/components/age"; import ExternalNav from "@/components/externalnav"; -import fonts from "@/components/fonts"; import ILink from "@/components/ilink"; -import { - Card, - CardContent, - CardDescription, - CardHeader, - CardTitle, -} from "@/components/ui/card"; -import { cn } from "@/lib/utils"; +import fs from 'fs/promises'; +import path from 'path'; +import matter from 'gray-matter'; +import Link from 'next/link'; + +type PostMeta = { + title: string; + createdAt: string; + slug: string; +}; + +async function getRecentPosts(): Promise { + const postsDirectory = path.join(process.cwd(), 'content/essays'); + const files = await fs.readdir(postsDirectory); + + const posts = await Promise.all( + files + .filter(file => file.endsWith('.mdx')) + .map(async (file) => { + const fullPath = path.join(postsDirectory, file); + const fileContents = await fs.readFile(fullPath, 'utf8'); + const { data } = matter(fileContents); + + return { + title: data.title, + createdAt: data.createdAt, + slug: file.replace(/\.mdx$/, ''), + }; + }) + ); + + return posts + .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()) + .slice(0, 2); // Get only the 2 most recent posts +} + +export default async function Home() { + const recentPosts = await getRecentPosts(); -export default function Home() { return ( -
- - - - Elias Almqvist - - - I am a{" "} - { - - }{" "} - hydrogen-line-cycles{" "} - (± 2 mHz){" "} - old human- founder, engineer, - and hacker with a passion for CS, physics, and mathematics. - - - CEO of{" "} - - Exa Laboratories (YC S24) - - . Some of my projects are open-source (FOSS), and if you are - interested, you can find them on my{" "} - - self-hosted git-server - {" "} - or{" "} - - GitHub - - . - - - - - - - - -
+
+
+ {/* Intro */} +
+

Elias Almqvist

+

+ CEO of{" "} + + Exa Laboratories (YC S24) + + . Building energy-efficient chips for AI training & inference. +

+
+ + {/* Recent Essays */} +
+
+

Recent Essays

+ + View all → + +
+
    + {recentPosts.map((post) => ( +
  • + +

    {post.title}

    + + +
  • + ))} +
+
+ + {/* External Links */} + +
+
); } diff --git a/src/components/layout/header.tsx b/src/components/layout/header.tsx index dede854..2142a54 100644 --- a/src/components/layout/header.tsx +++ b/src/components/layout/header.tsx @@ -9,19 +9,21 @@ import ExternalNav from "../externalnav"; const Header = () => (
-
-
- -

collected sayings of an insane sane person

- -
-
- {/* */} - - +
+
+
+ +

collected sayings of an insane sane person

+ +
+
+ {/* */} + + +
{/* */}