Skip to content

Commit

Permalink
Merge pull request #3 from Brian54309/dashboard
Browse files Browse the repository at this point in the history
fixed chartjs
  • Loading branch information
Brian54309 authored Aug 28, 2024
2 parents a599f4b + eaaae55 commit a7ae9be
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
33 changes: 20 additions & 13 deletions src/components/Dashboard/dashboard.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import "./dashboard.css"
import "./dashboard.css";

function Dashboard(){
return(
<div className="dashboard">
<div className="dashboard-top">
Dashboard
</div>
<div className="dashboard-bot">
Dashboard
</div>
</div>
)
// eslint-disable-next-line react/prop-types
function Dashboard({ dashboard, car }) {
return (
<div className="dashboard">
{dashboard && (
<>
<div className="dashboard-top">Dashboard</div>
<div className="dashboard-bot">Dashboard</div>
</>
)}
{car && (
<>
<div className="dashboard-top">Cars</div>
<div className="dashboard-bot">List Car</div>
</>
)}
</div>
);
}

export default Dashboard
export default Dashboard;
22 changes: 22 additions & 0 deletions src/components/Visual/visual.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
import {
Chart as ChartJS,
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
BarElement,
} from "chart.js";

import { Bar } from "react-chartjs-2";
import { useEffect } from "react";
import { useDispatch, useSelector } from "react-redux";
Expand All @@ -13,6 +25,16 @@ const july = {
start: "2024-07-01",
end: "2024-07-31",
};
ChartJS.register(
CategoryScale,
LinearScale,
PointElement,
LineElement,
Title,
Tooltip,
Legend,
BarElement
);
function Visual() {
const dispatch = useDispatch();
const reportData = useSelector((state) => state.report.data);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function DashboardMain() {
<Header></Header>
<div style={{ display: "flex" }}>
<div>
<Dashboard></Dashboard>
<Dashboard dashboard></Dashboard>
</div>
<div>
<Visual></Visual>
Expand Down

0 comments on commit a7ae9be

Please sign in to comment.