import React, { useState, useEffect, useRef } from 'react'; import { Menu } from 'primereact/menu'; import { Button } from 'primereact/button'; import { Chart } from 'primereact/chart'; import { DataTable } from 'primereact/datatable'; import { Column } from 'primereact/column'; import { ProductService } from '../service/ProductService'; const lineData = { labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], datasets: [ { label: 'First Dataset', data: [65, 59, 80, 81, 56, 55, 40], fill: false, backgroundColor: '#2f4860', borderColor: '#2f4860', tension: .4 }, { label: 'Second Dataset', data: [28, 48, 40, 19, 86, 27, 90], fill: false, backgroundColor: '#00bb7e', borderColor: '#00bb7e', tension: .4 } ] }; const Dashboard = (props) => { const [products, setProducts] = useState(null); const menu1 = useRef(null); const menu2 = useRef(null); const [lineOptions, setLineOptions] = useState(null) const applyLightTheme = () => { const lineOptions = { plugins: { legend: { labels: { color: '#495057' } } }, scales: { x: { ticks: { color: '#495057' }, grid: { color: '#ebedef', } }, y: { ticks: { color: '#495057' }, grid: { color: '#ebedef', } }, } }; setLineOptions(lineOptions) } const applyDarkTheme = () => { const lineOptions = { plugins: { legend: { labels: { color: '#ebedef' } } }, scales: { x: { ticks: { color: '#ebedef' }, grid: { color: 'rgba(160, 167, 181, .3)', } }, y: { ticks: { color: '#ebedef' }, grid: { color: 'rgba(160, 167, 181, .3)', } }, } }; setLineOptions(lineOptions) } useEffect(() => { const productService = new ProductService(); productService.getProductsSmall().then(data => setProducts(data)); }, []); useEffect(() => { if (props.colorMode === 'light') { applyLightTheme(); } else { applyDarkTheme(); } }, [props.colorMode]); const formatCurrency = (value) => { return value.toLocaleString('en-US', { style: 'currency', currency: 'USD' }); }; return (
Orders
152
24 new since last visit
Revenue
$2.100
%52+ since last week
Customers
28441
520 newly registered
Comments
152 Unread
85 responded
Recent Sales
{data.image}}/> formatCurrency(data.price)}/> ( <>
Best Selling Products
  • Space T-Shirt
    Clothing
    %50
  • Portal Sticker
    Accessories
    %16
  • Supernova Sticker
    Accessories
    %67
  • Wonders Notebook
    Office
    %35
  • Mat Black Case
    Accessories
    %75
  • Robots T-Shirt
    Clothing
    %40
Sales Overview
Notifications
TODAY
  • Richard Jones has purchased a blue t-shirt for 79$
  • Your request for withdrawal of 2500$ has been initiated.
YESTERDAY
  • Keyser Wick has purchased a black jacket for 59$
  • Jane Davis has posted a new questions about your product.
TAKE THE NEXT STEP
Try PrimeBlocks
); } const comparisonFn = function (prevProps, nextProps) { return (prevProps.location.pathname === nextProps.location.pathname) && (prevProps.colorMode === nextProps.colorMode); }; export default React.memo(Dashboard, comparisonFn);