feat: update hero landing
This commit is contained in:
parent
ddc2484cc3
commit
317c5ebd92
|
|
@ -69,15 +69,19 @@ const HeroModal = ({
|
|||
const swiperRef = useRef<SwiperClass | null>(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"}
|
||||
</span>
|
||||
|
||||
<Link href={`${prefixPath}/image/detail/${list?.slug}`}>
|
||||
<Link
|
||||
href={
|
||||
Number(list?.fileTypeId) == 1
|
||||
? `${prefixPath}/image/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 2
|
||||
? `${prefixPath}/video/detail/${list?.slug}`
|
||||
: Number(list?.fileTypeId) == 3
|
||||
? `${prefixPath}/document/detail/${list?.slug}`
|
||||
: `${prefixPath}/audio/detail/${list?.slug}`
|
||||
}
|
||||
>
|
||||
<h2 className="text-lg leading-tight">{list?.title}</h2>
|
||||
</Link>
|
||||
|
||||
|
|
@ -408,7 +422,12 @@ const HeroNew = (props: { group?: string }) => {
|
|||
<div className="flex items-start justify-center mx-auto w-auto">
|
||||
<div className="relative">
|
||||
{showModal && (
|
||||
<HeroModal onClose={() => setShowModal(false)} group={props.group || "mabes"} />
|
||||
<HeroModal
|
||||
onClose={() => setShowModal(false)}
|
||||
group={props.group || "mabes"}
|
||||
poldaName={poldaName as string}
|
||||
satkerName={satkerName as string}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{isLoading ? (
|
||||
|
|
|
|||
Loading…
Reference in New Issue