Meliputi: - File-level //! doc comment: tujuan file, alur kerja, komponen utama - Function-level /// doc comment: apa, parameter, return, flow, edge cases - Struct/enum/trait /// doc comment: peran, field docs - Tracing logging (tracing::info!/debug!/trace!/warn!/error!) di setiap fungsi - Inline comments untuk variable dan branching logic penting - Seluruh 8 crates di workspace: zesdex-backend, zesdex-cms, zesdex-entities, zesdex-iam, zesdex-infra, zesdex-ipc, zesdex-middleware, zesdex-utils - Build: 0 errors, 242/242 tests passed
59 lines
2.0 KiB
Rust
59 lines
2.0 KiB
Rust
//! Overlay: effort-level selector — lets the user pick a reasoning/quality
|
|
//! tier (from `EFFORT_LEVELS`) with ↑/↓ navigation.
|
|
//!
|
|
//! Flow: reads the current effort index from `mode::effort::current_effort`,
|
|
//! highlights the active entry, and renders the full list.
|
|
|
|
use ratatui::style::{Modifier, Style};
|
|
use ratatui::text::{Line, Span};
|
|
use ratatui::widgets::{Block, Paragraph};
|
|
use ratatui::Frame;
|
|
use crate::view::theme::Theme;
|
|
use tracing;
|
|
|
|
/// Render the Effort Level overlay — list of tiers with the current one highlighted.
|
|
pub fn render(
|
|
frame: &mut Frame,
|
|
area: ratatui::layout::Rect,
|
|
block: Block<'static>,
|
|
state: &crate::app::state::rest::AppStateRest,
|
|
) {
|
|
tracing::debug!("overlay: Effort Level");
|
|
let block = block
|
|
.title(Span::styled(
|
|
" Effort Level ",
|
|
Style::default()
|
|
.fg(Theme::ACCENT_PURPLE)
|
|
.add_modifier(Modifier::BOLD),
|
|
))
|
|
.border_style(Style::default().fg(Theme::ACCENT_PURPLE));
|
|
let levels = crate::app::mode::effort::EFFORT_LEVELS;
|
|
let current_idx = crate::app::mode::effort::current_effort(state);
|
|
let mut lines: Vec<Line> = vec![
|
|
Line::from(Span::styled(
|
|
" Use ↑↓ to change effort level",
|
|
Style::default().fg(Theme::TEXT_DIM),
|
|
)),
|
|
Line::from(Span::raw("")),
|
|
];
|
|
for (i, l) in levels.iter().enumerate() {
|
|
let selected = i == current_idx;
|
|
lines.push(Line::from(Span::styled(
|
|
if selected {
|
|
format!(" ▸ {l} (active)")
|
|
} else {
|
|
format!(" {l}")
|
|
},
|
|
if selected {
|
|
Style::default()
|
|
.fg(Theme::HIGHLIGHT)
|
|
.add_modifier(Modifier::BOLD)
|
|
} else {
|
|
Style::default().fg(Theme::TEXT)
|
|
},
|
|
)));
|
|
}
|
|
let paragraph = Paragraph::new(lines).block(block);
|
|
frame.render_widget(paragraph, area);
|
|
}
|