dead code + couleur
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use chrono::{DateTime, Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone, Utc};
|
||||
use chrono::{Local, NaiveDate, NaiveDateTime, NaiveTime, TimeZone};
|
||||
use sqlite::Connection;
|
||||
|
||||
use crate::{data_layer, entities::*, enums::*};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{data_layer, entities::Account};
|
||||
use crate::data_layer;
|
||||
use chrono::{DateTime, Local, TimeZone, Utc};
|
||||
use sqlite::Connection;
|
||||
|
||||
|
||||
@@ -71,7 +71,6 @@ where
|
||||
CurrentWidget::TrxList => {
|
||||
app.next_tr();
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
KeyCode::Char('k') => match app.current_widget {
|
||||
CurrentWidget::AccountList => {
|
||||
@@ -80,7 +79,6 @@ where
|
||||
CurrentWidget::TrxList => {
|
||||
app.previous_tr();
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
KeyCode::Char('n') => match app.current_widget {
|
||||
CurrentWidget::AccountList => {
|
||||
@@ -92,7 +90,6 @@ where
|
||||
.set_account_id(app.acc_list.get_selected_id());
|
||||
app.new_transaction.set_date(Local::now());
|
||||
}
|
||||
_ => {}
|
||||
},
|
||||
_ => {}
|
||||
},
|
||||
@@ -138,7 +135,6 @@ where
|
||||
app.current_screen = CurrentScreen::Main;
|
||||
}
|
||||
},
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
src/ui.rs
16
src/ui.rs
@@ -1,13 +1,8 @@
|
||||
use crate::{
|
||||
app::App,
|
||||
entities::{Account, Transaction},
|
||||
enums::*,
|
||||
};
|
||||
use chrono::{Date, Local};
|
||||
use crate::{app::App, entities::Account, enums::*};
|
||||
use ratatui::{
|
||||
Frame,
|
||||
layout::{Constraint, Direction, Layout, Rect},
|
||||
style::{Color, Modifier, Style, Stylize, palette::tailwind::SLATE},
|
||||
style::{Color, Modifier, Style, palette::tailwind::SLATE},
|
||||
text::{Line, Text},
|
||||
widgets::{
|
||||
Block, Borders, HighlightSpacing, List, ListItem, Paragraph, Row, StatefulWidget, Table,
|
||||
@@ -50,7 +45,7 @@ pub fn ui(frame: &mut Frame, app: &mut App) {
|
||||
.get_list_accounts()
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(i, acc)| ListItem::from(acc))
|
||||
.map(|(_, acc)| ListItem::from(acc))
|
||||
.collect();
|
||||
|
||||
let list = List::new(ac_items)
|
||||
@@ -81,6 +76,11 @@ pub fn ui(frame: &mut Frame, app: &mut App) {
|
||||
tr.get_amount().to_string(),
|
||||
tr.get_desc(),
|
||||
])
|
||||
.style(Style::new().fg(if tr.get_amount() > 0.0 {
|
||||
Color::Green
|
||||
} else {
|
||||
Color::Red
|
||||
}))
|
||||
});
|
||||
let widths = [
|
||||
Constraint::Percentage(30),
|
||||
|
||||
Reference in New Issue
Block a user