2023-06-06 18:32:48 +03:00
|
|
|
"use client";
|
|
|
|
import {
|
|
|
|
VictoryContainer,
|
|
|
|
VictoryPie,
|
|
|
|
VictoryPieProps,
|
|
|
|
VictoryTheme,
|
|
|
|
} from "victory";
|
|
|
|
|
|
|
|
interface BrainSpaceChartProps extends VictoryPieProps {
|
|
|
|
current_brain_size: number;
|
|
|
|
max_brain_size: number;
|
|
|
|
}
|
|
|
|
|
2023-06-15 12:52:46 +03:00
|
|
|
const BrainSpaceChart = ({
|
2023-06-06 18:32:48 +03:00
|
|
|
current_brain_size,
|
|
|
|
max_brain_size,
|
|
|
|
...props
|
2023-06-15 12:52:46 +03:00
|
|
|
}: BrainSpaceChartProps): JSX.Element => {
|
2023-06-06 18:32:48 +03:00
|
|
|
return (
|
2023-06-15 12:52:46 +03:00
|
|
|
<>
|
|
|
|
{/* @ts-expect-error Server Component */}
|
|
|
|
<VictoryPie
|
|
|
|
data={[
|
|
|
|
{ x: "Used", y: current_brain_size },
|
|
|
|
{ x: "Unused", y: max_brain_size - current_brain_size },
|
|
|
|
]}
|
|
|
|
containerComponent={
|
|
|
|
<VictoryContainer
|
|
|
|
className="bg-white rounded-md w-full h-full"
|
|
|
|
responsive={true}
|
|
|
|
/>
|
|
|
|
}
|
|
|
|
{...props}
|
|
|
|
theme={VictoryTheme.material}
|
|
|
|
/>
|
|
|
|
</>
|
2023-06-06 18:32:48 +03:00
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default BrainSpaceChart;
|