import React, { useEffect, useState } from 'react'; import Switch from '@mui/material/Switch'; import { Typography, Button } from '@mui/material'; import { useNavigate, Link, useParams } from "react-router-dom"; import { Bar } from 'react-chartjs-2'; import Grid from '@mui/material/Grid'; import SearchIcon from '@mui/icons-material/Search'; import NewReleasesIcon from '@mui/icons-material/NewReleases'; import MailOutlineIcon from '@mui/icons-material/MailOutline'; const AnalyticsTab = (props) => { const { userdata, globalUrl, serverside } = props; const [checked, setChecked] = useState(false); const [selectedOption, setSelectedOption] = useState('all'); const [expand, setExpand] = useState(false) const isCloud = (window.location.host === "localhost:3002" || window.location.host === "shuffler.io") ? true : (process.env.IS_SSR === "true"); const handleOptionChange = (option) => { setSelectedOption(option); // You can perform actions based on the selected option, such as filtering data }; const handleChange = (event) => { setChecked(event.target.checked); }; const allData = { labels: ['Email analysis', 'Email Management', 'EDR to Ticket', 'Ticket Analysis'], datasets: [ { label: 'Revisions', data: [12, 19, 3, 5], // Data for revisions backgroundColor: '#FF8444', borderWidth: 1, // borderRadius: 60, barPercentage: 0.7, categoryPercentage: 0.5, }, { label: 'Runs', data: [8, 15, 5, 8], // Data for runs backgroundColor: '#9747FF', borderWidth: 1, // borderRadius: 60, barPercentage: 0.7, categoryPercentage: 0.5 } ] }; let data; if (selectedOption === 'all') { data = allData; } else if (selectedOption === 'revisions') { data = { labels: allData.labels, datasets: [allData.datasets[0]] // Show only revisions data }; } else if (selectedOption === 'run') { data = { labels: allData.labels, datasets: [allData.datasets[1]] // Show only runs data }; } // Options for the chart const options = { scales: { yAxes: [ { ticks: { beginAtZero: true } } ] }, }; return (
Timeline
Apps
Category
{ setExpand(prevExpand => !prevExpand); }} style={{ color: "#FF8444" }}>Expand
{expand ? null :
Onboarding
{checked ?
: null }
{checked ?
: null }
{checked ?
: null }
Other
{checked ?
: null }
{checked ?
: null }
{checked ?
: null }
}
Workflows
Insights
Sessions Overview
2.8 Hours
Avg. Activity per session
/usercases/edr to ticket
Last visited page
/workflow/email management
Most visited page
); }; export default AnalyticsTab;