import { LuChevronDown } from "react-icons/lu"; import { Badge } from "@/components/ui/badge"; import { Popover, PopoverContent, PopoverTrigger, } from "@/components/ui/popover"; import type { FieldDelta } from "@/hooks/use-config-override"; import { cn } from "@/lib/utils"; import { useOverrideFieldLabel } from "./useOverrideFieldLabel"; type Props = { sectionPath: string; deltas: FieldDelta[]; /** Translated label shown inside the badge */ badgeLabel: string; /** Accessible label for the badge trigger */ ariaLabel: string; /** Heading rendered at the top of the popover content */ heading: string; /** Message shown when there are zero field deltas */ noDeltasMessage: string; /** Border color class for the badge (defaults to selected) */ borderColorClass?: string; className?: string; }; /** * Shared popover layout for "this scope overrides these fields" badges * (e.g. profile overrides base config, camera overrides global config). */ export function OverrideDeltaPopover({ sectionPath, deltas, badgeLabel, ariaLabel, heading, noDeltasMessage, borderColorClass, className, }: Props) { const fieldLabel = useOverrideFieldLabel(sectionPath); const count = deltas.length; return ( e.stopPropagation()}> {badgeLabel}
{count > 0 ? heading : noDeltasMessage}
{count > 0 && (
    {deltas.map((delta) => (
  • {fieldLabel(delta.fieldPath)}
  • ))}
)}
); }