2024-11-22 10:59:58 +00:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { HumasLayout } from "@/components/layout/humas-layout";
|
2025-05-04 07:14:12 +00:00
|
|
|
import { getCustomStaticDetailBySlug } from "@/services/static-page-service";
|
2025-02-13 08:25:39 +00:00
|
|
|
import { Card, CircularProgress } from "@heroui/react";
|
2024-11-22 10:59:58 +00:00
|
|
|
import { useParams } from "next/navigation";
|
|
|
|
|
import { useEffect, useState } from "react";
|
|
|
|
|
|
|
|
|
|
export default function StaticPage() {
|
|
|
|
|
const params = useParams();
|
|
|
|
|
const slug = params.slug;
|
2024-11-26 11:59:43 +00:00
|
|
|
const [customData, setCustomData] = useState<any>();
|
2024-11-22 10:59:58 +00:00
|
|
|
|
|
|
|
|
useEffect(() => {
|
2024-11-26 11:59:43 +00:00
|
|
|
setCustomData(undefined);
|
2024-11-22 10:59:58 +00:00
|
|
|
initFetch();
|
|
|
|
|
}, [slug]);
|
|
|
|
|
|
|
|
|
|
const initFetch = async () => {
|
|
|
|
|
const res = await getCustomStaticDetailBySlug(slug ? String(slug) : "");
|
|
|
|
|
const data = res?.data?.data;
|
2024-11-26 11:59:43 +00:00
|
|
|
setCustomData(data);
|
2024-11-22 10:59:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const [hasMounted, setHasMounted] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
setHasMounted(true);
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
if (!hasMounted) return null;
|
|
|
|
|
return (
|
|
|
|
|
<HumasLayout>
|
2024-11-26 11:59:43 +00:00
|
|
|
{customData ? (
|
|
|
|
|
<>
|
|
|
|
|
<div className="flex justify-center items-center">
|
|
|
|
|
<div className="pt-4 hidden md:block">
|
|
|
|
|
<img src="/al.png" alt="" className="" />
|
|
|
|
|
</div>
|
|
|
|
|
<div className="font-bold text-lg md:text-2xl text-[#DD8306]">
|
|
|
|
|
{customData?.title}
|
|
|
|
|
</div>
|
|
|
|
|
<div className="hidden md:block absolute pb-10 pl-[310px]">
|
|
|
|
|
<img src="spark.png" alt="" />
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="rounded-md p-2 md:px-10 ">
|
|
|
|
|
<div dangerouslySetInnerHTML={{ __html: customData?.htmlBody }} />
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
) : (
|
|
|
|
|
<div className="w-full justify-center flex">NO DATA</div>
|
|
|
|
|
)}
|
2024-11-22 10:59:58 +00:00
|
|
|
</HumasLayout>
|
|
|
|
|
);
|
|
|
|
|
}
|