'use client' import { usePathname } from 'next/navigation' import { useEffect } from 'react' import { CampaignGlobalSearchBody } from '@/components/campaign/dashboard/CampaignGlobalSearchMount' import { CampaignHomeActionStrip } from '@/components/campaign/dashboard/CampaignHomeActionStrip' import { useHomeSearch } from '@/components/campaign/dashboard/HomeSearchContext' import { HomeSearchExcludeProvider } from '@/components/campaign/dashboard/HomeSearchExcludeContext' import { useCampaignQuickActionContext } from '@/components/campaign/shell/CampaignQuickActionContext' import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from '@/components/ui/dialog' import { Drawer, DrawerContent, DrawerDescription, DrawerTitle } from '@/components/ui/Drawer' import { useIsMobile } from '@/hooks/use-mobile' import type { CampaignQuickAction } from '@/lib/campaignQuickActionTypes' import { resolveHomeSearchExcludeContext } from '@/lib/homeSearchExcludeCurrentEntity' import { cn } from '@/lib/utils' const overlayRetractionClass = (retracted: boolean) => cn( 'grid min-h-0 transition-[grid-template-rows,opacity] duration-[220ms] ease-out motion-reduce:transition-none', retracted ? 'grid-rows-[0fr] opacity-0 pointer-events-none motion-reduce:opacity-0' : 'grid-rows-[1fr] opacity-100 motion-reduce:opacity-100', ) const OverlayActionsChrome = ({ actions, retracted, }: { actions: readonly CampaignQuickAction[] retracted: boolean }) => { if (actions.length === 0) return null return (
({ id: action.id, label: action.label, icon: action.icon, description: action.description, href: action.href, }))} className="w-full" />
) } const OverlaySearchChrome = ({ className }: { className?: string }) => (
) const CampaignQuickActionsOverlayBody = ({ actions, }: { actions: readonly CampaignQuickAction[] }) => { const { uiFocused: focused } = useHomeSearch() return (
) } const CampaignQuickActionsOverlayContent = ({ actions, }: { actions: readonly CampaignQuickAction[] }) => { const pathname = usePathname() const { context } = useCampaignQuickActionContext() const excludeContext = resolveHomeSearchExcludeContext(pathname, context) return ( ) } export const CampaignQuickActionsOverlay = ({ open, onOpenChange, actions, }: { open: boolean onOpenChange: (open: boolean) => void actions: readonly CampaignQuickAction[] }) => { const isMobile = useIsMobile() const { clear } = useHomeSearch() useEffect(() => { if (!open) clear() }, [open, clear]) if (isMobile) { return ( Ações rápidas Ações do contexto e busca na campanha
) } return ( Ações rápidas Ações do contexto e busca na campanha
) }