teqo/src/components/campaign/dashboard/HomeSearchWhatsAppAction.tsx
Cursor Agent b96bf190e8 B55 — Busca global: ações de linha (WA e compartilhar)
Adiciona trailing actions nas linhas de resultado da busca global:
- WhatsApp em lideranças e assessores (reusa whatsAppHrefForPhone)
- Compartilhar em demandas e atividades (Web Share nativo com fallback wa.me)
- trailingAction fora do Link da linha para não roubar navegação

Closes #9
2026-07-30 22:47:03 +00:00

41 lines
927 B
TypeScript

'use client'
import { MessageCircleIcon } from 'lucide-react'
import { Button } from '@/components/ui/button'
import { whatsAppHrefForPhone } from '@/lib/phone'
const stopRowNavigation = (event: { stopPropagation: () => void }) => {
event.stopPropagation()
}
export const HomeSearchWhatsAppAction = ({
phone,
contactName,
}: {
phone: string | null
contactName: string
}) => {
const whatsAppHref = whatsAppHrefForPhone(phone)
if (!whatsAppHref) return null
return (
<Button
asChild
variant="ghost"
size="icon"
className="size-10 shrink-0"
onClick={stopRowNavigation}
onMouseDown={stopRowNavigation}
>
<a
href={whatsAppHref}
target="_blank"
rel="noopener noreferrer"
aria-label={`Abrir no WhatsApp — ${contactName}`}
>
<MessageCircleIcon className="size-4" aria-hidden="true" />
</a>
</Button>
)
}