"use client";

import React from "react";
import { DotLoading } from "antd-mobile";
import Empty from "@/components/Empty";
import { useRouter } from "next/navigation";
export default function InfiniteScrollContent({
  hasMore = 0,
  isEmpty,
  showNoMore = true,
  zoneEmpty = false,
  type = "nodata",
}) {
  const router = useRouter();
  return (
    <>
      {hasMore ? (
        <>
          <span>加载中</span>
          <DotLoading />
        </>
      ) : !showNoMore ? null : !isEmpty ? (
        <span>没有更多了</span>
      ) : (
        <div
          className={`flex flex-col items-center mt-28`}
          // style={{ height: `${scrollHeight}px` }}
        >
          <Empty type={type} />
          {zoneEmpty && (
            <div className="text-white">
              <p
                onClick={() => router.push("/search")}
                className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
              >
                搜索空间
              </p>
              <p
                onClick={() => router.push("/found")}
                className="text-base font-medium flex items-center justify-center bg-[#FFFFFF1A] mt-2 rounded-full w-[190px] h-[46px]"
              >
                查看推荐
              </p>
            </div>
          )}
        </div>
      )}
    </>
  );
}