import { Suspense } from "react"; import { connection } from "next/server"; 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, Loader2 } 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; async function RepoGrid({ sortBy, page, perPage }: { sortBy: "stars" | "updated" | "created"; page: number; perPage: number }) { await connection(); const offset = (page - 1) * perPage; const { repos, hasMore } = await getPublicRepositories(sortBy, perPage, offset); if (repos.length === 0) { return (
Be the first to create a public repository!
{repo.description}
}Discover public repositories from the community