import MainProductSection from "@/components/index/mainProductSection";
import React from "react";
import Head from "next/head";
import { customerApi } from "@/api/api";
import FadeInContainer from "@/components/utils/animation/fadeInContainer";
const About = ({ siteText, metaData }) => {
  return (
    <React.Fragment>
      <Head>
        <title>
          {metaData.meta_title
            ? metaData.meta_title
            : "Wyt Signature Cake - " + process.env.NEXT_PUBLIC_COMPANY_NAME}
        </title>
        <meta charset="UTF-8" />
        <meta name="description" content={metaData.meta_description} />
        <meta
          name="keywords"
          content={
            metaData.meta_keywords && metaData.meta_keywords.length > 0
              ? metaData.meta_keywords.join(",")
              : ""
          }
        />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
      </Head>
      <FadeInContainer loadVisibile={true} delay={500}>
        <div className={`container my-3`}>
          <MainProductSection siteText={siteText.signature_cake} />
        </div>
      </FadeInContainer>
    </React.Fragment>
  );
};

export default About;

export const getStaticProps = async (ctx) => {
  let siteText = {};
  let metaData = {};
  await Promise.all([
    customerApi.get("/site/contents?group_code=signature_cake_section"),
    customerApi.get("/site/meta?path=/wyt-signature-cake"),
  ]).then((res) => {
    let newArray = { ...res[0].data.result };
    siteText = newArray;
    metaData = res[1].data.data;
  });
  return {
    props: {
      siteText: siteText,
      metaData: metaData,
    },
    revalidate: 600,
  };
};
