mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-23 14:45:20 +00:00
- Converse (useChat) lifts to the provider: survives desktop panel <-> mobile drawer swaps, internal /campanha navigation and resize (new tab still resets). - Chat Panel/Separator always mounted (RRP panel-count change forces a full navigation); footprint hidden via elementRef + .b167-ai-chat-hidden (display:none !important), avoiding RRP's imperative collapse/expand races. - Single 'open' flag drives both surfaces (open && viewport); reconciled with the panel at desktop settle and on user drag-collapse (gated by isUserInteraction). - Mobile Drawer extracted to CampaignAIDrawer; FAB/setOpen unified; focus moves into the chat on the mobile->desktop swap. - e2e campaignAiChatResize: desktop->mobile, mobile->desktop, closed stays closed, fresh mobile visit closed, navigation survival, new tab resets. - Impl plan: docs/plans/migrar-chat-painel-drawer-resize-impl.md Closes #416
32 lines
845 B
TypeScript
32 lines
845 B
TypeScript
'use client'
|
|
|
|
import { Bot } from 'lucide-react'
|
|
|
|
import { Button } from '@/components/ui/button'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
import { useAISidebar } from '@/components/campaign/shell/ai/CampaignAISidebarContext'
|
|
|
|
export const CampaignAIFab = ({ className }: { className?: string }) => {
|
|
const ctx = useAISidebar()
|
|
|
|
return (
|
|
<div
|
|
className={cn(
|
|
'pointer-events-none fixed bottom-20 right-4 z-40 md:hidden print:hidden',
|
|
'pb-[max(0px,env(safe-area-inset-bottom))]',
|
|
className,
|
|
)}
|
|
>
|
|
<Button
|
|
type="button"
|
|
size="icon"
|
|
className="pointer-events-auto size-8 rounded-full shadow-lg"
|
|
aria-label="Sollinha — Assistente virtual"
|
|
onClick={() => ctx?.setOpen(true)}
|
|
>
|
|
<Bot className="size-4" aria-hidden />
|
|
</Button>
|
|
</div>
|
|
)
|
|
}
|