From d714c09efcf11682225979cfe4a77de8b954c5b8 Mon Sep 17 00:00:00 2001 From: nico Date: Wed, 18 Mar 2026 00:43:44 +0700 Subject: [PATCH] Fix New UI Pengaduan --- src/components/demografi-pekerjaan.tsx | 894 ++++++++++++++++--------- 1 file changed, 583 insertions(+), 311 deletions(-) diff --git a/src/components/demografi-pekerjaan.tsx b/src/components/demografi-pekerjaan.tsx index cf189d2..2baf56a 100644 --- a/src/components/demografi-pekerjaan.tsx +++ b/src/components/demografi-pekerjaan.tsx @@ -1,116 +1,73 @@ -import { BarChart, PieChart } from "@mantine/charts"; import { + Badge, Box, Card, Grid, + GridCol, Group, + Progress, Stack, - Table, Text, + ThemeIcon, Title, useMantineColorScheme, } from "@mantine/core"; import { - IconArrowDown, - IconArrowUp, - IconBabyCarriage, - IconSkull, -} from "@tabler/icons-react"; -import React from "react"; + Users, + Home, + Baby, + TrendingDown, + BarChart3, + PieChart as PieChartIcon, + Building2, +} from "lucide-react"; +import { + Bar, + BarChart, + CartesianGrid, + Cell, + Pie, + PieChart, + ResponsiveContainer, + Tooltip, + XAxis, + YAxis, +} from "recharts"; -// Sample Data +// KPI Data const kpiData = [ { id: 1, title: "Total Penduduk", value: "5.634", - sub: "Aktif terdaftar", - icon: ( - - Total Penduduk - - - ), + subtitle: "Aktif terdaftar", + icon: Users, }, { id: 2, title: "Kepala Keluarga", value: "1.354", - sub: "Total KK", - icon: ( - - Kepala Keluarga - - - ), + subtitle: "Total KK", + icon: Home, }, { id: 3, title: "Kelahiran", value: "23", - sub: "Tahun ini", - icon: ( - - ), + subtitle: "Tahun ini", + icon: Baby, }, { id: 4, title: "Kemiskinan", value: "324", - delta: "-10% dari tahun lalu", - deltaType: "positive", - icon: ( - - Kemiskinan - - - ), + subtitle: "-10% dari tahun lalu", + trend: "positive", + icon: TrendingDown, }, ]; +// Age Distribution Data const ageDistributionData = [ { ageRange: "17-25", total: 850 }, { ageRange: "26-35", total: 1200 }, @@ -120,6 +77,7 @@ const ageDistributionData = [ { ageRange: "65+", total: 484 }, ]; +// Job Distribution Data const jobDistributionData = [ { job: "Sipil", total: 1200 }, { job: "Guru", total: 850 }, @@ -128,283 +86,597 @@ const jobDistributionData = [ { job: "Wiraswasta", total: 984 }, ]; +// Religion Data const religionData = [ - { religion: "Hindu", total: 4234, color: "red" }, - { religion: "Islam", total: 856, color: "blue" }, - { religion: "Kristen", total: 412, color: "green" }, - { religion: "Buddha", total: 202, color: "yellow" }, + { name: "Hindu", value: 4234, color: "#EF4444" }, + { name: "Islam", value: 856, color: "#3B82F6" }, + { name: "Kristen", value: 412, color: "#22C55E" }, + { name: "Buddha", value: 202, color: "#FACC15" }, ]; +// Banjar Data const banjarData = [ - { banjar: "Banjar Darmasaba", population: 1200, kk: 300, poor: 45 }, - { banjar: "Banjar Manesa", population: 950, kk: 240, poor: 32 }, - { banjar: "Banjar Cabe", population: 800, kk: 200, poor: 28 }, - { banjar: "Banjar Penenjoan", population: 1100, kk: 280, poor: 38 }, - { banjar: "Banjar Baler Pasar", population: 984, kk: 250, poor: 42 }, - { banjar: "Banjar Bucu", population: 600, kk: 184, poor: 25 }, + { banjar: "Darmasaba", population: 1200, kk: 300, poor: 45 }, + { banjar: "Manesa", population: 950, kk: 240, poor: 32 }, + { banjar: "Cabe", population: 800, kk: 200, poor: 28 }, + { banjar: "Penenjoan", population: 1100, kk: 280, poor: 38 }, + { banjar: "Baler Pasar", population: 984, kk: 250, poor: 42 }, + { banjar: "Bucu", population: 600, kk: 184, poor: 25 }, ]; +// Dynamic Stats Data const dynamicStats = [ { title: "Kelahiran", value: "23", - icon: , - color: "green", + icon: Baby, + color: "#22C55E", }, { title: "Kematian", value: "12", - icon: , - color: "red", + icon: TrendingDown, + color: "#EF4444", }, { title: "Pindah Masuk", value: "45", - icon: , - color: "blue", + icon: Users, + color: "#3B82F6", }, { title: "Pindah Keluar", value: "32", - icon: , - color: "orange", + icon: Users, + color: "#3B82F6", }, ]; +// Sektor Unggulan Data +const sektorUnggulanData = [ + { sektor: "Pertanian", value: 65 }, + { sektor: "Perdagangan", value: 45 }, + { sektor: "Industri", value: 38 }, + { sektor: "Jasa", value: 52 }, +]; + const DemografiPekerjaan = () => { const { colorScheme } = useMantineColorScheme(); const dark = colorScheme === "dark"; - return ( - - - {/* KPI Cards */} - - {kpiData.map((kpi) => ( - - - - - {kpi.title} - - {React.cloneElement(kpi.icon, { - className: "h-6 w-6", - color: dark - ? "var(--mantine-color-dark-3)" - : "var(--mantine-color-dimmed)", - })} - - - {kpi.value} - - {kpi.delta && ( - - {kpi.delta} - - )} - {kpi.sub && ( - - {kpi.sub} - - )} - - - ))} - - {/* Charts Section */} - - {/* Grafik Pengelompokan Umur */} - + return ( + + {/* TOP SECTION - 4 STAT CARDS */} + + {kpiData.map((item) => ( + - - Grafik Pengelompokan Umur - - + + + + {item.title} + + + {item.value} + + + {item.trend === "positive" && ( + + )} + + {item.subtitle} + + + + + + + + ))} + - {/* Demografi Pekerjaan */} - - - + {/* ROW 2 - 3 COLUMNS */} + <Grid gutter="lg"> + {/* LEFT: PENGELOMPOKAN UMUR */} + <Grid.Col span={{ base: 12, lg: 4 }}> + <Card + p="md" + radius="xl" + withBorder + bg={dark ? "#1E293B" : "white"} + style={{ + borderColor: dark ? "#334155" : "white", + boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)", + }} + h="100%" + > + <Group gap="xs" mb="md"> + <ThemeIcon color="#1E3A5F" variant="filled" size="sm" radius="sm"> + <BarChart3 size={14} /> + </ThemeIcon> + <Title order={4} c={dark ? "white" : "gray.9"}> + Pengelompokan Umur + + + + + + + + + + + + + + + {/* CENTER: DEMOGRAFI PEKERJAAN */} + + + + + + + Demografi Pekerjaan - - - - + + + + + + + + + + + + - {/* Agama & Data per Banjar */} - - {/* Distribusi Agama */} - - - - Distribusi Agama + {/* RIGHT: STATISTIK DINAMIKA PENDUDUK */} + <Grid.Col span={{ base: 12, lg: 4 }}> + <Card + p="md" + radius="xl" + withBorder + bg={dark ? "#1E293B" : "white"} + style={{ + borderColor: dark ? "#334155" : "white", + boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)", + }} + h="100%" + > + <Group gap="xs" mb="md"> + <ThemeIcon color="#1E3A5F" variant="filled" size="sm" radius="sm"> + <BarChart3 size={14} /> + </ThemeIcon> + <Title order={4} c={dark ? "white" : "gray.9"}> + Dinamika Penduduk - ({ - name: item.religion, - value: item.total, - color: item.color, - }))} - withLabels - withLabelsLine - labelsPosition="outside" - labelsType="percent" - /> - - - - {/* Data per Banjar */} - - - - Data per Banjar - - - - - - Banjar - - - Penduduk - - - KK - - - Miskin - - - - - {banjarData.map((item, index) => ( - - - {item.banjar} - - - - {item.population.toLocaleString()} - - - - - {item.kk.toLocaleString()} - - - - - {item.poor.toLocaleString()} - - - - ))} - -
-
-
-
- - {/* Statistik Dinamika Penduduk */} - - - Statistik Dinamika Penduduk - - - {dynamicStats.map((stat, index) => ( - - - - - + + + {dynamicStats.map((stat, index) => ( + + + + + + + {stat.title} - + <Text + size="lg" + fw={700} + c={stat.color} + style={{ lineHeight: 1 }} + > {stat.value} - -
- {stat.icon} + + + + + ))} + + + + + + {/* ROW 3 - 3 COLUMNS */} + + {/* LEFT: DISTRIBUSI AGAMA */} + + + + + + + + Distribusi Agama + + + + + + {religionData.map((entry, index) => ( + + ))} + + + + + + {religionData.map((item, index) => ( + + + + + {item.name} + - - - ))} - - - - + + {item.value.toLocaleString()} + + + ))} + + + + + {/* CENTER: DATA PER BANJAR */} + + + + + + + + Data per Banjar + + + + + + + + + + + + + + {banjarData.map((item, index) => ( + + + + + + + ))} + +
+ Banjar + + Penduduk + + KK + + Miskin +
+ {item.banjar} + + {item.population.toLocaleString()} + + {item.kk.toLocaleString()} + + {item.poor.toLocaleString()} +
+
+
+
+ + {/* RIGHT: STATISTIK SEKTOR UNGGULAN */} + + + + + + + + Sektor Unggulan + + + + + + + + + + {sektorUnggulanData.map((entry, index) => ( + + ))} + + + + + + + ); };