industry.js 3.24 KB
import React from "react";
import PageBanner from "@/components/reuseables/PageBanner";
import Education from "@/container/IndustryFocus/Education";
import Hospitality from "@/container/IndustryFocus/Hospitality";
import LifeSciences from "@/container/IndustryFocus/LifeSciences";
import RealEstate from "@/container/IndustryFocus/RealEstate";
import Technology from "@/container/IndustryFocus/Technology";
import axios from 'axios';
import qs from 'qs';
import { cleanImage } from "@/layout/imageHandling";
import IndustryOverview from "@/container/IndustryFocus/IndustryOverview";
import IndustryTab from "@/container/IndustryFocus/IndustryTab";
import Seo from "@/components/reuseables/Seo/Seo";
import IndustryClientele from "@/components/reuseables/IndustryClientele";


const industry = ({ IndustryPage }) => {
  console.log("conatct", IndustryPage)
  const dynamicdata = IndustryPage?.IndustryDetails;
  console.log(dynamicdata , "dynamicdata")
  const banners = [
    {
      imageSrc: cleanImage(IndustryPage?.Banner?.Image?.url),
      pageTitle: IndustryPage?.Banner?.Heading,
      homePageUrl: "/",
      homePageText: "Home",
      activePageText: IndustryPage?.Banner?.Heading,
    },
  ];
  const seo = IndustryPage?.seo;

  
  // console.log(seo, "seo")

  return (
    <>
      <Seo seo={seo} />
       <PageBanner banners={banners} />
     
       <section className="industry-details-page">
        {dynamicdata &&
          dynamicdata?.map((section, index) => {
            console.log("section", section);
            switch (section.__component) {
              case "layout.industry-overview":
                return  <IndustryOverview  title={section?.title} subtitle={section?.subtitle} description={section?.Description} image={section?.Image}/>;
                case "layout.cfo-service":
                  return   <IndustryTab
                  serviceTitle={section?.Title}
                  services={section?.IndustryServiceList} 
                />
                case "layout.clientel":
                  return   <IndustryClientele
                  partners={section?.logos}
                
                />
              default:
                return null;
            }
          })}
      </section>

      {/* <Education /> */}
      {/* <Education />
      <LifeSciences />
      <Technology />
      <RealEstate />
      <Hospitality /> */}
    </>
  );
};

export default industry;


export async function getServerSideProps() {
  try {
    const query1 = {
      populate: [
        "Banner.Image",
        "IndustryDetails",
        "IndustryDetails.Image",
        "IndustryDetails.logos",
        "IndustryDetails.IndustryServiceList",
        "IndustryDetails.IndustryServiceList.CfoList",
       "IndustryDetails.IndustryServiceList.CfoList.Icon",
       "seo",
       "seo.metaImage",
       "seo.schema",
      ],
    };

    const query1String = qs.stringify(query1, {
      encodeValuesOnly: true,
    });

    const endpoint1 = `${process.env.NEXT_PUBLIC_BACKEND_API_URL}/api/industry-page?${query1String}`;
    console.log(`Final url: ${endpoint1}`);

    const response1 = await axios.get(endpoint1);
    const IndustryPage = response1.data.data;

    return {
      props: { IndustryPage },
    };
  } catch (error) {
    console.log("Error", error);
  }
}