import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faPaperPlane } from "@fortawesome/pro-regular-svg-icons"; import { useForm } from "react-hook-form"; import { useMutation, useQuery, useRouter } from "blitz"; import sendMessage from "../mutations/send-message"; import { Direction, Message, MessageStatus } from "../../../db"; import getConversationsQuery from "../queries/get-conversations"; import useCurrentCustomer from "../../core/hooks/use-current-customer"; import useCustomerPhoneNumber from "../../core/hooks/use-customer-phone-number"; type Form = { content: string; }; export default function NewMessageArea() { const router = useRouter(); const recipient = router.params.recipient; const { customer } = useCurrentCustomer(); const phoneNumber = useCustomerPhoneNumber(); const sendMessageMutation = useMutation(sendMessage)[0]; const { setQueryData: setConversationsQueryData, refetch: refetchConversations } = useQuery( getConversationsQuery, {} )[1]; const { register, handleSubmit, setValue, formState: { isSubmitting }, } = useForm
); } function uuidv4() { return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { const r = (Math.random() * 16) | 0, v = c == "x" ? r : (r & 0x3) | 0x8; return v.toString(16); }); }