import React from "react"; import { Button, Modal, ModalProps, Rating, Text, Textarea } from "@mantine/core"; import { toast } from "react-hot-toast"; import { supabase } from "src/lib/api/supabase"; export const ReviewModal: React.FC = ({ opened, onClose }) => { const [stars, setStars] = React.useState(0); const [review, setReview] = React.useState(""); return ( { onClose(); setStars(0); setReview(""); }} centered >
{ e.preventDefault(); if (stars === 0 && !review.length) return onClose(); supabase .from("reviews") .insert({ stars, review }) .then(({ error }) => { if (error) return toast.error(error.message); toast.success("Thank you for your feedback!"); }); onClose(); }} > How was your experience?