// app/page.tsx import { cookies } from "next/headers"; import { getFeed, getMe, getUserProfile, Me } from "@/lib/api"; import { ThoughtCard } from "@/components/thought-card"; import { PostThoughtForm } from "@/components/post-thought-form"; import { Button } from "@/components/ui/button"; import Link from "next/link"; import { PopularTags } from "@/components/popular-tags"; // This is now an async Server Component export default async function Home() { const token = (await cookies()).get("auth_token")?.value ?? null; if (token) { return ; } else { return ; } } async function FeedPage({ token }: { token: string }) { const feedData = await getFeed(token); const me = (await getMe(token).catch(() => null)) as Me | null; const authors = [...new Set(feedData.thoughts.map((t) => t.authorUsername))]; const userProfiles = await Promise.all( authors.map((username) => getUserProfile(username, token).catch(() => null)) ); const authorDetails = new Map( userProfiles .filter(Boolean) .map((user) => [user!.username, { avatarUrl: user!.avatarUrl }]) ); return (

Your Feed

{feedData.thoughts.map((thought) => ( ))} {feedData.thoughts.length === 0 && (

Your feed is empty. Follow some users to see their thoughts here!

)}
); } function LandingPage() { return (

Welcome to Thoughts

Your space on the decentralized web.

); }