78 lines
2.5 KiB
TypeScript
78 lines
2.5 KiB
TypeScript
"use client";
|
|
import React from "react";
|
|
import BoxDashboard from "./BoxDashboard";
|
|
import LineChart from "./LineChart";
|
|
import { HorizontalChart } from "./HorizontalChart";
|
|
import { getComplaintsList } from "@/utils/inspectorApi";
|
|
import { useQuery } from "@tanstack/react-query";
|
|
import useDecrypt from "@/hooks/useDecrypt";
|
|
import { getInfo } from "@/utils/infoApi";
|
|
|
|
export default function ControllerDashboard() {
|
|
const { data, isLoading, refetch } = useQuery({
|
|
queryKey: ["Infos"],
|
|
queryFn: () => getInfo(),
|
|
refetchOnWindowFocus: false,
|
|
});
|
|
const [decryptedMessage, errorMessage] = useDecrypt(
|
|
"gJoT9AqK7wk1MZFSD04yXXfF36fzsOL+RYtJfySrEnQeJ7VoaL7pmOU6nB3+0+PQcaxIi3hf1AHjzIB0Cn5oHgKROeoI4XslhAezZk23QhtIU4HUF1wpeOJfA+4hWyRfbh4fI9774sa/KL47VaBbrNM/rvBxk6hjlKx5mTb3hqM="
|
|
);
|
|
|
|
return (
|
|
<div className="w-[95vw] lg:w-[82vw] xl:w-[70vw] 3xl:w-[65vw] mt-12 pt-9 mx-auto px-2">
|
|
{/* Lg Show */}
|
|
<div className="w-full mb-6 flex-col gap-0 flex">
|
|
<div className="w-full flex flex-row flex-wrap mx-auto justify-center gap-8 mb-10">
|
|
{data?.singletons.map((item: any, index: number) => {
|
|
return (
|
|
<BoxDashboard key={index} value={item.value} title={item.title} />
|
|
);
|
|
})}
|
|
</div>
|
|
|
|
<div className=" bg-[#EFEFEF80] rounded-lg flex justify-center shadow-md">
|
|
{data?.charts.map((item: any, index: number) => {
|
|
return (
|
|
<LineChart
|
|
key={index}
|
|
chartTitle={item.chartTitle}
|
|
chartData={item.series}
|
|
/>
|
|
);
|
|
})}
|
|
</div>
|
|
</div>
|
|
|
|
{/* <div className="w-full flex-row gap-6 h-[20vh] hidden lg:flex">
|
|
<div className="w-3/5 flex flex-row gap-7">
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
</div>
|
|
|
|
</div> */}
|
|
|
|
{/* max Lg show */}
|
|
{/* <div className="w-full mb-6 flex-col gap-12 flex lg:hidden">
|
|
<div className="w-full flex flex-row flex-wrap justify-center gap-4 ">
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
<BoxDashboard />
|
|
</div>
|
|
|
|
<div className="w-full flex flex-col gap-12 ">
|
|
<div className="h-1/2">
|
|
<LineChart />
|
|
</div>
|
|
<hr />
|
|
<div className="h-1/2">
|
|
<HorizontalChart />
|
|
</div>
|
|
</div>
|
|
</div> */}
|
|
</div>
|
|
);
|
|
}
|