diff --git a/app/page.tsx b/app/page.tsx index 4440f64..fe71c97 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -1,4 +1,5 @@ "use client"; +import BannerHumasNew from "@/components/landing/banner-new"; import BannerHumas from "@/components/landing/BannerHumas"; import BodyLayout from "@/components/landing/BodyLayout"; import HeaderNews from "@/components/landing/HeaderNews"; @@ -18,7 +19,7 @@ export default function Home() { return ( <> - + diff --git a/components/icons.tsx b/components/icons.tsx index 6502d26..fa13b3d 100644 --- a/components/icons.tsx +++ b/components/icons.tsx @@ -331,7 +331,7 @@ export const ChevronUpIcon = ({ {...props} > diff --git a/components/landing/BodyLayout.tsx b/components/landing/BodyLayout.tsx index 1c16ef2..217bcec 100644 --- a/components/landing/BodyLayout.tsx +++ b/components/landing/BodyLayout.tsx @@ -1,26 +1,27 @@ "use client"; -import CategorySatker from "./CategorySatker"; -import ENewsPolri from "./ENewsPolri"; -import MediaSocial from "./MediaSocial"; +import AddsCarousel from "./adds-carousel"; import MedolUpdate from "./MedolUpdate"; -import PolriApps from "./PolriApps"; -import RegionalNews from "./RegionalNews"; -import SidebarNav from "./SidebarNav"; +import SocialMediaNew from "./social-media"; export default function BodyLayout() { return ( <> -
-
+
+ {/*
- {/* */} -
-
+ +
*/} + {/*
+
*/} +
+ + +
diff --git a/components/landing/HeaderNews.tsx b/components/landing/HeaderNews.tsx index 628bb46..f99c6ef 100644 --- a/components/landing/HeaderNews.tsx +++ b/components/landing/HeaderNews.tsx @@ -57,308 +57,323 @@ export default function HeaderNews() { limit: "10", sortBy: "view_count", sort: "desc", + isPublish: true, }; const response = await getListArticle(req); setHotNews(response?.data?.data); - console.log("sadadasdasd", response?.data?.data); } return ( -
-
- {article ? ( - { - swiper.navigation.nextEl?.classList.add( - "bg-white/70", - "!text-black", - "rounded-full", - "!w-[24px]", - "!h-[24px]" - ); - swiper.navigation.prevEl?.classList.add( - "bg-white/70", - "!text-black", - "rounded-full", - "!w-[24px]", - "!h-[24px]" - ); - }} - > - {article?.map((newsItem: any, index: number) => ( - - - headernews - - -
- -

- {textEllipsis(newsItem.title, 40)} -

- -

- {convertDateFormat(newsItem.createdAt)} WIB -

-

- - {newsItem.viewCount === null ? 0 : newsItem.viewCount} -

-
-
-
-
- ))} -
- ) : ( - - )} -
-
-

- {t("berita")} -

- - {hotNews?.map((data: any, index: number) => ( -
+
+
+ {article ? ( + { + swiper.navigation.nextEl?.classList.add( + "bg-white/70", + "!text-black", + "rounded-full", + "!w-[24px]", + "!h-[24px]" + ); + swiper.navigation.prevEl?.classList.add( + "bg-white/70", + "!text-black", + "rounded-full", + "!w-[24px]", + "!h-[24px]" + ); + }} > - headernews -
- - {textEllipsis(data.title, 40)} - - - {textEllipsis(data.title, 66)} - -
-

- {convertDateFormat(data.createdAt)} WIB -

-

- - {data.viewCount === null ? 0 : data.viewCount} -

-
-
-
- ))} - -
- - - -
-
+ {article?.map((newsItem: any, index: number) => ( + + + {/* headernews */} -
- {article ? ( - { - swiper.navigation.nextEl?.classList.add( - "bg-white/70", - "!text-black", - "rounded-full", - "!w-[48px]", - "!h-[48px]" - ); - swiper.navigation.prevEl?.classList.add( - "bg-white/70", - "!text-black", - "rounded-full", - "!w-[48px]", - "!h-[48px]" - ); - }} - > - {article?.map((newsItem: any, index: number) => ( - - - headernews - - -
- -

- {newsItem.title} -

- -
+ +
+ +

+ {textEllipsis(newsItem.title, 40)} +

+

{convertDateFormat(newsItem.createdAt)} WIB

- + {newsItem.viewCount === null ? 0 : newsItem.viewCount}

-
- - - - ))} - - ) : ( - - )} -
-
- {/* */} - - {selectedTab === "media" ? ( -
- - {article?.map((list: any, index: number) => ( -
- -

{list?.title}

+
+

+ {t("berita")} +

+ + {hotNews?.map((data: any, index: number) => ( +
+ {/* headernews */} +
+ + {textEllipsis(data.title, 40)} -
-

- {convertDateFormat(list?.createdAt)} WIB + + {textEllipsis(data.title, 66)} + +

+

+ {convertDateFormat(data.createdAt)} WIB

-

- - {list?.viewCount === null ? 0 : list?.viewCount} +

+ + {data.viewCount === null ? 0 : data.viewCount}

+
+ ))} + +
+ + + +
+
+ +
+ {article ? ( + { + swiper.navigation.nextEl?.classList.add( + "bg-white/70", + "!text-black", + "rounded-full", + "!w-[40px]", + "!h-[40px]" + ); + swiper.navigation.prevEl?.classList.add( + "bg-white/70", + "!text-black", + "rounded-full", + "!w-[40px]", + "!h-[40px]" + ); + }} + > + {article?.map((newsItem: any, index: number) => ( + + + headernews + + +
+ +

+ {newsItem.title} +

+ +
+

+ {convertDateFormat(newsItem.createdAt)} WIB +

+

+ + {newsItem.viewCount === null + ? 0 + : newsItem.viewCount} +

+
+
+
+
+
))} - - -
- ) : ( -
- - IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - POLRI PRESISI UNTUK - INDONESIA - - - ILM DIVHUMAS POLRI - POLRI PRESISI MENGAWAL PROSES VAKSINASI UNTUK - MENGATASI PANDEMI COVID 19 - - - IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - INDONESIA MENOLAK - RADIKALISME - - - IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - BHABINKAMTIBMAS SAHABAT - MASYARAKAT - -
- )} + + ) : ( + + )} +
+
+ {/* */} + + {selectedTab === "media" ? ( +
+ + + {article?.map((list: any, index: number) => ( +
+ +

{list?.title}

+ +
+

+ {convertDateFormat(list?.createdAt)} WIB +

+

+ + {list?.viewCount === null ? 0 : list?.viewCount} +

+
+
+ ))} +
+ +
+ ) : ( +
+ + + IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - POLRI PRESISI UNTUK + INDONESIA + + + ILM DIVHUMAS POLRI - POLRI PRESISI MENGAWAL PROSES VAKSINASI + UNTUK MENGATASI PANDEMI COVID 19 + + + IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - INDONESIA MENOLAK + RADIKALISME + + + IKLAN LAYANAN MASYARAKAT DIVHUMAS POLRI - BHABINKAMTIBMAS + SAHABAT MASYARAKAT + +
+ )} +
); diff --git a/components/landing/MedolUpdate.tsx b/components/landing/MedolUpdate.tsx index 37f28d8..9b04591 100644 --- a/components/landing/MedolUpdate.tsx +++ b/components/landing/MedolUpdate.tsx @@ -21,7 +21,7 @@ import { topNewsInp, topNewsTbn, } from "@/service/third-party-service"; -import { convertDateFormatNoTime } from "@/utils/global"; +import { convertDateFormatNoTime, textEllipsis } from "@/utils/global"; import PolriTvWidget from "../ui/social-media/polri-tv"; import { useTranslations } from "next-intl"; @@ -62,7 +62,6 @@ export default function MedolUpdate() { const res = await topNewsInp(resLog?.data?.access_token); // setInpUpdate(res?.data); setInpUpdate(res?.data?.data); - console.log("reelog", res?.data?.data); // getDataImage(res?.data); } @@ -77,15 +76,47 @@ export default function MedolUpdate() { setInpUpdate(temp); } + const formatDate = (dateString: string): string => { + const date = new Date(dateString); + + let timeZone = "Asia/Jakarta"; + let timeZoneAbbr = "WIB"; + + if (dateString.includes("+09:00")) { + timeZone = "Asia/Jayapura"; + timeZoneAbbr = "WIT"; + } else if (dateString.includes("+08:00")) { + timeZone = "Asia/Makassar"; + timeZoneAbbr = "WITA"; + } + + const options: Intl.DateTimeFormatOptions = { + day: "2-digit", + month: "2-digit", + year: "numeric", + hour: "2-digit", + minute: "2-digit", + hour12: false, + timeZone, + }; + + // Format tanggal + const formattedDate = new Intl.DateTimeFormat("id-ID", options) + .format(date) + .replace(/\//g, "-"); // Ubah '/' menjadi '-' + + return `${formattedDate} ${timeZoneAbbr}`; + }; + return ( -
-
- Top 5 News Update +
+
+

Media Update

- {convertDateFormatNoTime(newsItem?.createdAt)} + {formatDate(newsItem?.createdAt)}

- {newsItem?.title} + + {textEllipsis(newsItem?.title, 50)} +
@@ -179,7 +215,10 @@ export default function MedolUpdate() { breakpoints={{ // When the window width is less than 640px 720: { - slidesPerView: 2, // Set slidesPerView to 1 on mobile + slidesPerView: 3, // Set slidesPerView to 1 on mobile + }, + 1080: { + slidesPerView: 4, }, }} pagination={true} @@ -214,13 +253,16 @@ export default function MedolUpdate() { radius="lg" width="300%" alt="tes" - className="object-cover !h-[30vh]" + className="object-cover !h-[20vh]" src={newsItem?.image} /> - {convertDateFormatNoTime(newsItem?.date)} - {newsItem?.title} + {/* {convertDateFormatNoTime(newsItem?.date)} */} +

{formatDate(newsItem?.date)}

+ + {textEllipsis(newsItem?.title, 50)} +
@@ -249,7 +291,10 @@ export default function MedolUpdate() { breakpoints={{ // When the window width is less than 640px 720: { - slidesPerView: 2, // Set slidesPerView to 1 on mobile + slidesPerView: 3, // Set slidesPerView to 1 on mobile + }, + 1080: { + slidesPerView: 4, }, }} pagination={true} @@ -287,13 +332,16 @@ export default function MedolUpdate() { radius="lg" width="300%" alt="tes" - className="object-cover !h-[30vh]" + className="object-cover !h-[20vh]" src={newsItem?.thumbnail} /> - {newsItem?.created_at} - {newsItem?.judul} + {/* {newsItem?.created_at} */} +

{newsItem?.created_at}

+ + {textEllipsis(newsItem?.judul, 50)} +
diff --git a/components/landing/NewsTicker.tsx b/components/landing/NewsTicker.tsx index f1d52cd..1a3ba5a 100644 --- a/components/landing/NewsTicker.tsx +++ b/components/landing/NewsTicker.tsx @@ -51,31 +51,33 @@ export default function NewsTicker() { BREAKING NEWS
-
- -

- {article[currentNewsIndex]?.title} + +

+ {article[currentNewsIndex]?.title} +

+ + +

+ {textEllipsis(article[currentNewsIndex]?.title, 28)} +

+ +

+ {convertDateFormat(article[currentNewsIndex]?.createdAt)}

- - -

- {textEllipsis(article[currentNewsIndex]?.title, 28)} -

- -

- {convertDateFormat(article[currentNewsIndex]?.createdAt)} -

-
+
+ )} + ); +} diff --git a/components/landing/banner-new.tsx b/components/landing/banner-new.tsx new file mode 100644 index 0000000..d01392d --- /dev/null +++ b/components/landing/banner-new.tsx @@ -0,0 +1,233 @@ +"use client"; +import { useTranslations } from "next-intl"; +import Image from "next/image"; +import React, { useEffect, useState } from "react"; +import { + ChevronDownIcon, + ChevronLeftIcon, + ChevronRightIcon, + ChevronUpIcon, + FbIconNav, + IdnIcon, + IgIcon, + SearchIcon, + SearchIcons, + TtIcon, + TwIcon, + UKIcon, + YtIcon, +} from "../icons"; +import Link from "next/link"; +import { + Dropdown, + DropdownTrigger, + DropdownMenu, + DropdownItem, + Button, + Input, +} from "@heroui/react"; +import storedLanguage from "@/store/language-store"; +import { ThemeSwitch } from "../theme-switch"; + +const images = [ + "/landing-1.jpg", + "/landing-2.jpg", + "/landing-3.jpg", + "/landing-4.jpg", +]; + +export default function BannerHumasNew() { + const t = useTranslations("Banner"); + const [currentIndex, setCurrentIndex] = useState(0); + const [resetTimer, setResetTimer] = useState(0); + const [onOpen, setOnOpen] = useState(false); + const [searchValue, setSearchValue] = useState(""); + const language = storedLanguage((state) => state.locale); + const setLanguage = storedLanguage((state) => state.setLocale); + + useEffect(() => { + const interval = setInterval(() => { + setCurrentIndex((prevIndex) => (prevIndex + 1) % images.length); + }, 25000); + + return () => clearInterval(interval); + }, [resetTimer]); + const nextImage = () => { + setCurrentIndex((prevIndex) => (prevIndex + 1) % images.length); + setResetTimer((prev) => prev + 1); + }; + + const prevImage = () => { + setCurrentIndex( + (prevIndex) => (prevIndex - 1 + images.length) % images.length + ); + setResetTimer((prev) => prev + 1); + }; + + return ( +
+
+ {images.map((img, index) => ( + + {`humasbanner-${index}`} + + ))} +
+
+ //
+ //
+ //
+ //
Your Text Here
+ //
+ ); +} diff --git a/components/landing/footer-new.tsx b/components/landing/footer-new.tsx index 7aee1c3..e034ce6 100644 --- a/components/landing/footer-new.tsx +++ b/components/landing/footer-new.tsx @@ -20,7 +20,7 @@ export default function FooterNew() { return (
-
+
Channel Humas Polri
@@ -159,7 +159,7 @@ export default function FooterNew() { - {" "} +
diff --git a/components/landing/social-media.tsx b/components/landing/social-media.tsx new file mode 100644 index 0000000..7d425ab --- /dev/null +++ b/components/landing/social-media.tsx @@ -0,0 +1,75 @@ +"use client"; +import { + Button, + Card, + CardBody, + CardFooter, + Image, + Tab, + Tabs, +} from "@heroui/react"; +import React, { useEffect, useState } from "react"; +import { Swiper, SwiperSlide } from "swiper/react"; +import "swiper/css"; +import "swiper/css/navigation"; +import "swiper/css/pagination"; +import { Navigation, Pagination } from "swiper/modules"; +import { topNewsMediahub } from "@/service/medol-news-update"; +import Link from "next/link"; +import { + getImageInp, + inpLogin, + topNewsInp, + topNewsTbn, +} from "@/service/third-party-service"; +import { convertDateFormatNoTime, textEllipsis } from "@/utils/global"; +import PolriTvWidget from "../ui/social-media/polri-tv"; +import { useTranslations } from "next-intl"; +import TwitterWidget from "../ui/social-media/twitter"; +import InstagramWidget from "../ui/social-media/instagram"; +import YoutubeWidget from "../ui/social-media/youtube"; + +export default function SocialMediaNew() { + const [selectedTab, setSelectedTab] = useState("x"); + const [mediahubUpdate, setMediahubUpdate] = useState([]); + const [tbnUpdate, setTbnUpdate] = useState([]); + const [inpUpdate, setInpUpdate] = useState([]); + + const t = useTranslations("Landing"); + return ( +
+
+

+ Media Sosial Humas +

+
+
+ + + + + + + + + + + +
+
+ ); +} diff --git a/components/layout/humas-layout.tsx b/components/layout/humas-layout.tsx index cd425cd..41baae7 100644 --- a/components/layout/humas-layout.tsx +++ b/components/layout/humas-layout.tsx @@ -21,8 +21,8 @@ export const HumasLayout = ({ children }: Props) => { if (!hasMounted) return null; return (
- - + {/* */} + {/* */} {children} diff --git a/components/theme-switch.tsx b/components/theme-switch.tsx index 25688be..452f848 100644 --- a/components/theme-switch.tsx +++ b/components/theme-switch.tsx @@ -10,68 +10,74 @@ import clsx from "clsx"; import { SunFilledIcon, MoonFilledIcon } from "@/components/icons"; export interface ThemeSwitchProps { - className?: string; - classNames?: SwitchProps["classNames"]; + className?: string; + classNames?: SwitchProps["classNames"]; } export const ThemeSwitch: FC = ({ - className, - classNames, + className, + classNames, }) => { - const { theme, setTheme } = useTheme(); - const isSSR = useIsSSR(); + const { theme, setTheme } = useTheme(); + const isSSR = useIsSSR(); - const onChange = () => { - theme === "light" ? setTheme("dark") : setTheme("light"); - }; + const onChange = () => { + theme === "light" ? setTheme("dark") : setTheme("light"); + }; - const { - Component, - slots, - isSelected, - getBaseProps, - getInputProps, - getWrapperProps, - } = useSwitch({ - isSelected: theme === "light" || isSSR, - "aria-label": `Switch to ${theme === "light" || isSSR ? "dark" : "light"} mode`, - onChange, - }); + const { + Component, + slots, + isSelected, + getBaseProps, + getInputProps, + getWrapperProps, + } = useSwitch({ + isSelected: theme === "light" || isSSR, + "aria-label": `Switch to ${ + theme === "light" || isSSR ? "dark" : "light" + } mode`, + onChange, + }); - return ( - - - - -
- {!isSelected || isSSR ? : } -
-
- ); + return ( + + + + +
+ {!isSelected || isSSR ? ( + + ) : ( + + )} +
+
+ ); }; diff --git a/public/props-1.png b/public/props-1.png new file mode 100644 index 0000000..8b868ef Binary files /dev/null and b/public/props-1.png differ diff --git a/public/props-2.png b/public/props-2.png new file mode 100644 index 0000000..50c7b3c Binary files /dev/null and b/public/props-2.png differ diff --git a/public/props-3.png b/public/props-3.png new file mode 100644 index 0000000..09a76e7 Binary files /dev/null and b/public/props-3.png differ