mirror of
https://github.com/arcan1s/ahriman.git
synced 2026-04-07 19:03:38 +00:00
upload ai slop
This commit is contained in:
39
frontend/src/components/charts/PackageCountBarChart.tsx
Normal file
39
frontend/src/components/charts/PackageCountBarChart.tsx
Normal file
@@ -0,0 +1,39 @@
|
||||
import type React from "react";
|
||||
import { Bar } from "react-chartjs-2";
|
||||
import { Chart as ChartJS, CategoryScale, LinearScale, BarElement, Tooltip, Legend } from "chart.js";
|
||||
import type { RepositoryStats } from "api/types/RepositoryStats";
|
||||
|
||||
ChartJS.register(CategoryScale, LinearScale, BarElement, Tooltip, Legend);
|
||||
|
||||
interface PackageCountBarChartProps {
|
||||
stats: RepositoryStats;
|
||||
}
|
||||
|
||||
export default function PackageCountBarChart({ stats }: PackageCountBarChartProps): React.JSX.Element {
|
||||
const data = {
|
||||
labels: ["packages"],
|
||||
datasets: [
|
||||
{
|
||||
label: "archives",
|
||||
data: [stats.packages ?? 0],
|
||||
},
|
||||
{
|
||||
label: "bases",
|
||||
data: [stats.bases ?? 0],
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return (
|
||||
<Bar
|
||||
data={data}
|
||||
options={{
|
||||
maintainAspectRatio: false,
|
||||
responsive: true,
|
||||
scales: {
|
||||
x: { stacked: true },
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user