add dev inputs
This commit is contained in:
@@ -4,6 +4,7 @@ import { useTranslations } from 'next-intl';
|
||||
import { useMemo } from 'react';
|
||||
import { BarChart, Bar, Cell, XAxis, Tooltip } from 'recharts';
|
||||
import { pluralize } from '@/app/lib/pluralize';
|
||||
import { useStoreWithDevtools } from '@/app/stores/useStoreWithDevtools';
|
||||
|
||||
type Files = {
|
||||
data: {
|
||||
@@ -31,10 +32,13 @@ export const StackedBarChart = ({ data }: Files) => {
|
||||
const STROKE_COLOR = "#dfdede24";
|
||||
const STROKE_WIDTH = 1;
|
||||
|
||||
const { totalChecks, totalViolations } = useMemo(() => ({
|
||||
totalChecks: data.reduce((sum, item) => sum + (item.checks || 0), 0),
|
||||
totalViolations: data.reduce((sum, item) => sum + (item.violations || 0), 0)
|
||||
}), [data]);
|
||||
/* const { totalChecks, totalViolations } = useMemo(() => ({
|
||||
totalChecks: data.reduce((sum, item) => sum + (item.checks || 0), 0),
|
||||
totalViolations: data.reduce((sum, item) => sum + (item.violations || 0), 0)
|
||||
}), [data]); */
|
||||
|
||||
const totalChecks = useStoreWithDevtools(s => s.value1);
|
||||
const totalViolations = useStoreWithDevtools(s => s.value2);
|
||||
|
||||
const renderBarWithPartialBorder = (props: BarShapeProps) => {
|
||||
const { x, y, width, height, fill } = props;
|
||||
@@ -208,13 +212,13 @@ export const StackedBarChart = ({ data }: Files) => {
|
||||
<div className="protection-stat-total-info">
|
||||
<div
|
||||
className={`font-bold`}
|
||||
style={{color: CHECKS_COLOR}}
|
||||
style={{ color: CHECKS_COLOR }}
|
||||
>
|
||||
{totalChecks} {pluralizeCheks(totalChecks)}
|
||||
</div>
|
||||
<div
|
||||
className={`font-bold`}
|
||||
style={{color: VIOLATIONS_COLOR}}
|
||||
style={{ color: VIOLATIONS_COLOR }}
|
||||
>
|
||||
{totalViolations} {pluralizeViolations(totalViolations)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user