"use client";
import { AddIcon } from "@/components/icons";
import ArticleTable from "@/components/table/article-table";
import generatedArticleIds from "@/store/generated-article-store";
import { Button, Card } from "@nextui-org/react";
import Link from "next/link";
import { useRouter } from "next/navigation";

export default function BasicPage() {
  const router = useRouter();
  const setGeneratedArticleIdStore = generatedArticleIds(
    (state) => state.setArticleIds
  );
  const goGenerate = () => {
    setGeneratedArticleIdStore({
      singleArticle: [],
      bulkArticle: [],
      rewriteArticle: [],
    });
    router.push("/admin/article/generate");
  };

  return (
    <div className="overflow-x-hidden overflow-y-scroll">
      <div className="px-2 md:px-4 w-full">
        <div className="rounded-md my-5 px-5 py-2 bg-white dark:bg-[#18181b] flex flex-row gap-3">
          <Link href="/admin/article/create">
            <Button size="md" className="bg-[#F07C00] text-white">
              New Article
              <AddIcon />
            </Button>
          </Link>
          {/* <Button
            size="md"
            color="primary"
            className="bg-[#F07C00] text-white"
            onPress={goGenerate}
          >
            <AddIcon />
            Generate Article
          </Button> */}
        </div>
        <div className="bg-white dark:bg-[#18181b] rounded-xl p-2">
          <ArticleTable />
        </div>
      </div>
    </div>
  );
}
