Skip to content

Commit 5103c49

Browse files
committed
✨ feat: add income dialog for setting expected income
1 parent ccfc30b commit 5103c49

6 files changed

Lines changed: 564 additions & 0 deletions

File tree

src/tui/app.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use super::dialogs::budget::BudgetDialogState;
1313
use super::dialogs::bulk_categorize::BulkCategorizeState;
1414
use super::dialogs::category::CategoryFormState;
1515
use super::dialogs::group::GroupFormState;
16+
use super::dialogs::income::IncomeFormState;
1617
use super::dialogs::move_funds::MoveFundsState;
1718
use super::dialogs::reconcile_start::ReconcileStartState;
1819
use super::dialogs::transaction::TransactionFormState;
@@ -135,6 +136,7 @@ pub enum ActiveDialog {
135136
UnlockConfirm(UnlockConfirmState),
136137
Adjustment,
137138
Budget,
139+
Income,
138140
}
139141

140142
/// Main application state
@@ -241,6 +243,9 @@ pub struct App<'a> {
241243
/// Unified budget dialog state (period budget + target)
242244
pub budget_dialog_state: BudgetDialogState,
243245

246+
/// Income form dialog state
247+
pub income_form: IncomeFormState,
248+
244249
/// Pending 'g' keypress for Vim-style gg (go to top)
245250
pub pending_g: bool,
246251
}
@@ -290,6 +295,7 @@ impl<'a> App<'a> {
290295
category_form: CategoryFormState::new(),
291296
group_form: GroupFormState::new(),
292297
budget_dialog_state: BudgetDialogState::new(),
298+
income_form: IncomeFormState::new(),
293299
pending_g: false,
294300
}
295301
}
@@ -540,6 +546,12 @@ impl<'a> App<'a> {
540546
}
541547
}
542548
}
549+
ActiveDialog::Income => {
550+
// Initialize income dialog for current period
551+
self.income_form
552+
.init_for_period(&self.current_period, self.storage);
553+
self.input_mode = InputMode::Editing;
554+
}
543555
_ => {}
544556
}
545557
}

src/tui/commands.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ pub enum CommandAction {
4141
NextPeriod,
4242
PrevPeriod,
4343

44+
// Income operations
45+
SetIncome,
46+
4447
// Category operations
4548
AddCategory,
4649
AddGroup,
@@ -136,6 +139,13 @@ pub static COMMANDS: &[Command] = &[
136139
shortcut: Some("["),
137140
action: CommandAction::PrevPeriod,
138141
},
142+
// Income commands
143+
Command {
144+
name: "set-income",
145+
description: "Set expected income for current period",
146+
shortcut: Some("i"),
147+
action: CommandAction::SetIncome,
148+
},
139149
// Account commands
140150
Command {
141151
name: "add-account",

0 commit comments

Comments
 (0)