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 swiperRef = useRef<SwiperClass | null>(null);
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
|
|
||||||
if (pathname?.includes("/polda") || pathname?.includes("/satker")) {
|
// Remove the early return condition that was preventing modal from showing on polda/satker paths
|
||||||
return null;
|
// if (pathname?.includes("/polda") || pathname?.includes("/satker")) {
|
||||||
}
|
// return null;
|
||||||
|
// }
|
||||||
|
|
||||||
let prefixPath = poldaName
|
// Fix prefixPath logic to handle all content types properly
|
||||||
? `/polda/${poldaName}`
|
let prefixPath = "";
|
||||||
: satkerName
|
if (group === "polda" && poldaName) {
|
||||||
? `/satker/${satkerName}`
|
prefixPath = `/polda/${poldaName}`;
|
||||||
: "";
|
} else if (group === "satker" && satkerName) {
|
||||||
|
prefixPath = `/satker/${satkerName}`;
|
||||||
|
}
|
||||||
|
// For mabes group, prefixPath remains empty string
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log("Show modal popup list");
|
console.log("Show modal popup list");
|
||||||
|
|
@ -162,7 +166,17 @@ const HeroModal = ({
|
||||||
{list?.categoryName || "Liputan Kegiatan"}
|
{list?.categoryName || "Liputan Kegiatan"}
|
||||||
</span>
|
</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>
|
<h2 className="text-lg leading-tight">{list?.title}</h2>
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
|
@ -408,7 +422,12 @@ const HeroNew = (props: { group?: string }) => {
|
||||||
<div className="flex items-start justify-center mx-auto w-auto">
|
<div className="flex items-start justify-center mx-auto w-auto">
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
{showModal && (
|
{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>
|
</div>
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue