From 317c5ebd929c69f6e452fe324d433a07e807bb40 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Tue, 15 Jul 2025 07:12:44 +0700 Subject: [PATCH] feat: update hero landing --- components/landing-page/hero-new.tsx | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/components/landing-page/hero-new.tsx b/components/landing-page/hero-new.tsx index b55b8269..022c4db0 100644 --- a/components/landing-page/hero-new.tsx +++ b/components/landing-page/hero-new.tsx @@ -69,15 +69,19 @@ const HeroModal = ({ const swiperRef = useRef(null); const pathname = usePathname(); - if (pathname?.includes("/polda") || pathname?.includes("/satker")) { - return null; - } + // Remove the early return condition that was preventing modal from showing on polda/satker paths + // if (pathname?.includes("/polda") || pathname?.includes("/satker")) { + // return null; + // } - let prefixPath = poldaName - ? `/polda/${poldaName}` - : satkerName - ? `/satker/${satkerName}` - : ""; + // Fix prefixPath logic to handle all content types properly + let prefixPath = ""; + if (group === "polda" && poldaName) { + prefixPath = `/polda/${poldaName}`; + } else if (group === "satker" && satkerName) { + prefixPath = `/satker/${satkerName}`; + } + // For mabes group, prefixPath remains empty string useEffect(() => { console.log("Show modal popup list"); @@ -162,7 +166,17 @@ const HeroModal = ({ {list?.categoryName || "Liputan Kegiatan"} - +

{list?.title}

@@ -408,7 +422,12 @@ const HeroNew = (props: { group?: string }) => {
{showModal && ( - setShowModal(false)} group={props.group || "mabes"} /> + setShowModal(false)} + group={props.group || "mabes"} + poldaName={poldaName as string} + satkerName={satkerName as string} + /> )}
{isLoading ? (