From f8abbeace1861d0b291c841ad10a68b82fd3eb6a Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Mon, 2 Feb 2026 16:08:56 +0800 Subject: [PATCH] update banner,agent landingpage --- components/landing-page/agent.tsx | 80 ++++++++------ components/landing-page/footer.tsx | 2 +- components/landing-page/header.tsx | 163 ++++++++++++----------------- components/landing-page/navbar.tsx | 2 +- components/landing-page/video.tsx | 47 ++++++++- public/jaecoobot.png | Bin 0 -> 1736 bytes public/jaecoonew.png | Bin 0 -> 2305 bytes 7 files changed, 163 insertions(+), 131 deletions(-) create mode 100644 public/jaecoobot.png create mode 100644 public/jaecoonew.png diff --git a/components/landing-page/agent.tsx b/components/landing-page/agent.tsx index 8cd6ce7..46086e1 100644 --- a/components/landing-page/agent.tsx +++ b/components/landing-page/agent.tsx @@ -2,36 +2,52 @@ import Image from "next/image"; import { motion } from "framer-motion"; +import { useEffect, useState } from "react"; +import { getAgentData } from "@/service/agent"; -const agents = [ - { - name: "Henny", - title: "Branch Manager Jaecoo Kelapa Gading", - image: "/henny.png", - }, - { - name: "Zamroni", - title: "Spv Jaecoo Kelapa Gading", - image: "/zamroni.png", - }, - { - name: "Murtiyono", - title: "Spv Jaecoo Kelapa Gading", - image: "/murtiyono.jpg", - }, - { - name: "Sutino", - title: "Spv Jaecoo Kelapa Gading", - image: "/sutino.png", - }, - // { - // name: "Amendra Ismail", - // title: "Spv Jaecoo Kelapa Gading", - // image: "/amendra.png", - // }, -]; +type Agent = { + id: number; + name: string; + job_title: string; + status_id: number; + profile_picture_url: string; + created_at: string; +}; export default function Agent() { + const [agents, setAgents] = useState([]); + + useEffect(() => { + const fetchAgents = async () => { + try { + const req = { + limit: "10", + page: 1, + search: "", + }; + + const res = await getAgentData(req); + + const agentsData: Agent[] = res?.data?.data || []; + + const latestApprovedAgents = agentsData + .filter((agent) => agent.status_id === 2) // ✅ approved only + .sort( + (a, b) => + new Date(b.created_at).getTime() - + new Date(a.created_at).getTime(), + ) // ✅ newest first + .slice(0, 5); // ✅ max 5 + + setAgents(latestApprovedAgents); + } catch (error) { + console.error("Failed to fetch agents:", error); + } + }; + + fetchAgents(); + }, []); + return (
{agents.map((agent, index) => (
{agent.name}
+

{agent.name}

+

- {agent.title} + {agent.job_title}

))} diff --git a/components/landing-page/footer.tsx b/components/landing-page/footer.tsx index 065f3bf..793f244 100644 --- a/components/landing-page/footer.tsx +++ b/components/landing-page/footer.tsx @@ -6,7 +6,7 @@ export default function Footer() {
Jaecoo([]); + + useEffect(() => { + const fetchBanners = async () => { + try { + const req = { + limit: "10", + page: 1, + search: "", + }; + + const res = await getBannerData(req); + + const bannerData: Banner[] = res?.data?.data || []; + + const activeBanners = bannerData + .filter((banner) => banner.status_id === 2) // ✅ approved only + .sort((a, b) => { + const posA = Number(a.position); + const posB = Number(b.position); + + if (posA !== posB) return posA - posB; + + return ( + new Date(b.created_at).getTime() - + new Date(a.created_at).getTime() + ); + }); + + setBanners(activeBanners); + } catch (err) { + console.error("Failed to fetch banners:", err); + } + }; + + fetchBanners(); + }, []); - // ✅ Gunakan useRef untuk plugin autoplay const plugin = useRef(Autoplay({ delay: 4000, stopOnInteraction: false })); return (
- + - {heroImages.map((img, index) => ( - + {banners.map((banner, index) => ( +
{`JAECOO - {index === 0 && ( + {/* {index === 0 && (
- JAECOO J7 SHS-P + {banner.title} - - DELICATE OFF-ROAD SUV - - - - - - - - - -
- MAS JAECOO Logo -
- - - FORM TEST DRIVE - - + {banner.description} + + )} -
- - - - -
- -
-