Skip to content

feat(web): add RTINGS-style use-case presets and custom weight sliders #1864

Description

@JOY

Goal

Implement Package 8A Feature F2 (approved by JOY on 2026-11-22 from Docs/Proposals/2026-11-22-de-xuat-tinh-nang-moi-phase-8.html): add RTINGS-inspired 1-click Use-Case Presets and custom 0% - 100% criterion weight sliders across /leaderboard, /compare, and /compare/[versus] using our existing per-category RATING_CRITERIA and criteria_scores with zero database migrations.

Requirements

  1. Category Use-Case Presets & Normalized Custom Weight Math (packages/shared-data/src/rules/rating-criteria.ts + apps/web/src/lib/use-case-weights.ts):
    • Define curated, category-specific 1-click presets for all 5 categories (smartphones, tablets, laptops, smartwatches, earbuds), e.g. Balanced Default, Gaming & Battery, Camera & Creator, Office & Portability, ANC & Commute, Value-First, etc.
    • Support custom 0..100 integer slider weights per criterion that normalize cleanly to 100% (gracefully handling all-zero reset to Balanced Default and missing/unrated criteria without inventing scores).
    • Design rule #1531 D3/D9: Always keep the official Rate.vn Score visible alongside Your Custom Score (labeled clearly when custom weights or a non-default preset are active) so users never confuse official and personalized scores.
  2. Interactive UI & Shareable Query State (UseCaseWeightBar.tsx, LeaderboardExplorer.tsx, CompareWorkspace.tsx, VersusInteractiveScoreboard.tsx):
    • Render an accessible (aria-pressed, keyboard-friendly <input type="range"> with visible percentage labels and reset button) preset + weight customization bar on /leaderboard, /compare, and /compare/[versus].
    • Re-rank / recompute custom winner & deltas instantaneously on client state and encode non-default presets/weights cleanly in URL query params (?preset=... or ?weights=...) while keeping rel="canonical" pointing to the base route so SEO indexation stays clean.
  3. Localization (vi, en, cs):
    • Localize all preset names, slider labels, and custom-score explanations in apps/web/locales/{vi,en,cs}.json strictly under namespaces "compare" and "leaderboard".

Approach

Add category preset metadata in rating-criteria.ts + pure weight/URL serialization helpers in apps/web/src/lib/use-case-weights.ts, create UseCaseWeightBar.tsx, integrate into LeaderboardExplorer.tsx, CompareWorkspace.tsx, and VersusInteractiveScoreboard.tsx, and add unit tests in apps/web/src/lib/__tests__/leaderboard-criteria.test.ts and compare-params.test.ts.

Acceptance

  • Selecting a preset or dragging criterion sliders updates custom scores and winner ordering immediately on /leaderboard, /compare, and /compare/[versus].
  • Official Rate.vn Score remains clearly visible and unchanged; missing criterion scores are never fabricated.
  • Shareable query params (?preset=... / ?weights=...) restore state on reload without altering rel="canonical", and reject malformed/prototype query keys safely.
  • Full vi, en, cs i18n parity, WCAG 2.1 AA contrast & keyboard accessibility, and green monorepo CI + Playwright E2E.

Files

  • packages/shared-data/src/rules/rating-criteria.ts
  • apps/web/src/lib/use-case-weights.ts
  • apps/web/src/components/compare/UseCaseWeightBar.tsx
  • apps/web/src/components/leaderboard/LeaderboardExplorer.tsx
  • apps/web/src/components/compare/CompareWorkspace.tsx
  • apps/web/src/components/compare/VersusInteractiveScoreboard.tsx
  • apps/web/locales/{vi,en,cs}.json ("compare" and "leaderboard" namespaces only)
  • apps/web/src/lib/__tests__/leaderboard-criteria.test.ts
  • apps/web/src/lib/__tests__/compare-params.test.ts

Activity

  1. added
    area:sharedShared packages / contracts / configs
    featureNew feature or enhancement
    status:readyTask ready to be picked up by an Agent
    po:antigravityDispatched by the Antigravity Product Owner
    on Nov 22, 2026
  2. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🔒 [Agent: Web] Claim lock refs/claims/1864 taken by claimant antigravity:98e4f4c6-a524-4fe3-9d35-6247893a8d4e (Status: in-progress).

  3. added
    status:in-progressTask currently claimed and being worked on by an Agent
    agent:webClaimed by Agent: Web
    and removed
    status:readyTask ready to be picked up by an Agent
    on Nov 22, 2026
  4. self-assigned this
    on Nov 22, 2026
  5. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    [Agent: Web] Claimed this issue (Status: Ready -> In Progress) on branch feat/1864-rtings-use-case-weights (Claimant: antigravity:98e4f4c6-a524-4fe3-9d35-6247893a8d4e).

  6. added
    status:in-reviewTask completed and waiting for review / PR merge
    and removed
    status:in-progressTask currently claimed and being worked on by an Agent
    on Nov 22, 2026
  7. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🤖 [Agent: Web] Opened PR #1867 (feat/1864-rtings-use-case-weights -> dev, commit efd14bb7) implementing RTINGS-style category use-case presets, normalized 0..100 slider weights, and ?preset= / ?weights= URL sync across /leaderboard, /compare, and /compare/[versus]. Running the 2-reviewer fresh-context gate and CI checks now.

  8. JOY commented on Nov 22, 2026

    @JOY
    ContributorAuthor

    🤖 [Agent: Web] Merged PR #1867 into dev (bb89681e44cf950347d940d79c338ff31e92da4d). Keeping status:in-review until Package 8A is promoted to main and verified live.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent:webClaimed by Agent: Webarea:sharedShared packages / contracts / configsarea:webfeatureNew feature or enhancementpo:antigravityDispatched by the Antigravity Product Ownerstatus:in-reviewTask completed and waiting for review / PR merge

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions