Skip to content

Related timeline screen - #30

Merged
swstl merged 2 commits into
mainfrom
related-timeline-screen
Jun 1, 2026
Merged

Related timeline screen#30
swstl merged 2 commits into
mainfrom
related-timeline-screen

Conversation

@swstl

@swstl swstl commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Related anime timeline screen—explore prequels, sequels, and connected series with watch-order visualization and branch navigation
    • Configuration option to display romaji titles instead of English titles
    • "Your Score" field in anime details
    • "Related series" button in anime popup to explore connections
  • Improvements

    • Enhanced title display logic respecting user language preferences
    • Better user rating and status display across anime boxes

Copilot AI review requested due to automatic review settings June 1, 2026 23:48
@swstl
swstl merged commit d5754c1 into main Jun 1, 2026
1 check was pending
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c52b7a0c-0f50-417f-ba92-1f0917a8c28c

📥 Commits

Reviewing files that changed from the base of the PR and between 87c298b and e4252cd.

📒 Files selected for processing (17)
  • .github/workflows/binaries.yaml
  • Cross.toml
  • build.rs
  • docs/superpowers/specs/2026-06-01-related-timeline-screen-design.md
  • src/app.rs
  • src/config/README.md
  • src/config/mod.rs
  • src/mal/mod.rs
  • src/mal/models/anime.rs
  • src/mal/network.rs
  • src/mal/oauth.rs
  • src/screens/mod.rs
  • src/screens/related.rs
  • src/screens/seasons.rs
  • src/screens/widgets/animebox.rs
  • src/screens/widgets/popup.rs
  • src/screens/widgets/sync.rs

📝 Walkthrough

Walkthrough

This PR introduces a Related Timeline screen for exploring anime prequels/sequels, adds build-time OAuth client ID injection via environment variables, implements title localization with a configurable prefer_romaji setting, and enhances the MAL API with single-anime fetching to support relation following.

Changes

Related Timeline Feature and Configuration

Layer / File(s) Summary
Build System & OAuth Client ID Injection
.github/workflows/binaries.yaml, Cross.toml, build.rs, src/mal/oauth.rs
Build-time environment variable injection replaces hard-coded OAuth client ID, with fallback .env file parsing for local development and containerized build configuration.
Title Localization (prefer_romaji setting)
src/config/README.md, src/config/mod.rs, src/mal/models/anime.rs
New prefer_romaji config option controls whether anime titles render in romaji or English; Anime::display_title() method implements title selection logic with fallback handling for missing/N/A values.
Anime Model Deserialization Improvements
src/mal/models/anime.rs
Flexible u64 deserializer accepts both JSON strings and numbers for statistics count fields, with per-field defaulting to handle incomplete MAL API responses.
MAL API Single-Anime Fetching
src/mal/mod.rs, src/mal/network.rs
New MalClient::get_anime_by_id() and fetch_single_anime() methods enable individual anime fetching by ID for relation-following, with field trimming to reduce payload.
Screen System Integration for Related Screen
src/screens/mod.rs, src/app.rs
Registers RelatedScreen in navbar and screen registry, adds build_related() trait hook for initialization, implements ScreenManager::show_related() navigation method, and dispatches new Action::ShowRelated from input handlers.
Related Screen Implementation: Timeline Building & UI
src/screens/related.rs
Complete screen with Search/Picking/Timeline modes, background worker for prequel/sequel traversal with CAP and cycle detection, incremental result streaming, searchable UI, horizontally-scrollable timeline strip, branch relation panel, keyboard/mouse navigation, and comprehensive unit tests.
UI Widget Updates and Feature Integration
src/screens/widgets/popup.rs, src/screens/widgets/animebox.rs, src/screens/widgets/sync.rs, src/screens/seasons.rs
Popup adds "Related series" button mapped to ShowRelated action, all title displays switched to display_title() method, and seasons screen shows user's score in details.
Design Specification Documentation
docs/superpowers/specs/2026-06-01-related-timeline-screen-design.md
Comprehensive spec covering screen purpose, user flow, architecture, timeline algorithm, data model, layout, input bindings, error handling, and testing plan.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 A timeline unfolds, prequels and sequels entwined,
Through relation chains, watch-orders are designed,
With romaji titles and OAuth at build time,
The Related screen springs—a feature sublime! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch related-timeline-screen

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new Related top-level screen that lets users search for an anime and view a prequel→sequel “watch-order” timeline with side relations shown as selectable branches. It also centralizes title display logic (English vs romaji) and introduces a single-anime fetch path needed to traverse MAL’s relation graph.

