"use client"; import { useState } from "react"; import { useRSVPData } from "components/PageSWRDataProvider"; import { useEntitySetContext } from "components/EntitySetProvider"; import { ButtonPrimary } from "components/Buttons"; import { Popover } from "components/Popover"; import { theme } from "tailwind.config"; import { useToaster } from "components/Toast"; import { sendUpdateToRSVPS } from "actions/sendUpdateToRSVPS"; import { useReplicache } from "src/replicache"; import { Checkbox } from "components/Checkbox"; import { useReadOnlyShareLink } from "app/[leaflet_id]/actions/ShareOptions"; export function SendUpdateButton(props: { entityID: string }) { let publishLink = useReadOnlyShareLink(); let { permissions } = useEntitySetContext(); let { permission_token } = useReplicache(); let [input, setInput] = useState(""); let toaster = useToaster(); let [open, setOpen] = useState(false); let [checkedRecipients, setCheckedRecipients] = useState({ GOING: true, MAYBE: true, NOT_GOING: false, }); let { data, mutate } = useRSVPData(); let attendees = data?.rsvps?.filter((rsvp) => rsvp.entity === props.entityID) || []; let going = attendees.filter((rsvp) => rsvp.status === "GOING"); let maybe = attendees.filter((rsvp) => rsvp.status === "MAYBE"); let notGoing = attendees.filter((rsvp) => rsvp.status === "NOT_GOING"); let allRecipients = ((checkedRecipients.GOING && going.length) || 0) + ((checkedRecipients.MAYBE && maybe.length) || 0) + ((checkedRecipients.NOT_GOING && notGoing.length) || 0); if (!!!permissions.write) return; return ( setOpen(open)} trigger={ Send a Text Blast } >

Send a Text Blast to