Skip to content

ArcaeaRatingClassSelector Refactor - #62

Merged
283375 merged 3 commits into
masterfrom
refactor/rating-class-selector
Sep 3, 2026
Merged

ArcaeaRatingClassSelector Refactor#62
283375 merged 3 commits into
masterfrom
refactor/rating-class-selector

Conversation

@283375

@283375 283375 commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

@283375 283375 changed the title refactor/rating-class-selector ArcaeaRatingClassSelector Refactor Aug 30, 2026
@283375

283375 commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

/opencode review this pr

@opencode-agent

opencode-agent Bot commented Sep 2, 2026

Copy link
Copy Markdown

Reviewed the full diff (both commits), the two call sites, and compiled :app:compileStableDebugKotlin successfully.

Summary

Refactors ArcaeaRatingClassSelector to take a single items: List<RatingClassSelectorItem> instead of separate enabledRatingClasses + ratingDetails, adds a shared List<Chart>.toRatingClassSelectorItems() mapping, and introduces ArcaeaRatingClassDisplay (+ an INSCRIBED color alias) as groundwork for #61. Color math moves from HSL (androidx.core.graphics.ColorUtils) to HCT (materialkolor).

What's good

  • Much cleaner public API; both callers (ArcaeaChartSelector, UtilitiesCalculatorScreen) dedupe the same derivation logic into one mapper.
  • RatingClassSelectorItem is @Immutable, the box colors are now computed once in init instead of on every property access, and colors are cached via remember(baseColor).
  • modifier is now properly forwarded into the layout.

Issues / concerns

  1. INSCRIBED silently collapses with BEYONDArcaeaRatingClassSelector.kt:314 matches items to slots by it.display.ratingClass == slotRatingClass. Since INSCRIBED reuses BEYOND as its rating class, an Inscribed item renders in the Beyond slot; if a real Beyond and an Inscribed item were ever both present, find keeps only the first and the other disappears with no warning. Worth a uniqueness guarantee/assert or an explicit KDoc, since INSCRIBED (ratingClassAlias) data layer and app-wide display follow-ups #61 will make this reachable.
  2. ArcaeaRatingClassDisplay.of() silently masks bad input (ArcaeaRatingClassDisplay.kt:19-21) — an unknown alias/ratingClass combination falls back to the alias == null entry instead of failing. Given alias is a magic Int?, a fail-fast (error/require on non-null alias with no match) would catch future schema bugs sooner.
  3. INSCRIBED path is currently dead in productiontoRatingClassSelectorItems() (ArcaeaRatingClassSelector.kt:61) calls of(it.ratingClass) with the default alias = null, so no real Chart can ever resolve to INSCRIBED. This is acknowledged as groundwork, but the preview is the only place it's exercised.
  4. Preview bug / confusing math: val itemsAll = itemsWithBeyond + itemsWithEternal.last() (ArcaeaRatingClassSelector.kt:361) is cryptic and actually just equals "beyond + eternal" (no Inscribed). Since INSCRIBED aliases to the Beyond slot you can't show all six together anyway — consider documenting that or simplifying to itemsCommon + beyondItem + eternalItem.
  5. Naming: top-level SelectorSlotRatingClasses / SelectorOptionalSlotRatingClasses (ArcaeaRatingClassSelector.kt:290,302) are PascalCase non-const vals; convention would be camelCase. Minor.
  6. Minor: the animateFloatAsState blur label is duplicated as "selectedTextShadowOffset" (ArcaeaRatingClassSelector.kt:199) — pre-existing typo, could fix while here.

Note (no change required)

Material kolor 5.0.1 resolves (verified against Maven Central), and the new com.materialkolor.hct.Hct usage compiles for the stable variant.

Verdict: solid refactor, behavior preserved. Only ask the author to address #1/#2 (future-proofing correctness) before merge; the rest are polish.

New%20session%20-%202026-09-02T22%3A42%3A07.614Z
opencode session  |  github run

@283375
283375 marked this pull request as ready for review September 3, 2026 00:26
@283375
283375 merged commit 69e31cd into master Sep 3, 2026
3 of 4 checks passed
@283375
283375 deleted the refactor/rating-class-selector branch September 3, 2026 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant