Skip to content

feat(tui): add terminal UI layer with ratatui - #58

Open
Xaxxoo wants to merge 1 commit into
MindFlowInteractive:mainfrom
Xaxxoo:feature/tui-ratatui-41
Open

feat(tui): add terminal UI layer with ratatui#58
Xaxxoo wants to merge 1 commit into
MindFlowInteractive:mainfrom
Xaxxoo:feature/tui-ratatui-41

Conversation

@Xaxxoo

@Xaxxoo Xaxxoo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds ratatui and crossterm as native-only dependencies in Cargo.toml
  • Creates tui module (src/tui/mod.rs) with full TUI rendering components:
    • PuzzleView with bordered panels showing title, description, difficulty badge, and remaining hints
    • TimerBar countdown timer as a progress bar (Gauge widget)
    • ScoreDisplay with real-time score updates and colour coding
    • FooterBar with persistent keyboard shortcuts (h=Hint, Enter=Submit, q=Quit, ?=Help)
  • Colour coding: green for solved, red for failed, yellow for in-progress
  • TuiApp state management struct with tick-based timer, auto-fail on expiry
  • --no-tui CLI flag preserves the existing CLI module for headless environments
  • TUI module gated behind #[cfg(not(feature = "wasm"))] for WASM compatibility
  • Fixes pre-existing build errors (duplicate module declarations, missing time module, clippy warnings)

Test plan

  • 20 unit tests covering: game status colour mapping, puzzle state transitions, timer state (new, progress ratio, zero total, tick, expiry), score state colours, difficulty labels/colours, shortcut formatting, puzzle view data construction, TuiApp lifecycle (new, set puzzle, update score, mark solved/failed, tick causes failure, tick preserves solved)
  • All 206 tests pass (cargo test)
  • cargo clippy -- -D warnings passes clean
  • cargo fmt --check passes clean

Closes #41

🤖 Generated with Claude Code

Add a TUI module (`src/tui/mod.rs`) built on ratatui and crossterm with
bordered panels, colour-coded difficulty indicators, countdown timer
progress bar, real-time score display, and keyboard shortcut footer.
The existing CLI module is preserved as a `--no-tui` fallback flag.
Fixes pre-existing build errors (duplicate module declarations, missing
time module, clippy warnings).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

Add Terminal UI Layer with Ratatui

1 participant