import { connection } from "next/server";
import { loadWalks } from "@/data/queries";
import { HomeWalkingList } from "./HomeWalkingList";
import { HomeEmptyState } from "../../HomeEmptyState";

export default async function WalkingPage() {
  await connection();
  const walks = await loadWalks();

  if (walks.length === 0) {
    return <HomeEmptyState message="you're not walking any trails right now" />;
  }

  return <HomeWalkingList walks={walks} />;
}
