Skip to content

Commit

Permalink
Admin dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugisha146 committed Oct 9, 2024
1 parent 1fd351f commit 481af1c
Show file tree
Hide file tree
Showing 21 changed files with 427 additions and 20,079 deletions.
Binary file modified .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"react-select": "^5.7.4",
"react-table": "^7.8.0",
"react-toastify": "^9.0.8",
"recharts": "^2.12.7",
"redux": "^4.2.0",
"redux-devtools-extension": "^2.13.9",
"redux-state-sync": "^3.1.4",
Expand Down
Binary file modified src/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions src/assets/Group (1).svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/Group.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/Vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/assets/material-symbols_manage-accounts.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/components/Performance/PerformanceChart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React from "react";
import { useTheme } from "../../hooks/darkmode";
import PerformanceChartHeader from "./PerformanceChartHeader";
import PerformanceChartGraph from "./PerformanceChartGraph";

interface PerformanceChartProps {
data: { name: string; performance: number }[];
currentDate: string;
}

const PerformanceChart: React.FC<PerformanceChartProps> = ({
data,
currentDate,
}) => {
const { theme } = useTheme();

return (
<div
className={`p-6 rounded-lg mt-8 border-2 ${
theme ? "bg-gray-100 border-gray-300" : "bg-[#1F2A37] border-white-500"
}`}
>
<PerformanceChartHeader theme={theme} currentDate={currentDate} />
<div className="mt-6">
<PerformanceChartGraph data={data} theme={theme} />
</div>
</div>
);
};

export default PerformanceChart;
71 changes: 71 additions & 0 deletions src/components/Performance/PerformanceChartGraph.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from "react";
import {
AreaChart,
Line,
XAxis,
YAxis,
CartesianGrid,
Tooltip,
ResponsiveContainer,
Area,
} from "recharts";

interface PerformanceChartGraphProps {
data: { name: string; performance: number }[];
theme: boolean;
}

const PerformanceChartGraph: React.FC<PerformanceChartGraphProps> = ({
data,
theme,
}) => (
<ResponsiveContainer width="100%" height={400}>
<AreaChart data={data}>
<CartesianGrid vertical={false} stroke={theme ? "#ccc" : "#374151"} />
<XAxis
dataKey="name"
tick={{ fill: theme ? "black" : "white" }}
tickLine={false}
axisLine={false}
/>
<YAxis
domain={[0, 2]}
ticks={[1, 2]}
tick={{ fill: theme ? "black" : "white" }}
axisLine={false}
tickLine={false}
/>
<Tooltip />
<Area
type="monotone"
dataKey="performance"
stroke="#56C870"
fillOpacity={1}
fill="url(#colorUv)"
/>
<defs>
<linearGradient id="colorUv" x1="0" y1="0" x2="0" y2="1">
<stop
offset="1%"
stopColor={theme ? "#F5F5F5" : "#243A3D"}
stopOpacity={1}
/>
<stop
offset="99%"
stopColor={theme ? "#F5F5F5" : "#243A3D"}
stopOpacity={0}
/>
</linearGradient>
</defs>
<Line
type="monotone"
dataKey="performance"
stroke="#56C870"
strokeWidth={4}
dot={false}
/>
</AreaChart>
</ResponsiveContainer>
);

export default PerformanceChartGraph;
29 changes: 29 additions & 0 deletions src/components/Performance/PerformanceChartHeader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from "react";

interface PerformanceChartHeaderProps {
theme: boolean;
currentDate: string;
}

const PerformanceChartHeader: React.FC<PerformanceChartHeaderProps> = ({
theme,
currentDate,
}) => (
<>
<h2 className={`${theme ? "text-black" : "text-white"} text-lg mb-2 ml-11`}>
Overall performance
</h2>
<p
className={`${
theme ? "text-gray-800" : "text-gray-400"
} text-sm mb-4 ml-11`}
>
as of {currentDate}
</p>
<p className={`${theme ? "text-black" : "text-white"} text-sm ml-11`}>
Overall performance
</p>
</>
);

export default PerformanceChartHeader;
25 changes: 25 additions & 0 deletions src/components/StatCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from "react";
import { useTheme } from "../hooks/darkmode";

interface StatCardProps {
icon: JSX.Element;
title: string;
count: number | string;
}

const StatCard: React.FC<StatCardProps> = ({ icon, title, count }) => {
const { theme } = useTheme();
return (
<div
className={`p-6 rounded-2xl border-2 flex flex-col items-center justify-center ${
theme ? "bg-gray-200 border-gray-300" : "bg-[#374151] border-white-500"
}`}
>
{icon}
<h3 className={`${theme ? "text-black" : "text-white"} mt-4`}>{title}</h3>
<span className={`${theme ? "text-black" : "text-white"} text-4xl mt-2`}>{count}</span>
</div>
);
};

export default StatCard;
2 changes: 1 addition & 1 deletion src/components/form/SignInForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const LoginForm = () => {
const role = localStorage.getItem("roleName") as string;
if (role === "applicant") {
navigate("/applicant");
} else if (role === "superAdmin") {
} else if (role === "superAdmin" || role === "admin") {
navigate("/admin");
} else {
const searchParams = new URLSearchParams(location.search);
Expand Down
Loading

0 comments on commit 481af1c

Please sign in to comment.