diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 57503f8..9474911 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -214,7 +214,7 @@ const App: React.FC = () => { setDrawerOpen(false)}> - + @@ -244,7 +244,7 @@ const App: React.FC = () => { <> setDrawerOpen(false)}> - + diff --git a/frontend/src/pages/flavors/FlavorDetail.tsx b/frontend/src/pages/flavors/FlavorDetail.tsx index 133997c..14421e2 100644 --- a/frontend/src/pages/flavors/FlavorDetail.tsx +++ b/frontend/src/pages/flavors/FlavorDetail.tsx @@ -148,11 +148,11 @@ const FlavorDetail: React.FC = () => { return ( - - + {flavor.image_url && ( { /> )} - + {!flavor.is_available && ( {flavor.is_legacy ? "Unavailable (Legacy Flavor)" : "Out of Stock"} )} - {flavor.name} - {flavor.category_name} + + {flavor.name} + + + {flavor.category_name} + - + - {(flavor.average_rating || 0).toFixed(1)} / 10 + + {(flavor.average_rating || 0).toFixed(1)} / 10 + - {flavor.description} + + {flavor.description} + {flavor.shop_url && ( - )} @@ -205,11 +213,11 @@ const FlavorDetail: React.FC = () => { {/* New Rating Form */} {currentUser && flavor.user_rating === null && ( - - Rate this flavor + + Rate this flavor
- - Score (1-10) + + Score (1-10) setNewScore(val)} size="large" /> { label="Your Comment (Optional)" value={newComment} onChange={(e) => setNewComment(e.target.value)} - sx={{ mb: 2 }} + sx={{ mb: 3 }} /> - +
)} - Community Reviews + + Community Reviews + {flavor.ratings.length === 0 ? ( - No reviews yet. + No reviews yet. Be the first to rate it! ) : ( flavor.ratings.map((rating: Rating) => ( - - + + {editMode === rating.id ? ( - setEditScore(val || 0)} /> - setEditComment(e.target.value)} /> + setEditScore(val || 0)} size="large" /> + setEditComment(e.target.value)} /> @@ -245,40 +257,57 @@ const FlavorDetail: React.FC = () => { ) : ( <> - - + + {!rating.user_avatar && rating.user.charAt(0).toUpperCase()} - {rating.user} - - - {rating.score}/10 + + + {rating.user} + + + {rating.score}/10 + + + + {new Date(rating.created_at).toLocaleDateString()} + + - {rating.comment && {rating.comment}} - - {new Date(rating.created_at).toLocaleDateString()} + {rating.comment && ( + + {rating.comment} + + )} + {currentUser === rating.user && ( - + <> - + )} )} - + {rating.replies.map((reply: any) => ( {reply.user} - {reply.text} + {reply.text} {new Date(reply.created_at).toLocaleDateString()} ))} {currentUser && ( - setReplyInputs({ ...replyInputs, [rating.id]: e.target.value })} /> - + setReplyInputs({ ...replyInputs, [rating.id]: e.target.value })} + /> + )}