diff --git a/src/components/RatingSummary.tsx b/src/components/RatingSummary.tsx index 4bfdf35e..f5e451ee 100644 --- a/src/components/RatingSummary.tsx +++ b/src/components/RatingSummary.tsx @@ -1,6 +1,7 @@ "use client"; import { useQuery } from "@tanstack/react-query"; +import { StarDisplay } from "./StarRating"; interface RatingsResponse { average: number; @@ -20,16 +21,11 @@ export function RatingSummary({ storylineId }: { storylineId: number }) { if (!data || data.count === 0) return null; return ( - - {[1, 2, 3, 4, 5].map((star) => ( - - * - - ))}{" "} - {data.average.toFixed(1)} ({data.count}) + + + + {data.average.toFixed(1)} ({data.count}) + ); } diff --git a/src/components/RatingWidget.tsx b/src/components/RatingWidget.tsx index 4d1e3f48..af3da679 100644 --- a/src/components/RatingWidget.tsx +++ b/src/components/RatingWidget.tsx @@ -7,6 +7,7 @@ import { publicClient } from "../../lib/rpc"; import { erc20Abi } from "../../lib/price"; import type { Address } from "viem"; import { truncateAddress } from "../../lib/utils"; +import { StarDisplay, StarInput } from "./StarRating"; interface RatingData { id: number; @@ -30,22 +31,6 @@ interface RatingWidgetProps { tokenAddress: string; } -function StarDisplay({ rating, size = "sm" }: { rating: number; size?: "sm" | "lg" }) { - const sizeClass = size === "lg" ? "text-base" : "text-xs"; - return ( - - {[1, 2, 3, 4, 5].map((star) => ( - - * - - ))} - - ); -} - export function RatingWidget({ storylineId, tokenAddress }: RatingWidgetProps) { const { address, isConnected } = useAccount(); const { signMessageAsync } = useSignMessage(); @@ -149,7 +134,7 @@ export function RatingWidget({ storylineId, tokenAddress }: RatingWidgetProps) {

Ratings

{count > 0 && (
- + {average.toFixed(1)} ({count}) @@ -163,21 +148,12 @@ export function RatingWidget({ storylineId, tokenAddress }: RatingWidgetProps) { -
- {[1, 2, 3, 4, 5].map((star) => ( - - ))} +
+