Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
import {
BarChart,
Bar,
XAxis,
YAxis,
CartesianGrid,
} from "recharts";
import {
ChartContainer,
ChartTooltip,
ChartTooltipContent,
type ChartConfig,
} from "@multica/ui/components/ui/chart";
import { useLocale, useT } from "../../../i18n";
// Three-segment stack — completed runs at the bottom (chart-1, primary
// brand), then cancelled (chart-3, muted: a manual stop is an outcome, not
// an error), failed on top (chart-5 for distinct emphasis). Lets the user
// see day-over-day failure-rate trend without a separate chart.
const tasksChartConfig = {
completed: { label: "Completed", color: "var(--chart-1)" },
cancelled: { label: "Cancelled", color: "var(--chart-3)" },
failed: { label: "Failed", color: "var(--chart-5)" },
} satisfies ChartConfig;
export interface DailyTasksData {
date: string;
label: string;
completed: number;
failed: number;
cancelled: number;
}
export function DailyTasksChart({ data }: { data: DailyTasksData[] }) {
const { t } = useT("runtimes");
const locale = useLocale();
return (
<ChartContainer config={tasksChartConfig} className="aspect-[3/1] w-full">
<BarChart data={data} margin={{ left: 0, right: 0, top: 4, bottom: 0 }}>
<CartesianGrid vertical={false} />
<XAxis
dataKey="label"
tickLine={false}
axisLine={false}
tickMargin={8}
interval="preserveStartEnd"
/>
<YAxis
tickLine={false}
axisLine={false}
tickMargin={8}
allowDecimals={false}
width="auto"
/>
<ChartTooltip
content={
<ChartTooltipContent
formatter={(value, name) => `${value} ${name}`}
footer={(payload) => {
const total = payload.reduce(
(sum, item) =>
sum +
(typeof item.value === "number" ? item.value : 0),
0,
);
return (
<div className="flex items-center justify-between gap-2 font-medium">
<span>{t(($) => $.charts.tooltip_total)}</span>
<span className="font-mono tabular-nums">
{total.toLocaleString(locale)}
</span>
</div>
);
}}
/>
}
/>
<Bar
dataKey="completed"
stackId="tasks"
fill="var(--color-completed)"
radius={[0, 0, 0, 0]}
/>
<Bar
dataKey="cancelled"
stackId="tasks"
fill="var(--color-cancelled)"
radius={[0, 0, 0, 0]}
/>
<Bar
dataKey="failed"
stackId="tasks"
fill="var(--color-failed)"
radius={[3, 3, 0, 0]}
/>
</BarChart>
</ChartContainer>
);
}