Changes:

  • Introduces RelatedScreen with background search + relation-chain building, and wires it into the navbar and popup flow (“Related series” button).
  • Adds Anime::display_title() plus a prefer_romaji config option and updates several widgets/screens to use it.
  • Adds a single-anime network fetch + MAL client method, and injects MAL_CLIENT_ID at build time via build.rs/CI.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/screens/widgets/sync.rs Uses Anime::display_title() for consistent title rendering in sync popup.
src/screens/widgets/popup.rs Adds “Related series” button and routes it to Action::ShowRelated; uses display_title().
src/screens/widgets/animebox.rs Uses display_title() and improves status display to include user score when present.
src/screens/seasons.rs Shows “Your Score” in the season detail list.
src/screens/related.rs New Related screen: search → pick → timeline UI + background timeline builder + unit tests.
src/screens/mod.rs Registers RELATED screen and adds Screen::build_related hook + ScreenManager::show_related.
src/mal/oauth.rs Switches OAuth client id to compile-time env injection (env!("MAL_CLIENT_ID")).
src/mal/network.rs Adds fetch_single_anime() to deserialize the single-object /anime/{id} endpoint.
src/mal/models/anime.rs Adds flexible u64 deserializer for statistics and Anime::display_title(); updates statistics fields.
src/mal/mod.rs Adds MalClient::get_anime_by_id() using the new single-anime fetch path.
src/config/README.md Documents new prefer_romaji config option.
src/config/mod.rs Adds prefer_romaji field + helper accessor.
src/app.rs Adds Action::ShowRelated handling.
docs/superpowers/specs/2026-06-01-related-timeline-screen-design.md Design spec document for the Related timeline screen.
Cross.toml Passes MAL_CLIENT_ID into cross builds.
build.rs Build-time injection of MAL_CLIENT_ID from env or local .env.
.github/workflows/binaries.yaml Provides MAL_CLIENT_ID from GitHub Actions secrets for release builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/screens/related.rs
Comment on lines +639 to +643
if let Some(id) = target
&& self.app_info.anime_store.get(&id).is_some()
{
return Some(Action::ShowOverlay(id));
}
Comment thread src/screens/related.rs
Comment on lines +756 to +758
fn draw_timeline(&mut self, frame: &mut Frame, area: Rect) {
let Some(timeline) = self.timeline.clone() else { return };

Comment thread src/screens/related.rs
Comment on lines +403 to +405
// keep the highlight on the searched anime as boxes stream in
self.line_index = root_index;
}
Comment thread src/mal/oauth.rs
Comment on lines +17 to +19
// Injected at build time by build.rs (from the MAL_CLIENT_ID env var or a
// gitignored .env file) so it is not hard-coded in the source.
pub const CLIENT_ID: &str = env!("MAL_CLIENT_ID");
Comment thread src/screens/related.rs
Comment on lines +535 to +540
if let crossterm::event::MouseEventKind::Down(_) = mouse_event.kind
&& let Some(id) = self.current_branches().get(bi).map(|b| b.id)
&& self.app_info.anime_store.get(&id).is_some()
{
return Some(Action::ShowOverlay(id));
}
@swstl
swstl deleted the related-timeline-screen branch June 2, 2026 08:37
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