'use client' import { useState } from 'react' import { AdvisorPermissionEditor } from '@/components/campaign/advisor/AdvisorPermissionEditor' import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/Popover' import { advisorProfileLabel, type AdvisorEditing, type AdvisorVisibility, } from '@/lib/campaignAdvisorProfile' import type { CampaignFormActionState } from '@/utilities/campaignFormActionError' type AdvisorPermissionBadgeProps = { visibility: AdvisorVisibility editing: AdvisorEditing /** Present = saved on the server; absent = new-advisor draft row. */ advisorId?: number formAction?: ( state: CampaignFormActionState, formData: FormData, ) => Promise onDraftChange?: (visibility: AdvisorVisibility, editing: AdvisorEditing) => void /** Names the account for the badge's accessible label. */ advisorName?: string } /** * C141 — the "Permissão" cell: a compact badge that opens the Visão × Edição * editor in a popover. Reused in the advisors list and the new-advisor draft * row; the detail page embeds the editor directly in its own section. */ export const AdvisorPermissionBadge = ({ visibility, editing, advisorId, formAction, onDraftChange, advisorName = 'conta', }: AdvisorPermissionBadgeProps) => { const [open, setOpen] = useState(false) return ( setOpen(false)} onCancel={() => setOpen(false)} /> ) }