import { useTranslation } from "react-i18next";
import { lazy, Suspense } from "react";
import { Spin } from "antd";
import useSetPageTitle from "../../../Hooks/useSetPageTitle";
import PageHeader from "../../../Layout/Dashboard/PageHeader";
import FilterLayout from "../../../Layout/Dashboard/FilterLayout";
import FilterForm from "./Model/FilterForm";
import CollectionsCards from "./Model/CollectionsCards";
const Table = lazy(() => import("./Table"));

const TableHeader = () => {
  const [t] = useTranslation();
  useSetPageTitle([
    { name: `${t(`page_header.home`)}`, path: "/" },
    { name: `${t(`page_header.collections`)}`, path: "collections" },
  ]);

  return (
    <div className="TableWithHeader">
      <Suspense fallback={<Spin />}>
        <PageHeader pageTitle="collections" />
        <div className="collection_infos">
          <CollectionsCards />
        </div>
        <FilterLayout
          sub_children={<FilterForm />}
          filterTitle="table.collections"
          haveSearch={false}
        />
        <Table />
      </Suspense>
    </div>
  );
};

export default TableHeader;
