import { useState, useEffect } from "react"; import Sidebar from "../../src/components/Sidebar/Sidebar"; import classnames from "classnames"; // import Chart from "chart.js"; import { Chart } from 'chart.js/auto'; import { Line, Bar } from "react-chartjs-2"; import { Button, Card, CardHeader, CardBody, NavItem, NavLink, Nav, Progress, Table, Container, Row, Col, } from "reactstrap"; // core components import { chartOptions, parseOptions, chartExample1, chartExample2, } from "variables/charts.js"; import Header from "components/Headers/Header.js"; import { fetchMenuItems } from "../APIServices/MenuAPI"; import routes from "routes.js"; const Index = (props) => { const [activeNav, setActiveNav] = useState(1); const [chartExample1Data, setChartExample1Data] = useState("data1"); const [menuItems, setMenuItems] = useState([]); // State for menu items const [error, setError] = useState(""); // State for errors const [menuData, setMenuData] = useState([]); // useEffect(() => { // const loadMenuItems = async () => { // try { // console.log("Menu is loading..."); // const data = await fetchMenuItems(); // setMenuItems(data); // console.log("menu data",data); // } catch (error) { // console.error("Fetching error:", error); // setError(error.message); // } // }; // loadMenuItems(); // }, []); useEffect(() => { // Sidebar items ke liye class add karo const sidebarElement = document.querySelector(".menu-header"); if (sidebarElement) { sidebarElement.classList.add("index-active"); // Special class add karo } // Cleanup jab component unmount hoga return () => { if (sidebarElement) { sidebarElement.classList.remove("index-active"); // Class remove karo } }; }, []); if (window.Chart) { parseOptions(Chart, chartOptions()); } const toggleNavs = (e, index) => { e.preventDefault(); setActiveNav(index); setChartExample1Data("data" + index); }; return ( // <>Home Page
{/* Page content */}
Overview

Sales value

{/* Chart */}
{chartExample1[chartExample1Data] ? ( ) : (

Loading chart...

)}
Performance

Total orders

{/* Chart */}

Page visits

Page name Visitors Unique users Bounce rate
/argon/ 4,569 340 46,53%
/argon/index.html 3,985 319 {" "} 46,53%
/argon/charts.html 3,513 294 {" "} 36,49%
/argon/tables.html 2,050 147 50,87%
/argon/profile.html 1,795 190 {" "} 46,53%

Social traffic

Referral Visitors
Facebook 1,480
60%
Facebook 5,480
70%
Google 4,807
80%
Instagram 3,678
75%
twitter 2,645
30%
); }; export default Index;