import { Send, X } from "lucide-react"; import { useMemo, useState } from "react"; import { createPortal } from "react-dom"; import type { AccountRow } from "../types"; import { ActionButton } from "./ActionButton"; import { MultiUserPicker } from "./EntityPicker"; type TargetMode = "all" | "selected"; // CreateBroadcastModal composes the message and target list, then hands off to // ActionButton for the usual dry-run/confirm flow. "All users" is resolved to an // explicit id list server-side (cmd/telesrv-admin/server.go), not here -- the // picker only ever deals with an actual, visible list of accounts. export function CreateBroadcastModal({ onClose, onCreated }: { onClose: () => void; onCreated: () => void }) { const [message, setMessage] = useState(""); const [targetMode, setTargetMode] = useState("all"); const [recipients, setRecipients] = useState([]); const disabled = useMemo(() => { if (!message.trim()) return true; if (targetMode === "selected" && recipients.length === 0) return true; return false; }, [message, targetMode, recipients]); return createPortal(
{"Broadcasts"}

{"Send broadcast"}

{"Sends a message from the official system account (777000) to all users or to a chosen list. Delivery happens in the background and may take a few minutes for large audiences."}