"use client"

import { LoadingBox } from "@/component/Common/LoadingBox"
import NotFoundBox from "@/component/Notfound"
import { useTranslations } from "next-intl"

interface IProps {
  result: React.ReactNode
  isLoading?: boolean
  isShowResult?: boolean
  contentNotFound?: React.ReactNode
  icon?: string
}

export const LoadingResult = ({ isLoading, isShowResult, result, contentNotFound, icon }: IProps) => {
  const transMusic = useTranslations("music")

  return isLoading ? (
    <LoadingBox icon={icon} />
  ) : isShowResult ? (
    result
  ) : (
    contentNotFound || (
      <NotFoundBox
        className="!bg-white py-8 rounded-3xl"
        backHome={false}
        message={transMusic("we_found_nothing_here")}
      />
    )
  )
}
