more claude changes

This commit is contained in:
2026-03-03 14:59:45 -06:00
parent 97df57aba5
commit e499f76c3f
3 changed files with 9 additions and 29 deletions

View File

@@ -9,14 +9,14 @@ pub const GLOBAL_PATH: usize = 4;
pub const GLOBAL_HUT_TYPE: usize = 5; pub const GLOBAL_HUT_TYPE: usize = 5;
pub const GLOBAL_COUNT: usize = 6; pub const GLOBAL_COUNT: usize = 6;
pub const LOT_STATUS_OPTIONS: &[&str] = &["Unrestricted", "Blocked", "Quality"];
// Field indices for per-row inputs // Field indices for per-row inputs
pub const ROW_MAT_ID: usize = 0; pub const ROW_MAT_ID: usize = 0;
pub const ROW_QUANTITY: usize = 1; pub const ROW_QUANTITY: usize = 1;
pub const ROW_UOM: usize = 2; pub const ROW_UOM: usize = 2;
pub const ROW_COUNT: usize = 3; pub const ROW_COUNT: usize = 3;
pub const LOT_STATUS_OPTIONS: &[&str] = &["Unrestricted", "Blocked", "Quality"];
/// Which section of the UI the cursor is in /// Which section of the UI the cursor is in
#[derive(Clone, PartialEq)] #[derive(Clone, PartialEq)]
pub enum Focus { pub enum Focus {
@@ -201,7 +201,9 @@ impl App {
pub fn type_char(&mut self, c: char) { pub fn type_char(&mut self, c: char) {
match self.focus.clone() { match self.focus.clone() {
Focus::GlobalField(i) if i == GLOBAL_CHECKSUM => {} // toggled, not typed // GLOBAL_CHECKSUM is toggled via Space, not typed
// GLOBAL_LOT_STATUS is cycled via Space/←/→, not typed
Focus::GlobalField(i) if i == GLOBAL_CHECKSUM || i == GLOBAL_LOT_STATUS => {}
Focus::GlobalField(i) => { Focus::GlobalField(i) => {
self.global[i].push(c); self.global[i].push(c);
} }
@@ -214,7 +216,7 @@ impl App {
pub fn backspace(&mut self) { pub fn backspace(&mut self) {
match self.focus.clone() { match self.focus.clone() {
Focus::GlobalField(i) if i == GLOBAL_CHECKSUM => {} Focus::GlobalField(i) if i == GLOBAL_CHECKSUM || i == GLOBAL_LOT_STATUS => {}
Focus::GlobalField(i) => { Focus::GlobalField(i) => {
self.global[i].pop(); self.global[i].pop();
} }
@@ -234,20 +236,6 @@ impl App {
}; };
} }
pub fn cycle_lot_status(&mut self) {
if let Focus::GlobalField(i) = self.focus {
if i == GLOBAL_LOT_STATUS {
let current = self.global[GLOBAL_LOT_STATUS].clone();
let idx = LOT_STATUS_OPTIONS
.iter()
.position(|&s| s == current.as_str())
.unwrap_or(0);
let next = (idx + 1) % LOT_STATUS_OPTIONS.len();
self.global[GLOBAL_LOT_STATUS] = LOT_STATUS_OPTIONS[next].to_string();
}
}
}
// ── lot management ──────────────────────────────────────────────────────── // ── lot management ────────────────────────────────────────────────────────
pub fn add_lot(&mut self) { pub fn add_lot(&mut self) {

View File

@@ -2,7 +2,7 @@ mod app;
mod row; mod row;
mod ui; mod ui;
use app::{App, Focus, ModalKind, GLOBAL_CHECKSUM, GLOBAL_LOT_STATUS}; use app::{App, Focus, ModalKind, GLOBAL_CHECKSUM};
use crossterm::{ use crossterm::{
event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyModifiers}, event::{self, DisableMouseCapture, EnableMouseCapture, Event, KeyCode, KeyModifiers},
execute, execute,
@@ -131,12 +131,6 @@ fn run<B: ratatui::backend::Backend>(terminal: &mut Terminal<B>) -> anyhow::Resu
app.toggle_checksum(); app.toggle_checksum();
} }
} }
Focus::GlobalField(i) if i == GLOBAL_LOT_STATUS => match key.code {
KeyCode::Left | KeyCode::Right | KeyCode::Char(' ') => {
app.cycle_lot_status();
}
_ => {}
},
_ => match key.code { _ => match key.code {
KeyCode::Backspace => app.backspace(), KeyCode::Backspace => app.backspace(),
KeyCode::Char(c) => app.type_char(c), KeyCode::Char(c) => app.type_char(c),

View File

@@ -8,7 +8,7 @@ use ratatui::{
use crate::app::{ use crate::app::{
App, Focus, ModalKind, GLOBAL_CHECKSUM, GLOBAL_COUNT, GLOBAL_HUT_ID, GLOBAL_HUT_TYPE, App, Focus, ModalKind, GLOBAL_CHECKSUM, GLOBAL_COUNT, GLOBAL_HUT_ID, GLOBAL_HUT_TYPE,
GLOBAL_LOT_STATUS, GLOBAL_PATH, GLOBAL_TARE, ROW_COUNT, ROW_MAT_ID, ROW_QUANTITY, ROW_UOM, GLOBAL_PATH, GLOBAL_TARE, ROW_COUNT, ROW_MAT_ID, ROW_QUANTITY, ROW_UOM,
}; };
const GLOBAL_LABELS: &[&str] = &[ const GLOBAL_LABELS: &[&str] = &[
@@ -129,8 +129,6 @@ fn draw_globals(f: &mut Frame, app: &App, area: Rect) {
let value: String = if i == GLOBAL_CHECKSUM { let value: String = if i == GLOBAL_CHECKSUM {
let checked = app.global[i] == "true"; let checked = app.global[i] == "true";
format!("[{}] (Space)", if checked { "x" } else { " " }) format!("[{}] (Space)", if checked { "x" } else { " " })
} else if i == GLOBAL_LOT_STATUS {
format!("{} (←/→)", app.global[i])
} else { } else {
app.global[i].clone() app.global[i].clone()
}; };