Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

933 B
Raw Blame
import { useDroppable } from '@dnd-kit/core'
import clsx from 'clsx'
import { useValues } from 'kea'

import { dayjs } from 'lib/dayjs'

import { sendCalendarLogic } from './sendCalendarLogic'
import { CalendarSend, dropTarget } from './sendCalendarUtils'

export function SendCalendarDropZone({
    day,
    className,
    children,
}: {
    day: string
    className?: string
    children: React.ReactNode
}): JSX.Element {
    const { timezone } = useValues(sendCalendarLogic)
    const { setNodeRef, isOver, active } = useDroppable({ id: day })
    const send = active?.data.current?.send as CalendarSend | undefined
    const accepts = !!send && !!dropTarget(send, day, timezone, dayjs())

    return (
        <div
            ref={setNodeRef}
            className={clsx(className, isOver && accepts && 'bg-primary-highlight')}
            data-attr="send-calendar-day"
        >
            {children}
        </div>
    )
}