import Cart from "@/features/cart";
import React from "react";
import SEO from "@/components/shared/SEO";
import { useHome } from "@/context/helpers/Home/HomeContext";
import { useRouter } from "next/router";
import { useTranslation } from "react-i18next";

export default function CartPage() {
  const { t } = useTranslation("cart");
  const router = useRouter();
  const { companyData } = useHome();

  const baseUrl =
    typeof window !== "undefined"
      ? window.location.origin
      : companyData?.domain
        ? `https://${companyData.domain}`
        : "";
  const cartUrl = `${baseUrl}${router.asPath}`;

  return (
    <>
      <SEO
        title={t("seo.title", "Shopping Cart")}
        description={t(
          "seo.description",
          "Review and manage items in your shopping cart"
        )}
        keywords={t("seo.keywords", "cart, shopping cart, checkout")}
        url={cartUrl}
        type="website"
        noindex={true}
      />

      <Cart />
    </>
  );
}
