added color coding, new state, improved save logic
This commit is contained in:
@@ -77,6 +77,29 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
||||
CurrentScreen::Delete => Color::Yellow,
|
||||
_ => Color::DarkGray,
|
||||
};
|
||||
let tableBorderColor = match app.appStatus {
|
||||
AppStatus::Saved => Color::LightGreen,
|
||||
AppStatus::Welcome => Color::White,
|
||||
_ => {
|
||||
if app.isHashDifferent() {
|
||||
Color::LightYellow
|
||||
} else {
|
||||
Color::White
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// if app.appStatus == AppStatus::Saved {
|
||||
// Color::LightGreen
|
||||
// } else if app.appStatus == AppStatus::Welcome {
|
||||
// Color::White
|
||||
// } else {
|
||||
// if app.isHashDifferent() {
|
||||
// Color::LightYellow
|
||||
// } else {
|
||||
// Color::White
|
||||
// }
|
||||
// };
|
||||
let table = Table::new(
|
||||
dataRows,
|
||||
[
|
||||
@@ -89,7 +112,11 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
||||
],
|
||||
)
|
||||
.header(headers)
|
||||
.block(Block::default().borders(Borders::all()))
|
||||
.block(
|
||||
Block::default()
|
||||
.borders(Borders::all())
|
||||
.style(Style::default().fg(tableBorderColor)),
|
||||
)
|
||||
.row_highlight_style(
|
||||
Style::default()
|
||||
.add_modifier(Modifier::REVERSED)
|
||||
@@ -114,7 +141,8 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
||||
]);
|
||||
let exitPara = Paragraph::new(exitText)
|
||||
.block(exitPopup)
|
||||
.wrap(Wrap { trim: false });
|
||||
.wrap(Wrap { trim: false })
|
||||
.style(Style::default().fg(Color::White));
|
||||
|
||||
let area = centered_rect(60, 25, titleBodyChunks[1]);
|
||||
frame.render_widget(exitPara, area);
|
||||
@@ -198,6 +226,7 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
||||
match &app.appStatus {
|
||||
AppStatus::Welcome => Span::styled("Welcome", Style::default().fg(Color::White)),
|
||||
AppStatus::Added => Span::styled("Added", Style::default().fg(Color::Green)),
|
||||
AppStatus::Deleted => Span::styled("Deleted", Style::default().fg(Color::Magenta)),
|
||||
AppStatus::Editing => {
|
||||
if let Some(editing) = &app.currentlyEditing {
|
||||
let curEdit = match editing {
|
||||
|
||||
Reference in New Issue
Block a user