chore: update eslint and prettier configuration

This commit is contained in:
2026-06-17 16:23:28 +05:30
parent b54242cf7e
commit 4c2241ff72
140 changed files with 2270 additions and 1287 deletions

View File

@@ -3,7 +3,9 @@ import { DETECTION_TYPES } from '@/constants/detectionModeConfig';
/**
* Color mapping for detection types
*/
export const DETECTION_COLORS: Record<string, string> = Object.keys(DETECTION_TYPES).reduce(
export const DETECTION_COLORS: Record<string, string> = Object.keys(
DETECTION_TYPES,
).reduce(
(acc, key) => {
acc[key] = DETECTION_TYPES[key].color;
return acc;
@@ -20,7 +22,7 @@ const resolvedColorCache = new Map<string, string>();
*/
function resolveCanvasColor(colorStr: string): string {
if (typeof window === 'undefined') return colorStr;
// Return from cache if already resolved
if (resolvedColorCache.has(colorStr)) {
return resolvedColorCache.get(colorStr)!;
@@ -34,7 +36,7 @@ function resolveCanvasColor(colorStr: string): string {
document.body.appendChild(temp);
const resolved = getComputedStyle(temp).color;
document.body.removeChild(temp);
if (resolved && resolved !== 'transparent') {
resolvedColorCache.set(colorStr, resolved);
return resolved;
@@ -42,7 +44,7 @@ function resolveCanvasColor(colorStr: string): string {
} catch (e) {
console.warn('Failed to resolve color:', colorStr, e);
}
return colorStr;
}
@@ -85,14 +87,15 @@ export const drawBoundingBoxes = (
ctx.fillRect(x1, y1, x2 - x1, y2 - y1);
// 3. Draw Label
const id = detection.pothole_id ?? detection.signboard_id ?? detection.detection_id;
const id =
detection.pothole_id ?? detection.signboard_id ?? detection.detection_id;
const label = `${type.replace(/_/g, ' ')} #${id} ${(detection.confidence * 100).toFixed(0)}%`;
ctx.font = 'bold 12px sans-serif';
const metrics = ctx.measureText(label);
// Label Background (Solid for readability)
ctx.globalAlpha = 1.0;
ctx.globalAlpha = 1.0;
ctx.fillStyle = boxColor;
ctx.fillRect(x1, y1 - 20, metrics.width + 10, 20);