import { Link } from "waku";
import db from "../lib/db";

export default async function AboutPage() {
  const data = await getData();

  return (
    <div>
      <title>Well</title>
      <div className="flex flex-wrap gap-4">
        {data.categories.categories.map((cat) => (
          <div key={cat} className="p-2 cursor-pointer border-2 border-solid">
            {cat}
          </div>
        ))}
      </div>
      <Link to="/" className="mt-4 inline-block underline">
        Return home
      </Link>
    </div>
  );
}

const getData = async () => {
  const categories = db.fetchCats();
  const eng = db.fetchLanguage("en");

  return { categories, eng };
};

export const getConfig = async () => {
  return {
    render: "static",
  } as const;
};
