/* eslint-disable @typescript-eslint/no-explicit-any */ 'use client' import programPenghijauanState from '@/app/admin/(dashboard)/_state/lingkungan/program-penghijauan'; import colors from '@/con/colors'; import { Box, Center, Group, Pagination, Paper, SimpleGrid, Skeleton, Stack, Text, TextInput, Title, Tooltip } from '@mantine/core'; import { useDebouncedValue, useShallowEffect } from '@mantine/hooks'; import { IconAlertTriangle, IconAmbulance, IconBook, IconBuilding, IconBuildingCommunity, IconCash, IconChartLine, IconChristmasTreeFilled, IconClipboard, IconDroplet, IconFileText, IconFiretruck, IconFirstAidKit, IconHome, IconHomeEco, IconHospital, IconInfoCircle, IconLeaf, IconLifebuoy, IconMessageReport, IconPhoneCall, IconRecycle, IconRun, IconScale, IconSchool, IconSearch, IconShield, IconShieldFilled, IconShoppingCart, IconStethoscope, IconTent, IconTrash, IconTree, IconTrendingUp, IconTrophy, IconTruck, IconUsers } from '@tabler/icons-react'; import { useTransitionRouter } from 'next-view-transitions'; import React, { useState } from 'react'; import { useProxy } from 'valtio/utils'; import BackButton from '../../desa/layanan/_com/BackButto'; function Page() { const state = useProxy(programPenghijauanState); const [search, setSearch] = useState(""); const [debouncedSearch] = useDebouncedValue(search, 1000); const router = useTransitionRouter() const { data, load, page, totalPages, loading } = state.findMany; useShallowEffect(() => { load(page, 4, debouncedSearch); }, [page, debouncedSearch]); const iconMap: Record = { ekowisata: IconLeaf, kompetisi: IconTrophy, wisata: IconTent, ekonomi: IconChartLine, sampah: IconRecycle, truck: IconTruck, scale: IconScale, clipboard: IconClipboard, trash: IconTrash, lingkunganSehat: IconHomeEco, sumberOksigen: IconChristmasTreeFilled, ekonomiBerkelanjutan: IconTrendingUp, mencegahBencana: IconShieldFilled, rumah: IconHome, pohon: IconTree, air: IconDroplet, bantuan: IconCash, pelatihan: IconSchool, subsidi: IconShoppingCart, layananKesehatan: IconHospital, // ===== Keamanan & Darurat ===== polisi: IconShieldFilled, ambulans: IconAmbulance, pemadam: IconFiretruck, darurat: IconAlertTriangle, sar: IconLifebuoy, evakuasi: IconRun, keamanan: IconShield, teleponDarurat: IconPhoneCall, // ===== Kesehatan ===== rumahSakit: IconHospital, puskesmas: IconFirstAidKit, klinik: IconStethoscope, // ===== Pemerintahan ===== bangunan: IconBuilding, kantorDesa: IconBuildingCommunity, administrasi: IconFileText, informasi: IconInfoCircle, pengaduan: IconMessageReport, layananPublik: IconUsers, book: IconBook }; if (loading || !data) { return ( ); } return ( Program Penghijauan Desa } value={search} onChange={(e) => setSearch(e.currentTarget.value)} /> Mari berpartisipasi menanam dan merawat pohon untuk menciptakan lingkungan hijau, sehat, dan seimbang bagi seluruh warga desa. Manfaat Program {data.map((v) => ( { const el = e.currentTarget; el.style.transform = 'translateY(-8px)'; el.style.boxShadow = '0 15px 30px rgba(28,110,164,0.5)'; }} onMouseLeave={(e) => { const el = e.currentTarget; el.style.transform = 'translateY(0)'; el.style.boxShadow = '0 4px 10px rgba(0,0,0,0.1)'; }} onClick={() => router.push(`/darmasaba/lingkungan/program-penghijauan/${v.id}`)} >
{iconMap[v.icon] && React.createElement(iconMap[v.icon], { size: 50, stroke: 1.5, color: colors['blue-button'] })}
{v.name} {v.judul}
))}
load(newPage)} total={totalPages} color="blue" radius="xl" />
); } export default Page;