chore: auto-commit (1 archivos)
- frontend/src/components/Dashboard.tsx Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
import { AreaChart, BarChart, LineChart } from "@mantine/charts";
|
import { BarChart, LineChart } from "@mantine/charts";
|
||||||
import "@mantine/charts/styles.css";
|
import "@mantine/charts/styles.css";
|
||||||
|
import {
|
||||||
|
Area,
|
||||||
|
AreaChart as RAreaChart,
|
||||||
|
CartesianGrid,
|
||||||
|
Legend,
|
||||||
|
ResponsiveContainer,
|
||||||
|
Tooltip,
|
||||||
|
XAxis,
|
||||||
|
YAxis,
|
||||||
|
} from "recharts";
|
||||||
import {
|
import {
|
||||||
Badge,
|
Badge,
|
||||||
Box,
|
Box,
|
||||||
@@ -120,8 +130,13 @@ export function Dashboard({ users }: Props) {
|
|||||||
if (!data) return [];
|
if (!data) return [];
|
||||||
const arr = data.cumulative_flow;
|
const arr = data.cumulative_flow;
|
||||||
const firstIdx = arr.findIndex((p) => p.total > 0 || p.done > 0);
|
const firstIdx = arr.findIndex((p) => p.total > 0 || p.done > 0);
|
||||||
if (firstIdx <= 0) return arr;
|
const sliced = firstIdx <= 0 ? arr : arr.slice(Math.max(0, firstIdx - 1));
|
||||||
return arr.slice(Math.max(0, firstIdx - 1));
|
return sliced.map((p) => ({
|
||||||
|
date: p.date,
|
||||||
|
done: p.done,
|
||||||
|
wip: Math.max(0, p.total - p.done),
|
||||||
|
total: p.total,
|
||||||
|
}));
|
||||||
}, [data]);
|
}, [data]);
|
||||||
|
|
||||||
const throughputSeries = useMemo(() => {
|
const throughputSeries = useMemo(() => {
|
||||||
@@ -277,23 +292,50 @@ export function Dashboard({ users }: Props) {
|
|||||||
Sin datos.
|
Sin datos.
|
||||||
</Text>
|
</Text>
|
||||||
) : (
|
) : (
|
||||||
<AreaChart
|
<div style={{ height: 260, width: "100%" }}>
|
||||||
h={260}
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
data={cumulativeFlow}
|
<RAreaChart data={cumulativeFlow} margin={{ top: 10, right: 16, left: 0, bottom: 0 }}>
|
||||||
dataKey="date"
|
<CartesianGrid strokeDasharray="5 5" stroke="var(--mantine-color-gray-4)" />
|
||||||
withLegend
|
<XAxis dataKey="date" tick={{ fontSize: 12, fill: "currentColor" }} />
|
||||||
withDots
|
<YAxis allowDecimals={false} tick={{ fontSize: 12, fill: "currentColor" }} />
|
||||||
withGradient
|
<Tooltip
|
||||||
fillOpacity={0.5}
|
contentStyle={{
|
||||||
strokeWidth={2.5}
|
background: "var(--mantine-color-body)",
|
||||||
curveType="monotone"
|
border: "1px solid var(--mantine-color-gray-3)",
|
||||||
gridAxis="xy"
|
borderRadius: 6,
|
||||||
series={[
|
fontSize: 12,
|
||||||
{ name: "total", label: "Total", color: "blue.6" },
|
}}
|
||||||
{ name: "done", label: "Hechas", color: "green.6" },
|
/>
|
||||||
]}
|
<Legend wrapperStyle={{ fontSize: 12 }} />
|
||||||
yAxisProps={{ allowDecimals: false }}
|
<Area
|
||||||
/>
|
type="linear"
|
||||||
|
dataKey="done"
|
||||||
|
name="Hechas"
|
||||||
|
stackId="cfd"
|
||||||
|
stroke="var(--mantine-color-green-6)"
|
||||||
|
fill="var(--mantine-color-green-6)"
|
||||||
|
fillOpacity={0.55}
|
||||||
|
strokeWidth={2}
|
||||||
|
isAnimationActive={false}
|
||||||
|
dot={{ r: 3, fill: "var(--mantine-color-green-6)", strokeWidth: 0 }}
|
||||||
|
activeDot={{ r: 5 }}
|
||||||
|
/>
|
||||||
|
<Area
|
||||||
|
type="linear"
|
||||||
|
dataKey="wip"
|
||||||
|
name="En curso"
|
||||||
|
stackId="cfd"
|
||||||
|
stroke="var(--mantine-color-blue-6)"
|
||||||
|
fill="var(--mantine-color-blue-6)"
|
||||||
|
fillOpacity={0.55}
|
||||||
|
strokeWidth={2}
|
||||||
|
isAnimationActive={false}
|
||||||
|
dot={{ r: 3, fill: "var(--mantine-color-blue-6)", strokeWidth: 0 }}
|
||||||
|
activeDot={{ r: 5 }}
|
||||||
|
/>
|
||||||
|
</RAreaChart>
|
||||||
|
</ResponsiveContainer>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</Paper>
|
</Paper>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user