diff --git a/vault/app/page.tsx b/vault/app/page.tsx new file mode 100644 index 0000000..77d9272 --- /dev/null +++ b/vault/app/page.tsx @@ -0,0 +1,45 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { Hero } from "@/components/hero"; +import { SnippetCard } from "@/components/snippet-card"; +import { api } from "@/lib/api-client"; +import { Snippet } from "@/lib/types"; +import Link from "next/link"; +import { Button } from "@/components/ui/button"; +import { ArrowRight } from "lucide-react"; + +export default function HomePage() { + const [snippets, setSnippets] = useState([]); + + useEffect(() => { + api.listSnippets() + .then(({ snippets }) => setSnippets(snippets.slice(0, 3))) + .catch(() => setSnippets([])); + }, []); + + return ( +
+ + + {snippets.length > 0 && ( +
+
+

Recent snippets

+ + + +
+
+ {snippets.map((snippet, i) => ( + + ))} +
+
+ )} +
+ ); +}