You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{/* Back to Main Page Button */}
<Box sx={{ marginBottom: '20px', display: 'flex', justifyContent: 'flex-start' }}>
<Button variant="contained" onClick={() => setSelectedGroup(null)}>Back to Main Page
import React, { useState } from 'react';
import { Box, Typography, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, Paper, Card, CardContent, Button, Select, MenuItem } from '@mui/material';
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer, Cell, LabelList } from 'recharts';
import { mainTableData, mainBarChartData, csbbtAdditionalTableData, cltAdditionalTableData } from './resiliencydata';
// Convert Q3 percentage strings to numbers for the bar chart
const convertQ3ToNumber = (q3: string): number => {
return q3.includes('%') ? parseFloat(q3.replace('%', '')) : 0;
};
const ResiliencyEngineering: React.FC = () => {
const [selectedGroup, setSelectedGroup] = useState<string | null>(null); // Track which group is clicked (CSBBT or CLT)
const [filters, setFilters] = useState({ application: '', cio: '', cio2: '', ccp: '', q3: '' });
// Handle filter changes
const handleFilterChange = (field: keyof typeof filters, value: string) => {
setFilters((prevFilters) => ({
...prevFilters,
[field]: value,
}));
};
// Reset all filters
const clearAllFilters = () => {
setFilters({ application: '', cio: '', cio2: '', ccp: '', q3: '' });
};
// Filter the data based on selected group and applied filters
const filteredData = selectedGroup === 'CSBBT'
? csbbtAdditionalTableData.filter((row) =>
Object.keys(filters).every((key) =>
filters[key as keyof typeof filters] === '' || row[key as keyof typeof filters] === filters[key as keyof typeof filters]
)
)
: cltAdditionalTableData.filter((row) =>
Object.keys(filters).every((key) =>
filters[key as keyof typeof filters] === '' || row[key as keyof typeof filters] === filters[key as keyof typeof filters]
)
);
const colors = ['#8884d8', '#82ca9d', '#ffc658', '#ff8042', '#8dd1e1', '#d0ed57', '#a4de6c'];
return (
<Card style={{ flex: 1, margin: '0', width: '100%', padding: '0px' }}>
{/* Back to Main Page Button */}
<Box sx={{ marginBottom: '20px', display: 'flex', justifyContent: 'flex-start' }}>
<Button variant="contained" onClick={() => setSelectedGroup(null)}>Back to Main Page
);
};
export default ResiliencyEngineering;
The text was updated successfully, but these errors were encountered: