'use client'; import type { ClassResult } from '@/types/inference'; import { classResultLabel } from '@/lib/classification'; import { useStableTopClass } from '@/hooks/use-stable-top-class'; import { useTranslation } from '@/lib/i18n'; interface ClassificationOverlayProps { classifications: ClassResult[]; width: number; height: number; confidenceThreshold: number; } /** * Classification overlay — no bounding boxes. * * Classification models produce a whole-image verdict rather than localised * objects, so we annotate the frame with a single top-1 chip instead of * drawing rectangles. Rendered as absolutely positioned DOM (not canvas) so * that CJK label text, rounded corners and theming come from CSS rather than * hand-rolled `fillText` layout, and so screen readers can announce the result. * * The chip sits on the top-right, because CameraFeed already occupies the * top-left with the source-type badge. */ export function ClassificationOverlay({ classifications, width, height, confidenceThreshold, }: ClassificationOverlayProps) { const { t } = useTranslation(); const top = useStableTopClass(classifications, { confidenceThreshold }); return (