From 32b50c40aa98e597ef7196715258ff570cd2f8a2 Mon Sep 17 00:00:00 2001 From: Cho Young-Hwi Date: Mon, 16 Mar 2026 12:38:27 +0000 Subject: [PATCH 1/2] [#156] Replace text asterisks with SVG star icons in rating UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - New StarRating.tsx with StarDisplay (fractional fill via clip-path) and StarInput (hover + click interactive stars) - RatingWidget: star icons for input (24px), average (18px), and recent ratings (12px) — replaces number buttons and text asterisks - RatingSummary: star icons (14px) with fractional fill support Fixes #156 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/components/RatingSummary.tsx | 16 ++--- src/components/RatingWidget.tsx | 42 +++--------- src/components/StarRating.tsx | 107 +++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+), 43 deletions(-) create mode 100644 src/components/StarRating.tsx 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) => ( - - ))} +
+