"use client" import { Checkbox } from "@/components/ui/checkbox" import { Label } from "@/components/ui/label" import { AutomationBorderedFieldset } from "@/components/gmail/settings/automation/automation-bordered-fieldset" import { useAgendaCalendars } from "@/lib/api/hooks/use-calendar-queries" import type { WebhookAgendaScope } from "@/lib/mail-automation/webhook-config" export function WebhookAgendaScopeEditor({ scope, onChange, enabled, className, }: { scope: WebhookAgendaScope onChange: (scope: WebhookAgendaScope) => void enabled: boolean className?: string }) { const { data: calendars = [], isLoading } = useAgendaCalendars() if (!enabled) return null function toggleCalendar(calendarId: string) { const ids = scope.calendar_ids.includes(calendarId) ? scope.calendar_ids.filter((id) => id !== calendarId) : [...scope.calendar_ids, calendarId] onChange({ all_calendars: false, calendar_ids: ids }) } return ( {!scope.all_calendars && (
{isLoading ? (

Chargement…

) : calendars.length === 0 ? (

Aucun agenda configuré.

) : ( )}
)}
) }