initial commit
This commit is contained in:
@@ -5,6 +5,9 @@ import dynamic from 'next/dynamic';
|
||||
import { ApexOptions } from 'apexcharts';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
// Dynamically import ApexCharts to avoid SSR issues
|
||||
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
|
||||
@@ -14,7 +17,15 @@ interface AsalDaerahData {
|
||||
jumlah: number;
|
||||
}
|
||||
|
||||
export default function AsalDaerahChart() {
|
||||
interface AsalDaerahChartProps {
|
||||
height?: string;
|
||||
showDetailButton?: boolean;
|
||||
}
|
||||
|
||||
export default function AsalDaerahChart({
|
||||
height = "h-[400px] sm:h-[450px] md:h-[500px] lg:h-[600px]",
|
||||
showDetailButton = true
|
||||
}: AsalDaerahChartProps = {}) {
|
||||
const { theme } = useTheme();
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -265,13 +276,23 @@ export default function AsalDaerahChart() {
|
||||
return (
|
||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Asal Kabupaten Mahasiswa
|
||||
</CardTitle>
|
||||
<div className="flex justify-between items-center">
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Asal Kabupaten Mahasiswa
|
||||
</CardTitle>
|
||||
{showDetailButton && (
|
||||
<Link href="/detail/asal-daerah" target="_blank">
|
||||
<Button variant="outline" size="sm" className="flex items-center gap-1 dark:text-white">
|
||||
<ExternalLink className="size-3" />
|
||||
Detail
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div
|
||||
className="w-full max-w-xl mx-auto"
|
||||
className={`${height} w-full max-w-xl mx-auto`}
|
||||
style={{ height: calculateHeight() }}
|
||||
>
|
||||
<Chart
|
||||
|
||||
@@ -301,9 +301,9 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
|
||||
|
||||
// Calculate dynamic height based on number of kabupaten
|
||||
const calculateHeight = () => {
|
||||
const minHeight = 200;
|
||||
const barHeight = 25; // Height per bar in pixels
|
||||
const padding = 100; // Extra space for title, legend, etc.
|
||||
const minHeight = 100;
|
||||
const barHeight = 15; // Height per bar in pixels
|
||||
const padding = 50; // Extra space for title, legend, etc.
|
||||
const dynamicHeight = Math.max(minHeight, (data.length * barHeight) + padding);
|
||||
return `${dynamicHeight}px`;
|
||||
};
|
||||
@@ -317,7 +317,7 @@ export default function AsalDaerahPerAngkatanChart({ tahunAngkatan }: Props) {
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div
|
||||
className="w-full max-w-5xl mx-auto"
|
||||
className="w-full max-w-xl mx-auto"
|
||||
style={{ height: calculateHeight() }}
|
||||
>
|
||||
<Chart
|
||||
|
||||
@@ -5,6 +5,9 @@ import dynamic from 'next/dynamic';
|
||||
import { ApexOptions } from 'apexcharts';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
// Dynamically import ApexCharts to avoid SSR issues
|
||||
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
|
||||
@@ -14,7 +17,15 @@ interface IPKData {
|
||||
rata_rata_ipk: number;
|
||||
}
|
||||
|
||||
export default function IPKChart() {
|
||||
interface IPKChartProps {
|
||||
height?: string;
|
||||
showDetailButton?: boolean;
|
||||
}
|
||||
|
||||
export default function IPKChart({
|
||||
height = "h-[300px] sm:h-[350px] md:h-[300px]",
|
||||
showDetailButton = true
|
||||
}: IPKChartProps) {
|
||||
const { theme } = useTheme();
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -47,7 +58,7 @@ export default function IPKChart() {
|
||||
}
|
||||
},
|
||||
stroke: {
|
||||
curve: 'smooth',
|
||||
curve: 'straight',
|
||||
width: 3,
|
||||
lineCap: 'round'
|
||||
},
|
||||
@@ -319,12 +330,22 @@ export default function IPKChart() {
|
||||
return (
|
||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Rata-rata IPK Mahasiswa
|
||||
</CardTitle>
|
||||
<div className="flex justify-between items-center">
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Rata-rata IPK Mahasiswa
|
||||
</CardTitle>
|
||||
{showDetailButton && (
|
||||
<Link href="/detail/rata-rata-ipk" target="_blank">
|
||||
<Button variant="outline" size="sm" className="flex items-center gap-1 dark:text-white">
|
||||
<ExternalLink className="size-3" />
|
||||
Detail
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="h-[300px] sm:h-[350px] md:h-[300px] w-full max-w-5xl mx-auto">
|
||||
<div className={`${height} w-full max-w-5xl mx-auto`}>
|
||||
<Chart
|
||||
options={options}
|
||||
series={series}
|
||||
|
||||
@@ -5,6 +5,9 @@ import dynamic from 'next/dynamic';
|
||||
import { ApexOptions } from 'apexcharts';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
|
||||
|
||||
@@ -14,7 +17,15 @@ interface JenisPendaftaranData {
|
||||
jumlah: number;
|
||||
}
|
||||
|
||||
export default function JenisPendaftaranChart() {
|
||||
interface JenisPendaftaranChartProps {
|
||||
height?: string;
|
||||
showDetailButton?: boolean;
|
||||
}
|
||||
|
||||
export default function JenisPendaftaranChart({
|
||||
height = "h-[300px] sm:h-[350px] md:h-[300px]",
|
||||
showDetailButton = true
|
||||
}: JenisPendaftaranChartProps) {
|
||||
const { theme } = useTheme();
|
||||
const [mounted, setMounted] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -276,12 +287,22 @@ export default function JenisPendaftaranChart() {
|
||||
return (
|
||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Jenis Pendaftaran Mahasiswa
|
||||
</CardTitle>
|
||||
<div className="flex justify-between items-center">
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Jenis Pendaftaran Mahasiswa
|
||||
</CardTitle>
|
||||
{showDetailButton && (
|
||||
<Link href="/detail/jenis-pendaftaran" target="_blank">
|
||||
<Button variant="outline" size="sm" className="flex items-center gap-1 dark:text-white">
|
||||
<ExternalLink className="size-3" />
|
||||
Detail
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="h-[300px] sm:h-[350px] md:h-[300px] w-full max-w-5xl mx-auto">
|
||||
<div className={`${height} w-full max-w-5xl mx-auto`}>
|
||||
<Chart
|
||||
options={options}
|
||||
series={series}
|
||||
|
||||
@@ -5,6 +5,9 @@ import dynamic from 'next/dynamic';
|
||||
import { ApexOptions } from 'apexcharts';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
// Dynamically import ApexCharts to avoid SSR issues
|
||||
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
|
||||
@@ -19,7 +22,16 @@ interface Props {
|
||||
selectedYear: string;
|
||||
}
|
||||
|
||||
export default function LulusTepatWaktuChart({ selectedYear }: Props) {
|
||||
interface LulusTepatWaktuChartProps extends Props {
|
||||
height?: string;
|
||||
showDetailButton?: boolean;
|
||||
}
|
||||
|
||||
export default function LulusTepatWaktuChart({
|
||||
selectedYear,
|
||||
height = "h-[300px] sm:h-[300px] md:h-[300px]",
|
||||
showDetailButton = true
|
||||
}: LulusTepatWaktuChartProps) {
|
||||
const { theme } = useTheme();
|
||||
const [data, setData] = useState<LulusTepatWaktuData[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
@@ -240,13 +252,23 @@ export default function LulusTepatWaktuChart({ selectedYear }: Props) {
|
||||
return (
|
||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Mahasiswa Lulus Tepat Waktu
|
||||
{selectedYear !== 'all' ? ` Angkatan ${selectedYear}` : ''}
|
||||
</CardTitle>
|
||||
<div className="flex justify-between items-center">
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Mahasiswa Lulus Tepat Waktu
|
||||
{selectedYear !== 'all' ? ` Angkatan ${selectedYear}` : ''}
|
||||
</CardTitle>
|
||||
{showDetailButton && (
|
||||
<Link href="/detail/lulus-tepat-waktu" target="_blank">
|
||||
<Button variant="outline" size="sm" className="flex items-center gap-1 dark:text-white">
|
||||
<ExternalLink className="size-3" />
|
||||
Detail
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="h-[300px] sm:h-[300px] md:h-[300px] w-full max-w-5xl mx-auto">
|
||||
<div className={`${height} w-full max-w-5xl mx-auto`}>
|
||||
{typeof window !== 'undefined' && series.length > 0 && (
|
||||
<Chart
|
||||
options={chartOptions}
|
||||
|
||||
@@ -5,6 +5,9 @@ import dynamic from 'next/dynamic';
|
||||
import { ApexOptions } from 'apexcharts';
|
||||
import { useTheme } from 'next-themes';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
// Dynamically import ApexCharts to avoid SSR issues
|
||||
const Chart = dynamic(() => import('react-apexcharts'), { ssr: false });
|
||||
@@ -15,7 +18,15 @@ interface StatusData {
|
||||
jumlah: number;
|
||||
}
|
||||
|
||||
export default function StatusMahasiswaChart() {
|
||||
interface StatusMahasiswaChartProps {
|
||||
height?: string;
|
||||
showDetailButton?: boolean;
|
||||
}
|
||||
|
||||
export default function StatusMahasiswaChart({
|
||||
height = "h-[300px] sm:h-[300px] md:h-[300px]",
|
||||
showDetailButton = true
|
||||
}: StatusMahasiswaChartProps) {
|
||||
const { theme } = useTheme();
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -206,12 +217,22 @@ export default function StatusMahasiswaChart() {
|
||||
return (
|
||||
<Card className="bg-white dark:bg-slate-900 shadow-lg">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Status Mahasiswa
|
||||
</CardTitle>
|
||||
<div className="flex justify-between items-center">
|
||||
<CardTitle className="text-xl font-bold dark:text-white">
|
||||
Status Mahasiswa
|
||||
</CardTitle>
|
||||
{showDetailButton && (
|
||||
<Link href="/detail/status-mahasiswa" target="_blank">
|
||||
<Button variant="outline" size="sm" className="flex items-center gap-1 dark:text-white">
|
||||
<ExternalLink className="size-3" />
|
||||
Detail
|
||||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div className="h-[300px] sm:h-[300px] md:h-[300px] w-full max-w-5xl mx-auto">
|
||||
<div className={`${height} w-full max-w-5xl mx-auto`}>
|
||||
{typeof window !== 'undefined' && (
|
||||
<Chart
|
||||
options={chartOptions}
|
||||
|
||||
Reference in New Issue
Block a user