"use client"; import type { Layer } from "@pien-studio/types"; import Image from "next/image"; import type { FaceDetectionOverlay, FacePreview } from "../../hooks/use-face-detection"; import { useTranslations } from "../../hooks/use-translations"; import { panelClass, panelCounterClass, panelInsetClass, panelTitleClass } from "../../lib/theme"; type Props = { isDark: boolean; selectedLayer: Layer | null; faceDetections: FaceDetectionOverlay[]; facePreviews: FacePreview[]; faceStatus: "idle" | "detecting" | "unsupported"; blurMethod: "gaussian" | "pixelate" | "censor"; blurAmount: number; censorColor: string; selectedFaceIndices: number[]; hasActiveBlur: boolean; onSetBlurMethod: (method: "gaussian" | "pixelate" | "censor") => void; onSetBlurAmount: (amount: number) => void; onSetCensorColor: (color: string) => void; onToggleFaceIndex: (index: number) => void; onBlur: (indices: number[]) => void; onClearBlur: () => void; }; export function FacePanel({ isDark, selectedLayer, faceDetections, facePreviews, faceStatus, blurMethod, blurAmount, censorColor, selectedFaceIndices, hasActiveBlur, onSetBlurMethod, onSetBlurAmount, onSetCensorColor, onToggleFaceIndex, onBlur, onClearBlur, }: Props) { const { t } = useTranslations(); const hasFaces = faceDetections.length > 0; return (
{faceStatus === "unsupported" ? t("editor.faceMlFailed") : faceStatus === "detecting" ? t("editor.detectingFaces") : selectedLayer?.type !== "raster" ? t("editor.selectImageLayer") : faceDetections.length === 0 ? t("editor.noFacesFound") : t("editor.facesDetected")}
{hasFaces ? (