From d872110fc32f65413bcead03c2ed2eb6de4956da Mon Sep 17 00:00:00 2001 From: Okorie Chigozie Jehoshaphat Date: Fri, 26 Jun 2026 17:51:13 +0100 Subject: [PATCH 1/2] #279 Rebuild components/rating/rating-modal.tsx with shadcn Dialog primitives --- components/rating/rating-modal.tsx | 135 +++++++++++++++++++---------- components/rating/rating-stars.tsx | 42 +++++---- 2 files changed, 118 insertions(+), 59 deletions(-) diff --git a/components/rating/rating-modal.tsx b/components/rating/rating-modal.tsx index 20292686..e2ce38a9 100644 --- a/components/rating/rating-modal.tsx +++ b/components/rating/rating-modal.tsx @@ -1,5 +1,18 @@ -import React, { useState } from 'react'; -import { RatingStars } from './rating-stars'; +"use client"; + +import { useState } from "react"; +import type React from "react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from "@/components/ui/dialog"; +import { Button } from "@/components/ui/button"; +import { Textarea } from "@/components/ui/textarea"; +import { RatingStars } from "./rating-stars"; interface RatingModalProps { contributor: { @@ -15,16 +28,21 @@ interface RatingModalProps { onClose: () => void; } -export const RatingModal: React.FC = ({ contributor, bounty, onSubmit, onClose }) => { +export const RatingModal = ({ + contributor, + bounty, + onSubmit, + onClose, +}: RatingModalProps) => { const [rating, setRating] = useState(0); - const [feedback, setFeedback] = useState(''); + const [feedback, setFeedback] = useState(""); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [success, setSuccess] = useState(false); const handleSubmit = async () => { if (rating < 1 || rating > 5) { - setError('Please select a rating between 1 and 5.'); + setError("Please select a rating between 1 and 5."); return; } setLoading(true); @@ -33,50 +51,79 @@ export const RatingModal: React.FC = ({ contributor, bounty, o await onSubmit(rating, feedback); setSuccess(true); } catch (err) { - console.error(err) - setError('Failed to submit rating. Please try again.'); + console.error(err); + setError("Failed to submit rating. Please try again."); } finally { setLoading(false); } }; - if (success) { - return ( -
-

Success!

-

Rating submitted. Contributor reputation updated.

- -
- ); - } - return ( -
-

Rate Contributor

-
- Bounty: {bounty.title} -
-
- Contributor: {contributor.name} -
-
- Current Reputation: {contributor.reputation} -
-
- -
-