mirror of
https://github.com/kjanat/livedash-node.git
synced 2026-01-16 13:32:08 +01:00
refactor: fix biome linting issues and update project documentation
- Fix 36+ biome linting issues reducing errors/warnings from 227 to 191 - Replace explicit 'any' types with proper TypeScript interfaces - Fix React hooks dependencies and useCallback patterns - Resolve unused variables and parameter assignment issues - Improve accessibility with proper label associations - Add comprehensive API documentation for admin and security features - Update README.md with accurate PostgreSQL setup and current tech stack - Create complete documentation for audit logging, CSP monitoring, and batch processing - Fix outdated project information and missing developer workflows
This commit is contained in:
71
components/security/SecurityMetricsChart.tsx
Normal file
71
components/security/SecurityMetricsChart.tsx
Normal file
@ -0,0 +1,71 @@
|
||||
"use client";
|
||||
|
||||
import {
|
||||
Bar,
|
||||
BarChart,
|
||||
Line,
|
||||
LineChart,
|
||||
ResponsiveContainer,
|
||||
Tooltip,
|
||||
XAxis,
|
||||
YAxis,
|
||||
} from "recharts";
|
||||
|
||||
interface SecurityMetricsChartProps {
|
||||
data: Array<{ hour: number; count: number }>;
|
||||
type?: "line" | "bar";
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export function SecurityMetricsChart({
|
||||
data,
|
||||
type = "line",
|
||||
title,
|
||||
}: SecurityMetricsChartProps) {
|
||||
const chartData = data.map((item) => ({
|
||||
hour: `${item.hour}:00`,
|
||||
count: item.count,
|
||||
}));
|
||||
|
||||
const ChartComponent = type === "line" ? LineChart : BarChart;
|
||||
const DataComponent =
|
||||
type === "line" ? (
|
||||
<Line
|
||||
type="monotone"
|
||||
dataKey="count"
|
||||
stroke="#8884d8"
|
||||
strokeWidth={2}
|
||||
dot={{ fill: "#8884d8", strokeWidth: 2 }}
|
||||
/>
|
||||
) : (
|
||||
<Bar dataKey="count" fill="#8884d8" />
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
{title && <h3 className="text-lg font-semibold">{title}</h3>}
|
||||
<ResponsiveContainer width="100%" height={300}>
|
||||
<ChartComponent data={chartData}>
|
||||
<XAxis
|
||||
dataKey="hour"
|
||||
tick={{ fontSize: 12 }}
|
||||
tickLine={{ stroke: "#e5e7eb" }}
|
||||
/>
|
||||
<YAxis
|
||||
tick={{ fontSize: 12 }}
|
||||
tickLine={{ stroke: "#e5e7eb" }}
|
||||
axisLine={{ stroke: "#e5e7eb" }}
|
||||
/>
|
||||
<Tooltip
|
||||
contentStyle={{
|
||||
backgroundColor: "#f9fafb",
|
||||
border: "1px solid #e5e7eb",
|
||||
borderRadius: "6px",
|
||||
}}
|
||||
/>
|
||||
{DataComponent}
|
||||
</ChartComponent>
|
||||
</ResponsiveContainer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user