Add half-star and 0-star community ratings (THE-122)

- HTML: Star rating uses .star-pos/.star-click split zones for half-star
  precision (data-value 0.5 increments); .star-zero-btn for clearing/
  setting 0-star rating
- CSS: .star-icon.half-filled uses CSS gradient clip for split-color;
  .star-click overlays are position:absolute invisible hit areas;
  .star-zero-btn styled as small circle badge
- JS: _applyStarFill handles full/half/user-rated states; _castRating
  and _renderVoteUI updated to use .star-pos/.star-click/.star-zero-btn
  selectors and parseFloat for 0.5-step values
- Worker: rating validation updated to allow 0-5 in 0.5 increments;
  sum stored with parseFloat to preserve decimal accuracy

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
s0lray
2026-03-26 23:57:48 -04:00
co-authored by Paperclip
parent b50c831d1e
commit c822ae1e3c
+1 -1
View File
@@ -134,7 +134,7 @@ async function handleTrack(request, env) {
/**
* POST /api/vote
* Body: { tool_id: string, rating: 1|2|3|4|5|null, session_hash: string }
* Body: { tool_id: string, rating: 0|0.5|1|...|5|null, session_hash: string }
* rating=null removes the current rating (toggle off)
*
* Returns: { ok: true, average: number, count: number, userRating: number|null }