diff --git a/src/components/Report/Report.tsx b/src/components/Report/Report.tsx index 3630c87f2cabd95495a58ac32d945aaf1b0ee78b..ca2bd50df11de7021db69e8dbdd14aab10f6e71b 100644 --- a/src/components/Report/Report.tsx +++ b/src/components/Report/Report.tsx @@ -3,10 +3,11 @@ import { ToastContainer, toast } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import { FaWallet, FaStar } from "react-icons/fa6"; import ReportModal from "./ReportModal"; +import { useSearchParams } from "react-router-dom"; const Report = () => { - const [report, setReport] = useState(""); - const [rating, setRating] = useState(0); + const [searchParams, setSearchParams] = useSearchParams(); + const [report, setReport] = useState(searchParams.get('desc') || ''); const [popUp, setPopUp] = useState(false); const handleReportValid = () => { @@ -27,11 +28,7 @@ const Report = () => { toast.error("Oops! Something went wrong. ðŸ˜"); }; - const isReportValid = report.length > 0 && rating > 0; - - const handleStarClick = (selectedRating) => { - setRating(selectedRating); - }; + const isReportValid = report.length > 0; return ( <> @@ -40,23 +37,13 @@ const Report = () => { <div className="text-center text-white rounded-lg bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-darkgreen via-lightgreen to-verylightgreen p-4"> <h1 className="font-bold text-4xl">Report</h1> </div> - <div className="mt-4 flex items-center justify-center p-5 max-w-screen-2xl"> - <div className="mb-4 flex flex-row items-center text-8xl"> - {[1, 2, 3, 4, 5].map((star) => ( - <FaStar - key={star} - className={star <= rating ? "text-yellow" : "text-gray"} - onClick={() => handleStarClick(star)} - /> - ))} - </div> - </div> <div className="rounded-xl border border-darkgreen mt-4 shadow-lg flex wrap md:flex-col flex-col my-0 mx-auto p-5 max-w-screen-2xl"> <h1 className="text-4xl font-semibold mb-2">Tell Us Your Feedback</h1> <div className="mb-4"> <label> <input type="text" + value={report} onChange={(e) => { setReport(e.target.value); }}