'use client' import type { StructuredGrid } from './types' const KLAUSUR_API = '/klausur-api' interface GridImageOverlayProps { sessionId: string grid: StructuredGrid } const ZONE_COLORS = [ { border: 'rgba(20,184,166,0.7)', fill: 'rgba(20,184,166,0.05)' }, // teal { border: 'rgba(245,158,11,0.7)', fill: 'rgba(245,158,11,0.05)' }, // amber { border: 'rgba(99,102,241,0.7)', fill: 'rgba(99,102,241,0.05)' }, // indigo { border: 'rgba(236,72,153,0.7)', fill: 'rgba(236,72,153,0.05)' }, // pink ] export function GridImageOverlay({ sessionId, grid }: GridImageOverlayProps) { const imgUrl = `${KLAUSUR_API}/api/v1/ocr-pipeline/sessions/${sessionId}/image/cropped` return (
{/* Source image */} {/* eslint-disable-next-line @next/next/no-img-element */} OCR Scan {/* SVG overlay */} {grid.zones.map((zone) => { const colors = ZONE_COLORS[zone.zone_index % ZONE_COLORS.length] const b = zone.bbox_px return ( {/* Zone border */} {/* Column separators */} {zone.columns.slice(1).map((col) => ( ))} {/* Row separators */} {zone.rows.slice(1).map((row) => ( ))} {/* Zone label */} {zone.zone_type === 'box' ? 'BOX' : 'CONTENT'} Z{zone.zone_index} {' '}({zone.columns.length}x{zone.rows.length}) ) })}
) }