import React from "react"; import { Box, Typography } from "@mui/material"; import Card from "@mui/material/Card"; import Menu from "@mui/material/Menu"; import MenuItem from "@mui/material/MenuItem"; import IconButton from "@mui/material/IconButton"; import MoreHorizIcon from "@mui/icons-material/MoreHoriz"; import PropTypes from "prop-types"; import { useTheme } from "@mui/material/styles"; import Table from "@mui/material/Table"; import TableHead from "@mui/material/TableHead"; import TableBody from "@mui/material/TableBody"; import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableFooter from "@mui/material/TableFooter"; import TablePagination from "@mui/material/TablePagination"; import TableRow from "@mui/material/TableRow"; import Paper from "@mui/material/Paper"; import FirstPageIcon from "@mui/icons-material/FirstPage"; import KeyboardArrowLeft from "@mui/icons-material/KeyboardArrowLeft"; import KeyboardArrowRight from "@mui/icons-material/KeyboardArrowRight"; import LastPageIcon from "@mui/icons-material/LastPage"; function BrowserUsedAndTrafficReport(props) { const theme = useTheme(); const { count, page, rowsPerPage, onPageChange } = props; const handleFirstPageButtonClick = (event) => { onPageChange(event, 0); }; const handleBackButtonClick = (event) => { onPageChange(event, page - 1); }; const handleNextButtonClick = (event) => { onPageChange(event, page + 1); }; const handleLastPageButtonClick = (event) => { onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)); }; return ( {theme.direction === "rtl" ? : } {theme.direction === "rtl" ? ( ) : ( )} = Math.ceil(count / rowsPerPage) - 1} aria-label="next page" > {theme.direction === "rtl" ? ( ) : ( )} = Math.ceil(count / rowsPerPage) - 1} aria-label="last page" > {theme.direction === "rtl" ? : } ); } BrowserUsedAndTrafficReport.propTypes = { count: PropTypes.number.isRequired, onPageChange: PropTypes.func.isRequired, page: PropTypes.number.isRequired, rowsPerPage: PropTypes.number.isRequired, }; function createData( channel, sessions, sessionsProgress, prevPeriod, prevPeriodProgress, transactions, transactionsProgress, conRate, bounceRate, change, iconName, badgeClass ) { return { channel, sessions, sessionsProgress, prevPeriod, prevPeriodProgress, transactions, transactionsProgress, conRate, bounceRate, change, iconName, badgeClass, }; } const rows = [ createData( "Organic Search", "10853", "(52%)", "566", "(52%)", "566", "(52%)", "3.2%", "57.8%", "52.80%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Direct", "10844", "(50%)", "666", "(50%)", "766", "(50%)", "2.2%", "20.8%", "55.99%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Referal", "20844", "(60%)", "754", "(60%)", "899", "(60%)", "1.2%", "60.8%", "60.99%", "ri-arrow-down-s-fill", "dangerBadge" ), createData( "Email", "15844", "(50%)", "764", "(50%)", "755", "(50%)", "4.2%", "30.8%", "50.99%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Social", "12844", "(50%)", "764", "(50%)", "755", "(50%)", "5.2%", "35.8%", "50.99%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Chrome", "5853", "(52%)", "466", "(52%)", "566", "(52%)", "6.2%", "40.8%", "52.80%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Safari", "2844", "(50%)", "766", "(50%)", "666", "(50%)", "3.2%", "55.8%", "55.00%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Edge", "1844", "(60%)", "454", "(60%)", "399", "(60%)", "7.2%", "10.8%", "60.00%", "ri-arrow-down-s-fill", "dangerBadge" ), createData( "Firefox", "15844", "(55%)", "564", "(55%)", "455", "(55%)", "4.2%", "20.8%", "55.00%", "ri-arrow-up-s-fill", "successBadge" ), createData( "Opera", "11844", "(50%)", "864", "(50%)", "655", "(50%)", "3.2%", "32.8%", "50.00%", "ri-arrow-up-s-fill", "successBadge" ), ].sort((a, b) => (a.channel < b.channel ? -1 : 1)); const BrowserUsedAndTrafficReports = () => { const [anchorEl, setAnchorEl] = React.useState(null); const open = Boolean(anchorEl); const handleClick = (event) => { setAnchorEl(event.currentTarget); }; const handleClose = () => { setAnchorEl(null); }; // Table const [page, setPage] = React.useState(0); const [rowsPerPage, setRowsPerPage] = React.useState(7); // Avoid a layout jump when reaching the last page with empty rows. const emptyRows = page > 0 ? Math.max(0, (1 + page) * rowsPerPage - rows.length) : 0; const handleChangePage = (event, newPage) => { setPage(newPage); }; const handleChangeRowsPerPage = (event) => { setRowsPerPage(parseInt(event.target.value, 10)); setPage(0); }; return ( <> Browser Used & Traffic Reports Last 15 Days Last Month Last Year Channel Sessions Prev.Period Transactions Con.Rate Bounce Rate % Change {(rowsPerPage > 0 ? rows.slice( page * rowsPerPage, page * rowsPerPage + rowsPerPage ) : rows ).map((row) => ( {row.channel} {row.sessions}{" "} {row.sessionsProgress} {row.prevPeriod}{" "} {row.prevPeriodProgress} {row.transactions}{" "} {row.transactionsProgress} {row.conRate} {row.bounceRate} {row.change}{" "} ))} {emptyRows > 0 && ( )}
); }; export default BrowserUsedAndTrafficReports;