added color coding, new state, improved save logic
Some checks failed
/ Quality Check (push) Failing after 1m33s
/ Build (push) Successful in 1m14s

This commit is contained in:
Phani Pavan K
2025-10-23 15:57:27 +05:30
parent a795ad986b
commit c4feab2f75
8 changed files with 89 additions and 17 deletions

View File

@@ -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 {