"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) => ( ))}
)}
); }