'use client';

import { useState } from "react";
import StatistikMahasiswaChart from "@/components/charts/StatistikMahasiswaChart";
import StatistikPerAngkatanChart from "@/components/charts/StatistikPerAngkatanChart";
import JenisPendaftaranChart from "@/components/charts/JenisPendaftaranChart";
import AsalDaerahChart from "@/components/charts/AsalDaerahChart";
import IPKChart from "@/components/charts/IPKChart";
import FilterTahunAngkatan from "@/components/FilterTahunAngkatan";
import JenisPendaftaranPerAngkatanChart from "@/components/charts/JenisPendaftaranPerAngkatanChart";
import AsalDaerahPerAngkatanChart from "@/components/charts/AsalDaerahPerAngkatanChart";
import StatusMahasiswaChart from "@/components/charts/StatusMahasiswaChart";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";

export default function TotalMahasiswaPage() {
  const [selectedYear, setSelectedYear] = useState<string>("all");

  return (
    <div className="container mx-auto p-4 space-y-6">
      <h1 className="text-2xl font-bold mb-2">Dashboard Mahasiswa</h1>
      
      <div className="mb-2">
        <p className="text-gray-600 dark:text-gray-300">
          Visualisasi data akademik mahasiswa Informartika Universitas Tanjungpura
        </p>
      </div>

      <div className="mb-4">
        <div className="flex flex-col sm:flex-row items-start sm:items-center gap-4 sm:space-x-4">
          <FilterTahunAngkatan 
            selectedYear={selectedYear}
            onYearChange={setSelectedYear}
          />
        </div>
      </div>

      {selectedYear === "all" ? (
        <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
          <StatistikMahasiswaChart />
          <JenisPendaftaranChart />
          <StatusMahasiswaChart />
          <IPKChart />
          <AsalDaerahChart />
        </div>
      ) : (
        <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
          <StatistikPerAngkatanChart tahunAngkatan={selectedYear} />
          <JenisPendaftaranPerAngkatanChart tahunAngkatan={selectedYear} />
          <AsalDaerahPerAngkatanChart tahunAngkatan={selectedYear} />
        </div>
      )}
    </div>
  );
}
