File size: 1,714 Bytes
2485dd8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import {Chart} from 'react-google-charts';
import debug from './debug';
import {
Accordion,
AccordionDetails,
AccordionSummary,
Button,
Typography,
} from '@mui/material';
import {useState} from 'react';
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
export default function DebugChart() {
const [showDebugTimings, setShowDebugTimings] = useState<boolean>(false);
const data = debug()?.getChartData();
const options = {
timeline: {
groupByRowLabel: true,
},
};
return (
<div className="horizontal-padding-sra text-chunk-sra">
<Accordion
expanded={showDebugTimings}
onChange={() => setShowDebugTimings(!showDebugTimings)}
elevation={0}
sx={{border: 1, borderColor: 'rgba(0, 0, 0, 0.3)'}}>
<AccordionSummary
expandIcon={<ArrowDropDownIcon />}
className="debug-section">
Debug Info
</AccordionSummary>
<AccordionDetails>
{data && data.length > 1 ? (
<>
<Chart
chartType="Timeline"
data={data}
width="100%"
height="400px"
options={options}
/>
<Button
variant="contained"
sx={{marginBottom: 1}}
onClick={() => {
debug()?.downloadInputAudio();
debug()?.downloadOutputAudio();
}}>
Download Input / Ouput Audio
</Button>
</>
) : (
<Typography>No input / output detected</Typography>
)}
</AccordionDetails>
</Accordion>
</div>
);
}
|