import Link from "next/link"; import { getPublicRepositories } from "@/actions/repositories"; import { Button } from "@/components/ui/button"; import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"; import { Star, GitBranch, ChevronLeft, ChevronRight, Compass, Clock, Flame, Sparkles } from "lucide-react"; import { formatDistanceToNow } from "date-fns"; const SORT_OPTIONS = [ { value: "stars", label: "Most stars", icon: Flame }, { value: "updated", label: "Recently updated", icon: Clock }, { value: "created", label: "Newest", icon: Sparkles }, ] as const; export default async function ExplorePage({ searchParams }: { searchParams: Promise<{ sort?: string; page?: string }> }) { const { sort: sortParam, page: pageParam } = await searchParams; const sortBy = (["stars", "updated", "created"].includes(sortParam || "") ? sortParam : "stars") as "stars" | "updated" | "created"; const page = parseInt(pageParam || "1", 10); const perPage = 20; const offset = (page - 1) * perPage; const { repos, hasMore } = await getPublicRepositories(sortBy, perPage, offset); return (
Discover public repositories from the community
Be the first to create a public repository!
{repo.description}
}