import { db } from "~/server/db";

export default async function AllRegions() {
  const allRegions = await db.query.regions.findMany();
  return (
    <div className="pt-4">
      <h1 className="text-2xl">All Regions:</h1>
      {allRegions[0] ? (
        <>
          <ul>
            {allRegions.map((region) => (
              <li key={region.id}>{region.name}</li>
            ))}
          </ul>
        </>
      ) : (
        <p>There are no regions in the db.</p>
      )}
    </div>
  );
}
