Skip to content

feat(ui): enhance typing screen with improved layout and real-time updates#143

Merged
unhappychoice merged 4 commits intomainfrom
feature/ui-improvements
Sep 4, 2025
Merged

feat(ui): enhance typing screen with improved layout and real-time updates#143
unhappychoice merged 4 commits intomainfrom
feature/ui-improvements

Conversation

@unhappychoice
Copy link
Copy Markdown
Owner

@unhappychoice unhappychoice commented Sep 4, 2025

Summary

  • Enhanced typing screen UI with improved layout and blue-based color theme
  • Added real-time metrics updates during typing sessions
  • Implemented line numbers display using actual source file line numbers
  • Fixed critical CPM calculation bug during pause periods

Changes

UI Layout Improvements

  • Replaced single outer border with individual section borders
  • Applied consistent blue-based color scheme (cyan for Challenge, blue for Code, yellow for Metrics, green for Progress)
  • Moved [ESC] Options to bottom-left corner without border for cleaner appearance
  • Implemented compact layout with proper padding and spacing

Line Numbers Feature

  • Added line numbers to code display using actual source file line numbers from Challenge data
  • Current line highlighted in yellow with bold styling
  • Other lines shown in dark gray for subtle appearance

Real-time Updates & CPM Fix

  • Display updates every 100ms even without keyboard input
  • Elapsed time, WPM, CPM, and other metrics now update in real-time
  • FIXED: CPM no longer decreases during pause periods ([ESC] menu)
  • Real-time metrics now use proper elapsed time calculation (excluding paused duration)
  • Ensures consistency between real-time display and final results

Code Quality Improvements

  • Simplified method signatures by removing unused parameters
  • Refactored real-time calculation logic for better maintainability
  • Eliminated duplicate code and improved consistency

Test plan

  • All tests pass (cargo test) - 160 tests
  • Code compiles without warnings (cargo check, cargo clippy)
  • Code is properly formatted (cargo fmt)
  • CPM calculation during pause periods verified
  • Manual testing of typing screen layout and real-time updates
  • Verify line numbers match actual source file line numbers
  • Test UI responsiveness and color scheme

🤖 Generated with Claude Code

unhappychoice and others added 2 commits September 4, 2025 11:38
- Update display periodically (every 100ms) even without keyboard input
- Ensures elapsed time, WPM, CPM, and other metrics update in real-time
- Applies to all typing screen methods: start_session, show, show_with_state

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Replace single outer border with individual section borders (Challenge, Code, Metrics, Progress)
- Apply consistent blue-based color scheme with cyan/yellow/green accents
- Move [ESC] Options to bottom-left corner without border for cleaner look
- Add line numbers to code display using actual source file line numbers
- Implement compact layout with proper padding and spacing
- Support real-time display updates for better user experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Sep 4, 2025

Codecov Report

❌ Patch coverage is 0% with 108 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.76%. Comparing base (9087328) to head (141dbba).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
src/game/stage_renderer.rs 0.00% 101 Missing ⚠️
src/scoring/engine.rs 0.00% 4 Missing ⚠️
src/game/screens/typing_screen.rs 0.00% 3 Missing ⚠️

❌ Your patch status has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage.
❌ Your project status has failed because the head coverage (32.76%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #143      +/-   ##
==========================================
- Coverage   33.00%   32.76%   -0.24%     
==========================================
  Files          83       83              
  Lines        9201     9268      +67     
==========================================
  Hits         3037     3037              
- Misses       6164     6231      +67     
Files with missing lines Coverage Δ
src/game/screens/typing_screen.rs 0.00% <0.00%> (ø)
src/scoring/engine.rs 50.36% <0.00%> (ø)
src/game/stage_renderer.rs 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

unhappychoice and others added 2 commits September 4, 2025 11:59
- Replace calculate_real_time_result method to use elapsed_time instead of start_time.elapsed()
- Fix issue where CPM would decrease during pause periods
- Use actual elapsed time (excluding paused duration) for accurate metrics
- Ensure real-time display matches final results consistency

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Remove unused start_time parameter from display_challenge_with_info method
- Update all call sites to remove start_time argument
- Use scoring_engine.get_elapsed_time() directly for consistent timing
- Clean up method signatures for better maintainability

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@unhappychoice unhappychoice merged commit 03efba5 into main Sep 4, 2025
4 of 6 checks passed
@unhappychoice unhappychoice deleted the feature/ui-improvements branch September 4, 2025 03:04
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