chore: update eslint and prettier configuration
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { useMemo } from 'react';
|
||||
import { DetectionData } from '@/types';
|
||||
import { getEnabledDetectionTypes, DETECTION_TYPES } from '@/constants/detectionModeConfig';
|
||||
import {
|
||||
getEnabledDetectionTypes,
|
||||
DETECTION_TYPES,
|
||||
} from '@/constants/detectionModeConfig';
|
||||
|
||||
export const useFrameDetectionMap = (data: DetectionData, detectionType: string) => {
|
||||
export const useFrameDetectionMap = (
|
||||
data: DetectionData,
|
||||
detectionType: string,
|
||||
) => {
|
||||
const frameDetectionMap = useMemo(() => {
|
||||
const map = new Map<number, any[]>();
|
||||
const detectionMode = data.detection_mode || detectionType;
|
||||
@@ -38,7 +44,9 @@ export const useFrameDetectionMap = (data: DetectionData, detectionType: string)
|
||||
// Try common plural naming conventions for legacy support
|
||||
const possibleKeys = [
|
||||
`${type.id}s`,
|
||||
type.id.endsWith('y') ? `${type.id.slice(0, -1)}ies` : `${type.id}s`,
|
||||
type.id.endsWith('y')
|
||||
? `${type.id.slice(0, -1)}ies`
|
||||
: `${type.id}s`,
|
||||
type.listKey.replace('_list', 's'),
|
||||
type.listKey,
|
||||
];
|
||||
@@ -73,7 +81,11 @@ export const useFrameDetectionMap = (data: DetectionData, detectionType: string)
|
||||
return Array.from(frameDetectionMap.keys()).sort((a, b) => a - b);
|
||||
}, [frameDetectionMap]);
|
||||
|
||||
const getNearestDetections = (frame: number, sortedIndices: number[], maxSkip = 3) => {
|
||||
const getNearestDetections = (
|
||||
frame: number,
|
||||
sortedIndices: number[],
|
||||
maxSkip = 3,
|
||||
) => {
|
||||
const exact = frameDetectionMap.get(frame);
|
||||
if (exact) return exact;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user