diff --git a/apps/nova/src/components/TutorProfile/Ratings.tsx b/apps/nova/src/components/TutorProfile/Ratings.tsx index 61f222180..80fb53d98 100644 --- a/apps/nova/src/components/TutorProfile/Ratings.tsx +++ b/apps/nova/src/components/TutorProfile/Ratings.tsx @@ -1,7 +1,7 @@ import { useFindTutorRatings } from "@litespace/headless/rating"; import React, { useCallback } from "react"; import { LoadingTutorInfo } from "@/components/TutorProfile/LoadingTutorInfo"; -import { ratingOrganizer } from "@/lib/ratings"; +import { organizeRatings } from "@/lib/ratings"; import { useUser } from "@litespace/headless/context/user"; import { TutorRatingCard, @@ -20,12 +20,12 @@ const NoTutorRatings: React.FC<{ tutorName: string | null }> = ({ }) => { const intl = useFormatMessage(); return ( -
+
{intl("tutor.profile.first-rating", { tutor: tutorName })} @@ -51,7 +51,7 @@ const Ratings: React.FC<{ id: number; tutorName: string | null }> = ({ if (ratingsQuery.error || !user) return ; - const ratings = ratingOrganizer(ratingsQuery.data.list, user.id); + const ratings = organizeRatings(ratingsQuery.data.list, user.id); return (
@@ -85,13 +85,22 @@ const Ratings: React.FC<{ id: number; tutorName: string | null }> = ({ })}
- - {intl("tutor.profile.your-ratings-help")} - +
+ + {intl("tutor.profile.your-ratings-help")} + + + {intl("tutor.profile.we-care-about-ratings")} + +
+ ) : null} + + + ))} + + +
+ + {tab === "profile" ? ( + + + + ) : null} + {tab === "ratings" ? ( + +
+ +
+
+ ) : null} +
+
+ ); }; diff --git a/apps/nova/src/lib/ratings.ts b/apps/nova/src/lib/ratings.ts index d4bce2d3d..eb3e9f44f 100644 --- a/apps/nova/src/lib/ratings.ts +++ b/apps/nova/src/lib/ratings.ts @@ -1,21 +1,14 @@ import { IRating } from "@litespace/types"; +import { TutorRatingCardGroupProps } from "@litespace/luna/TutorFeedback"; -export const ratingOrganizer = ( +export const organizeRatings = ( ratings: IRating.FindTutorRatingsApiResponse["list"], currentUserId: number ) => { let currentUserRating: IRating.RateeRatings | undefined; const ratingsWithFeedback: IRating.RateeRatings[] = []; - const ratingsWithoutFeedback: { - ratings: Array<{ - name: string | null; - - userId: number; - - imageUrl: string | null; - }>; - value: number; - }[] = []; + const ratingsWithoutFeedback: Omit[] = + []; ratings.forEach((rating) => { if (rating.userId === currentUserId) { diff --git a/packages/luna/src/components/TutorFeedback/index.ts b/packages/luna/src/components/TutorFeedback/index.ts index 8636a27f9..fe8dd10f2 100644 --- a/packages/luna/src/components/TutorFeedback/index.ts +++ b/packages/luna/src/components/TutorFeedback/index.ts @@ -2,3 +2,4 @@ export { TutorRatingCard } from "@/components/TutorFeedback/TutorRatingCard"; export { EditRating } from "@/components/TutorFeedback/EditRating"; export { DeleteRating } from "@/components/TutorFeedback/DeleteRating"; export { TutorRatingCardGroup } from "@/components/TutorFeedback/TutorRatingCardGroup"; +export { type TutorRatingCardGroupProps } from "@/components/TutorFeedback/types"; diff --git a/packages/luna/src/locales/ar-eg.json b/packages/luna/src/locales/ar-eg.json index 0fd31e248..aa4836173 100644 --- a/packages/luna/src/locales/ar-eg.json +++ b/packages/luna/src/locales/ar-eg.json @@ -77,7 +77,8 @@ "tutor.profile.tabs.reviews": "الأراء", "tutor.profile.loading": "برجاء الانتظار... نحضر لك معلومات المعلم!", "tutor.profile.rate-tutor": "قيم المعلم", - "tutor.profile.your-ratings-help": "آراؤك تساهم في تحسين طريقة تدريس معلمينا، ونحن نحرص على استخدامها لتقديم تجربة تعليمية أفضل", + "tutor.profile.your-ratings-help": "آراؤك تساهم في تحسين طريقة تدريس معلمينا،", + "tutor.profile.we-care-about-ratings": " ونحن نحرص على استخدامها لتقديم تجربة تعليمية أفضل", "tutor.profile.first-rating": " كن من أوائل الطلاب الذين يكتشفون إمكانيات {tutor} المتميز! اغتنم الفرصة الآن قبل أن يصبح جدوله ممتلئًا!", "tutor.profile.error": " عذرًا، حدث خطأ أثناء تحميل المحتوى. برجاء المحاولة مرة أخرى", "tutor.profile.retry": "حاول مرة أخرى", @@ -679,4 +680,4 @@ "error.password.short": "رقم سري قصير", "error.password.long": "رقم سري طويل", "error.password.invalid": "يجب أن يحتوي علي أرقام، حروف ، رموز" -} \ No newline at end of file +}