import React, { useMemo } from "react"; export type AuroraResolution = "original" | "1080p" | "4k" | "8k" | "custom"; export type AuroraFormat = "mp4_h264" | "mp4_h265" | "avi_lossless" | "frames_png"; export type AuroraRoi = "full_frame" | "auto_faces" | "auto_plates" | "manual"; export interface AuroraCropBox { x: number; y: number; width: number; height: number; } export interface ExportSettingsValue { resolution: AuroraResolution; format: AuroraFormat; roi: AuroraRoi; customWidth?: number; customHeight?: number; crop?: AuroraCropBox | null; } interface ExportSettingsProps { value: ExportSettingsValue; onChange: (next: ExportSettingsValue) => void; disabled?: boolean; } function toInt(v: string, fallback = 0): number { const n = Number.parseInt(v, 10); return Number.isFinite(n) ? Math.max(0, n) : fallback; } export const ExportSettings: React.FC = ({ value, onChange, disabled = false, }) => { const crop = value.crop ?? { x: 0, y: 0, width: 0, height: 0 }; const showCustomResolution = value.resolution === "custom"; const showManualCrop = value.roi === "manual"; const summary = useMemo(() => { const res = value.resolution === "custom" ? `${value.customWidth || 0}x${value.customHeight || 0}` : value.resolution; return `${res} • ${value.format} • ${value.roi}`; }, [value]); return (
Export Settings
{showCustomResolution && (
)} {showManualCrop && (
)}
Selected: {summary}
); }; export default ExportSettings;