Skip to content

Show manga totals in Settings, and give the card its own colours (#12) - #153

Merged
zhollis21 merged 4 commits into
mainfrom
feature/12-manga-statistics
Aug 31, 2026
Merged

zhollis21 merged 4 commits into
mainfrom
feature/12-manga-statistics

Conversation

@zhollis21

Copy link
Copy Markdown
Owner

Advances #12. Settings was the last screen where manga was still second-class after #151 gave it a Library tab: the viewer query asked for statistics { anime } only, so a manga reader opened their profile to four anime numbers and nothing about the list they actually keep.

The change

statistics { manga { count meanScore chaptersRead volumesRead } } in both viewer queries, and a Manga Stats card mirroring the anime 2×2: Total Manga, Chapters, Volumes, Mean Score.

Both queries, because both map through the same MapUser. GetViewer and UpdateUser share it, so asking in only one place would have blanked the card every time a setting saved.

UserMangaStatistics is its own model. AniList returns a single UserStatistics type carrying every counter for either kind, so a shared model would put a meaningless EpisodesWatched on manga and a meaningless ChaptersRead on anime. Modelling only the fields that mean something keeps the card from being able to show a number that cannot be true. The DTO stays shared, because the wire shape genuinely is one type.

The card shows for an account with no manga rather than hiding, matching the anime card, which has always rendered zeros for a fresh account. Plenty of AniList accounts track anime only — the same fact that justified the Library's empty state — so this is the common case, not the edge one.

Both cards now sit under one STATISTICS banner, which avoids renumbering the five sections below them.

Colours: two rounds, and a regression caught on device

The card rendered correctly first time and looked wrong: all four manga figures came out the same blue, against a four-colour anime card. Manga, Chapters and Volumes each hashed to RainbowBlue, which is also where Score lands. Invisible to the build and to the tests — only looking at it caught it.

The first fix was worse than the bug. Pointing those keys at their anime counterparts did make the card colourful, but those keys are not Settings-only: 'Manga' and 'Anime' also drive Search's type pills and the two Library nav titles, and 'Chapters' / 'Volumes' drive the details-page chips. So a decision about a stat tile silently made the Manga pill and the Manga Library title render identically to the Anime ones. Found by checking the call sites before the second change, not by anything failing.

The tiles now use keys that exist only in Settings — StatsTotalManga, StatsChapters, StatsMangaHeader and so on — pinned in the lookup table rather than hashed. Nothing outside Settings can be recoloured by a stat-tile decision again, and the shared keys go back to the hash values they always had.

Anime Manga
Header Cyan Purple
1st tile Pink Red
2nd tile Green Orange
3rd tile Yellow Cyan
4th tile Blue Blue

The palette has eight stops and the two cards have ten slots, so exactly two colours recur — that is arithmetic, not an oversight, and which two is a decision: blue on each Mean Score, the same metric on both cards, and cyan on the anime header versus the manga Volumes tile, which never sit in the same role. The anime entries pin the colours that card already rendered, so it does not move.

_statusColors became _fixedColors, since it no longer holds only status sections.

Verification

dotnet test — 1477 passed. All builds clean, zero warnings.

The converter tests cover the whole contract rather than one example: five distinct colours within each card, exactly eight across both, headers that differ, and — guarding the regression above — that Anime/Manga and Episodes/Chapters still resolve apart from each other.

Two client tests: the full mapping, and an account with no manga branch at all, since AniList omits it rather than sending zeros and the card renders those numbers directly.

On the emulator:

  • Both cards render, and every manga figure differs from the anime one (3 / 373 / 42 / 9.0 against 10 / 1,038 / 17.3 / 8.8) — the CI stub uses deliberately unrelated figures so a card wired to the anime numbers would be visible rather than plausible.
  • Purple header over red / orange / cyan / blue, as above.
  • Search shows a pink Anime pill beside a blue Manga pill again, confirming the shared keys are back to normal.
  • Clean device log.

Settings is already in the CI screenshot set, so the new card gets visual coverage from the next run onward.

Commits

Three, and the middle one is the version that regressed the shared keys — kept rather than rewritten so the reasoning is legible. The repo squash-merges, so main gets one commit either way.

Still open on #12

Discover manga rows, which needs design rather than wiring: Currently Airing and Upcoming Next Season have no manga analogue, so it cannot be a parameterized copy of DiscoverSectionDefinitions the way the Library was.

The two Settings items that were on the checklist are resolved: manga display preferences turned out to have nothing that differs from anime, and the section-ordering control is not manga-specific at all — anime has none either — so it moved to #152.

Zach Hollis added 3 commits August 30, 2026 23:15
The viewer query asked for statistics { anime } only, so a manga reader
got a profile card of four anime numbers and nothing about the list they
actually keep — the last screen where manga was still second-class after
#151 gave it a Library tab.

Fetch statistics { manga { count meanScore chaptersRead volumesRead } }
in both viewer queries and render a Manga Stats card mirroring the anime
2x2: Total Manga, Chapters, Volumes, Mean Score.

UserMangaStatistics is its own model rather than a shared one. AniList
returns a single UserStatistics type carrying every counter for either
kind, so sharing it would put a meaningless EpisodesWatched on manga and
a meaningless ChaptersRead on anime; modelling only the fields that mean
something keeps the card from being able to show a number that cannot be
true. The DTO stays shared, because the wire shape genuinely is.

The card shows for an account with no manga rather than hiding, matching
the anime card, which has always rendered zeros for a fresh account.

Both stat sets now sit under one STATISTICS banner, which avoids
renumbering the five sections below them.
Caught on device, not by the build or the tests: the Manga Stats card
rendered all four figures in the same blue, next to a four-colour anime
card. Manga, Chapters and Volumes each hashed to RainbowBlue, which is
also where Score lands.

Map the three through the converter's existing _keyMappings, which is
there for exactly this — "ensuring related concepts get the same color".
Each manga tile now points at the anime tile in the same grid position,
so the two cards read as one shape shown twice rather than two unrelated
panels.

Tested via ResourceKeyFor, asserting both the pairing and that the four
manga keys are distinct from each other — the property that broke, and
the one a future palette or hash change could quietly break again.
Two problems with the previous commit, both found on device.

It reached for the shared keys. Mapping "Manga" to "Anime" did not just
recolour a stat tile: those keys also drive Search's type pills, the two
Library nav titles and the details-page chips, so the Manga pill and the
Manga Library title started rendering identically to the Anime ones. A
decision about a stat tile silently changed four other screens.

And matching the anime card was the wrong goal anyway. The two cards sit
one above the other and should read as two things.

The tiles now use keys that exist only in Settings — StatsTotalManga,
StatsChapters and so on — pinned in the lookup table rather than hashed.
Nothing outside Settings can be recoloured by a stat-tile decision again,
and the shared keys go back to the hash values they always had.

The palette has eight stops and the two cards have ten slots, so exactly
two colours recur, both chosen rather than incidental: blue on each Mean
Score, which is the same metric on both cards, and cyan on the anime
header and the manga Volumes tile, which never sit in the same role. The
anime entries pin the colours that card already rendered, so it does not
move.

Renamed _statusColors to _fixedColors, since it no longer holds only
status sections.

Tests cover the whole contract: five distinct colours within each card,
exactly eight across both, headers that differ, and — guarding the
regression above — that Anime/Manga and Episodes/Chapters still resolve
apart from each other.
Copilot AI lite review requested due to automatic review settings August 31, 2026 03:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The mapping/UI changes are consistent end-to-end (API → model → page model → XAML), and the added unit tests cover both the new manga stats contract and the prior color-key regression risk.

Pull request overview

This PR completes the “manga stats in Settings” gap in the #12 manga-support epic by fetching AniList manga statistics alongside anime statistics and rendering a dedicated “Manga Stats” card with its own fixed accent-color keys to avoid cross-screen recolor regressions.

Changes:

  • Extend ViewerFull and UpdateUser GraphQL selections to include statistics { manga { count meanScore chaptersRead volumesRead } }, and map into a new UserMangaStatistics model.
  • Add manga totals to SettingsPageModel and render a second statistics card in Settings (mirroring the existing anime 2×2 grid).
  • Pin Settings-only stat-tile color keys in RainbowAccentConverter and add tests covering the “two cards stay visually distinct” and “shared keys unchanged” contracts.
File summaries
File Description
tests/AniSprinkles.UnitTests/SettingsPageModelTests.cs Asserts Settings loads and displays manga totals distinctly from anime totals.
tests/AniSprinkles.UnitTests/ConverterTests.cs Verifies fixed color keying keeps the two stat cards distinct and avoids shared-key regressions.
tests/AniSprinkles.UnitTests/AniListClientOperationsTests.cs Validates viewer deserialization/mapping for manga stats and the “missing manga branch” case.
src/AniSprinkles/Views/SettingsLoadedContentView.xaml Adds the “Manga Stats” card and switches anime stat colors to Settings-only stat keys.
src/AniSprinkles/Services/CI/CIAniListClient.cs Seeds CI stub viewer with non-anime-derived manga stats for screenshot verification.
src/AniSprinkles.Core/Services/AniListClient.cs Adds manga statistics DTO fields, maps them into the user model, and updates ViewerFull/UpdateUser selections.
src/AniSprinkles.Core/PageModels/SettingsPageModel.cs Introduces manga stat observable properties and populates/clears them with the rest of profile data.
src/AniSprinkles.Core/Models/UserMangaStatistics.cs New model representing manga-only statistics fields.
src/AniSprinkles.Core/Models/AniListUser.cs Adds MangaStatistics to the core user model.
src/AniSprinkles.Core/Converters/RainbowAccentConverter.cs Renames status-color table to _fixedColors and pins Settings stat-card keys to fixed palette entries.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

Copy link
Copy Markdown
Contributor

📱 UI Screenshots

✅ Authenticated UI — screenshots rendered via compile-time CI stub services with hardcoded data. No OAuth token required.

View Workflow Run →

Anime Library Manga Library Discover View All (Browse) Search One Piece Details Toei Animation (Studio) Luffy (Character) Mayumi Tanaka (Staff) Settings
Anime Library Manga Library Discover View All (Browse) Search One Piece Details Toei Animation (Studio) Luffy (Character) Mayumi Tanaka (Staff) Settings

@zhollis21
zhollis21 merged commit ee86a35 into main Aug 31, 2026
3 checks passed
@zhollis21
zhollis21 deleted the feature/12-manga-statistics branch August 31, 2026 13:03
zhollis21 added a commit that referenced this pull request Nov 19, 2026
#153)

* Show manga totals in Settings alongside the anime ones

The viewer query asked for statistics { anime } only, so a manga reader
got a profile card of four anime numbers and nothing about the list they
actually keep — the last screen where manga was still second-class after
#151 gave it a Library tab.

Fetch statistics { manga { count meanScore chaptersRead volumesRead } }
in both viewer queries and render a Manga Stats card mirroring the anime
2x2: Total Manga, Chapters, Volumes, Mean Score.

UserMangaStatistics is its own model rather than a shared one. AniList
returns a single UserStatistics type carrying every counter for either
kind, so sharing it would put a meaningless EpisodesWatched on manga and
a meaningless ChaptersRead on anime; modelling only the fields that mean
something keeps the card from being able to show a number that cannot be
true. The DTO stays shared, because the wire shape genuinely is.

The card shows for an account with no manga rather than hiding, matching
the anime card, which has always rendered zeros for a fresh account.

Both stat sets now sit under one STATISTICS banner, which avoids
renumbering the five sections below them.

* Give each manga stat tile the colour of its anime counterpart

Caught on device, not by the build or the tests: the Manga Stats card
rendered all four figures in the same blue, next to a four-colour anime
card. Manga, Chapters and Volumes each hashed to RainbowBlue, which is
also where Score lands.

Map the three through the converter's existing _keyMappings, which is
there for exactly this — "ensuring related concepts get the same color".
Each manga tile now points at the anime tile in the same grid position,
so the two cards read as one shape shown twice rather than two unrelated
panels.

Tested via ResourceKeyFor, asserting both the pairing and that the four
manga keys are distinct from each other — the property that broke, and
the one a future palette or hash change could quietly break again.

* Give the Manga Stats card its own colours, on Settings-only keys

Two problems with the previous commit, both found on device.

It reached for the shared keys. Mapping "Manga" to "Anime" did not just
recolour a stat tile: those keys also drive Search's type pills, the two
Library nav titles and the details-page chips, so the Manga pill and the
Manga Library title started rendering identically to the Anime ones. A
decision about a stat tile silently changed four other screens.

And matching the anime card was the wrong goal anyway. The two cards sit
one above the other and should read as two things.

The tiles now use keys that exist only in Settings — StatsTotalManga,
StatsChapters and so on — pinned in the lookup table rather than hashed.
Nothing outside Settings can be recoloured by a stat-tile decision again,
and the shared keys go back to the hash values they always had.

The palette has eight stops and the two cards have ten slots, so exactly
two colours recur, both chosen rather than incidental: blue on each Mean
Score, which is the same metric on both cards, and cyan on the anime
header and the manga Volumes tile, which never sit in the same role. The
anime entries pin the colours that card already rendered, so it does not
move.

Renamed _statusColors to _fixedColors, since it no longer holds only
status sections.

Tests cover the whole contract: five distinct colours within each card,
exactly eight across both, headers that differ, and — guarding the
regression above — that Anime/Manga and Episodes/Chapters still resolve
apart from each other.

* CI: Update UI screenshots [skip ci]

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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.

2 participants