aboutsummaryrefslogtreecommitdiffstats
path: root/panel/src/pages/Dashboard.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'panel/src/pages/Dashboard.jsx')
-rw-r--r--panel/src/pages/Dashboard.jsx61
1 files changed, 44 insertions, 17 deletions
diff --git a/panel/src/pages/Dashboard.jsx b/panel/src/pages/Dashboard.jsx
index d16204d..344371d 100644
--- a/panel/src/pages/Dashboard.jsx
+++ b/panel/src/pages/Dashboard.jsx
@@ -1,21 +1,37 @@
import React, { useEffect, useRef } from 'react';
-import { Chart, CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend } from 'chart.js';
-import { Bar } from 'react-chartjs-2';
+import { Chart, CategoryScale, LinearScale, LineElement, PointElement, LineController, Title, Tooltip, Legend } from 'chart.js';
+import { Line } from 'react-chartjs-2';
import Navbar from '../components/Navbar';
+import './Dashboard.css';
-Chart.register(CategoryScale, LinearScale, BarElement, Title, Tooltip, Legend);
+Chart.register(CategoryScale, LinearScale, LineElement, PointElement, LineController, Title, Tooltip, Legend);
const Dashboard = () => {
- const userStats = { totalUsers: 100, totalAds: 50, totalRevenue: 5000 };
+ const userStats = {
+ totalUsers: [50, 70, 60, 80, 100, 90, 110],
+ totalAds: 50,
+ totalRevenue: [40, 50, 30, 70, 60, 80, 75]
+ };
const chartData = {
- labels: ['Users', 'Revenue'],
+ labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
datasets: [
{
- label: 'Statistics',
- data: [userStats.totalUsers, userStats.totalRevenue],
- backgroundColor: ['rgba(75,192,192,0.6)', 'rgba(153,102,255,0.6)'],
+ label: 'Total Users',
+ data: userStats.totalUsers,
+ borderColor: 'rgba(75,192,192,1)',
+ backgroundColor: 'rgba(75,192,192,0.2)',
+ fill: true,
+ tension: 0.4,
},
+ {
+ label: 'Total Revenue',
+ data: userStats.totalRevenue,
+ borderColor: 'rgba(153,102,255,1)',
+ backgroundColor: 'rgba(153,102,255,0.2)',
+ fill: true,
+ tension: 0.4,
+ }
],
};
@@ -32,17 +48,28 @@ const Dashboard = () => {
}, []);
return (
- <div>
+ <div className="dashboard">
<Navbar />
- <div className="container mt-5">
- <h4 className="mb-4">Dashboard</h4>
- <div className="mb-4">
- <h6>Total Users: {userStats.totalUsers}</h6>
- <h6>Total Ads: {userStats.totalAds}</h6>
- <h6>Total Revenue: {userStats.totalRevenue}</h6>
+ <div className="dashboard-container">
+ <div className="dashboard-header">
+ <h4>Dashboard</h4>
+ </div>
+ <div className="dashboard-stats">
+ <div className="stat-card">
+ <h6>Total Users</h6>
+ <p>{userStats.totalUsers[userStats.totalUsers.length - 1]}</p>
+ </div>
+ <div className="stat-card">
+ <h6>Total Ads</h6>
+ <p>{userStats.totalAds}</p>
+ </div>
+ <div className="stat-card">
+ <h6>Total Revenue</h6>
+ <p>${userStats.totalRevenue[userStats.totalRevenue.length - 1]}</p>
+ </div>
</div>
- <div>
- <Bar ref={chartRef} data={chartData} />
+ <div className="chart-container">
+ <Line ref={chartRef} data={chartData} />
</div>
</div>
</div>