diff --git a/client/src/components/teacherSection/Reviews/AddReview.tsx b/client/src/components/teacherSection/Reviews/AddReview.tsx index 3e64d230..066f1d7b 100644 --- a/client/src/components/teacherSection/Reviews/AddReview.tsx +++ b/client/src/components/teacherSection/Reviews/AddReview.tsx @@ -7,6 +7,7 @@ import { Appointment } from "../../../types/appointments.types"; import { Loader } from "../../loader/Loader"; import { useNotificationStore } from "../../../store/notification.store"; import { ReviewType } from "../../../api/review/review.type"; +import { SelectComponent } from "../../ui/select/select"; interface AddReviewFormProps { teacherId: string; @@ -29,6 +30,15 @@ export const AddReview = ({ const { data, isLoading } = useStudentAppointmentsQuery(studentId); const { mutate, isPending } = useCreateReviewMutation(teacherId); + // If not logged in, don't show the review form + if (!isLoggedIn) return null; + if (isLoading) + return ( +
+ +
+ ); + // Get the set of bookingIds that already have reviews const reviewedBookingIds = new Set( accumulatedReviews.map((r) => r.bookingId), @@ -43,14 +53,22 @@ export const AddReview = ({ !reviewedBookingIds.has(app.id), ) || []; - // If not logged in, don't show the review form - if (!isLoggedIn) return null; - if (isLoading) - return ( -
- -
- ); + if (approvedLessons.length === 0) { + return null; + } + + // Options list for the select dropdown + const lessonOptions = approvedLessons.map((app: Appointment) => ({ + value: app.id, + label: `${app.lesson} ---- ${new Date(app.date).toLocaleDateString( + "en-GB", + { + day: "numeric", + month: "short", + year: "numeric", + }, + )}`, + })); // Find the selected booking details for use in the review const selectBooking = approvedLessons?.find( @@ -101,35 +119,13 @@ export const AddReview = ({ > Select a lesson - + onChange={(value) => setSelectedBookingId(value)} + placeholder="Choose a lesson to review" + /> {/* Rating Stars */} diff --git a/client/src/components/teacherSection/Reviews/ReviewCardTeacher.tsx b/client/src/components/teacherSection/Reviews/ReviewCardTeacher.tsx index 72485daa..a6cf7adb 100644 --- a/client/src/components/teacherSection/Reviews/ReviewCardTeacher.tsx +++ b/client/src/components/teacherSection/Reviews/ReviewCardTeacher.tsx @@ -56,7 +56,7 @@ export const ReviewCardTeacher = ({ {review && ( -

+

{review}

)} diff --git a/client/src/components/teacherSection/Reviews/ReviewsManager.tsx b/client/src/components/teacherSection/Reviews/ReviewsManager.tsx index 428a3e54..1530e07c 100644 --- a/client/src/components/teacherSection/Reviews/ReviewsManager.tsx +++ b/client/src/components/teacherSection/Reviews/ReviewsManager.tsx @@ -41,6 +41,17 @@ export const ReviewsManager = () => { return ( <> +
+

+ What our clients say +

+

+ Students appreciate the practical approach, supportive instructors, + and clear learning structure across all courses. Many international + students highlight fast progress, increased confidence, and a + comfortable learning environment. +

+
-
-

- What our clients say -

-

- Students appreciate the practical approach, supportive instructors, - and clear learning structure across all courses. Many international - students highlight fast progress, increased confidence, and a - comfortable learning environment. -

-
- -
+
{reviews.map((review) => (