From 797b0e854d4199603008ebabc7a32183b8bd9c0d Mon Sep 17 00:00:00 2001 From: waterWang Date: Sun, 2 Aug 2026 04:56:06 +0800 Subject: [PATCH] feat: add Reputation Score Dashboard with filterable review history (Closes #27) - Create reputation route at /reputation - Add ReputationScoreCard component with star rating, distribution and category breakdown - Add ReviewHistory component with category filtering and pagination - Add reputation types and mock data in lib/reputation.ts - Responsive two-column layout (score card + review list) - Use react-icons/hi (Heroicons) matching existing project conventions - All typechecks and lint pass --- src/app/reputation/page.tsx | 30 +++++ src/components/ReputationScoreCard.tsx | 111 ++++++++++++++++ src/components/ReviewHistory.tsx | 125 +++++++++++++++++ src/lib/reputation.ts | 177 +++++++++++++++++++++++++ 4 files changed, 443 insertions(+) create mode 100644 src/app/reputation/page.tsx create mode 100644 src/components/ReputationScoreCard.tsx create mode 100644 src/components/ReviewHistory.tsx create mode 100644 src/lib/reputation.ts diff --git a/src/app/reputation/page.tsx b/src/app/reputation/page.tsx new file mode 100644 index 0000000..7518a9b --- /dev/null +++ b/src/app/reputation/page.tsx @@ -0,0 +1,30 @@ +import { getMockReputationScore } from "@/lib/reputation"; +import ReputationScoreCard from "@/components/ReputationScoreCard"; +import ReviewHistory from "@/components/ReviewHistory"; + +export default function ReputationPage() { + const score = getMockReputationScore(); + + return ( +
+ {/* Page Header */} +
+

Reputation Dashboard

+

+ View your aggregate reputation score and browse through provider reviews. +

+
+ + {/* Layout: Score Card + Review History */} +
+ +
+

Review History

+ +
+
+
+ ); +} \ No newline at end of file diff --git a/src/components/ReputationScoreCard.tsx b/src/components/ReputationScoreCard.tsx new file mode 100644 index 0000000..69e1e4c --- /dev/null +++ b/src/components/ReputationScoreCard.tsx @@ -0,0 +1,111 @@ +"use client"; + +import { HiStar } from "react-icons/hi"; +import Card from "@/components/ui/Card"; +import type { ReputationScore } from "@/lib/reputation"; + +interface ReputationScoreCardProps { + score: ReputationScore; +} + +function StarRating({ value, max = 5 }: { value: number; max?: number }) { + const full = Math.floor(value); + const hasHalf = value - full >= 0.25; + const stars = []; + + for (let i = 1; i <= max; i++) { + if (i <= full) { + stars.push( +