import { globalService } from "@/services/global";
import { parseSettings } from "@/utils/parse-settings";
import React from "react";
import { Footer } from "@/components/footer";
import { ClientOnly } from "@/components/client-only/client-only";

const WithFooterPagesLayout = async ({ children }: { children: React.ReactNode }) => {
  const settings = await globalService.settings();
  const parsedSettings = parseSettings(settings?.data);
  return (
    <>
      {children}
      <ClientOnly
        fallback={<div className="bg-footerBg pt-12 pb-5 min-h-[280px]" aria-hidden />}
      >
        <Footer settings={parsedSettings} />
      </ClientOnly>
    </>
  );
};

export default WithFooterPagesLayout;
