import type { Metadata } from "next"; import { cookies } from "next/headers"; import { getFeed, getMe, Me } from "@/lib/api"; import { ThoughtForm } from "@/components/thought-form"; import { EmptyState } from "@/components/empty-state"; import { Button } from "@/components/ui/button"; import Link from "next/link"; import { PopularTags } from "@/components/popular-tags"; import { ThoughtThread } from "@/components/thought-thread"; import { buildThoughtThreads } from "@/lib/utils"; import { TopFriends } from "@/components/top-friends"; import { UsersCount } from "@/components/users-count"; import { PaginationNav } from "@/components/pagination-nav"; import { redirect } from "next/navigation"; import { Suspense } from "react"; import { ProfileSkeleton, TagsSkeleton, CountSkeleton, } from "@/components/loading-skeleton"; export const metadata: Metadata = { title: "Home", description: "Your home timeline — thoughts from people you follow", }; export default async function Home({ searchParams, }: { searchParams: Promise<{ page?: string }>; }) { const token = (await cookies()).get("auth_token")?.value ?? null; const resolvedSearchParams = await searchParams; if (token) { return ; } else { return ; } } async function FeedPage({ token, searchParams, }: { token: string; searchParams: { page?: string }; }) { const page = parseInt(searchParams.page ?? "1", 10); const [feedData, me] = await Promise.all([ getFeed(token, page).catch(() => null), getMe(token).catch(() => null) as Promise, ]); if (!feedData || !me) { redirect("/login"); } const { items: allThoughts, totalPages } = feedData!; const thoughtThreads = buildThoughtThreads(allThoughts); const sidebar = ( <> }> }> }> ); return (

Your Feed

{sidebar}
{thoughtThreads.map((thought) => ( ))} {thoughtThreads.length === 0 && ( )}
`/?page=${p}`} />
); } function LandingPage() { return (
{/* Ambient orbs */}
{/* Hero card */}
{/* Gloss sweep */}

Welcome to Thoughts

A federated social network for short-form thoughts.
Connect with the Fediverse.

{/* Fediverse badge */}
Works with Mastodon, Pixelfed & more
); }