fixed #5, added colors.
This commit is contained in:
@@ -8,7 +8,7 @@ pub fn getExitPara() -> Paragraph<'static> {
|
|||||||
let exitPopup = Block::default()
|
let exitPopup = Block::default()
|
||||||
.title("Exit Window")
|
.title("Exit Window")
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.style(Style::default().bg(Color::DarkGray))
|
.style(Style::default().bg(Color::Rgb(42, 61, 69)))
|
||||||
.border_style(Style::default().fg(Color::Red));
|
.border_style(Style::default().fg(Color::Red));
|
||||||
|
|
||||||
let exitText = Text::from(vec![
|
let exitText = Text::from(vec![
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use ratatui::{
|
|||||||
layout::{Constraint, Direction, Layout},
|
layout::{Constraint, Direction, Layout},
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
text::{Line, Span, Text},
|
text::{Line, Span, Text},
|
||||||
widgets::{Block, Borders, Paragraph},
|
widgets::{Block, Borders, Clear, Padding, Paragraph},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::app::status::{AppStatus, CurrentScreen, EntryValError};
|
use crate::app::status::{AppStatus, CurrentScreen, EntryValError};
|
||||||
@@ -62,36 +62,48 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
|||||||
|
|
||||||
// Renter exit prompt
|
// Renter exit prompt
|
||||||
if let CurrentScreen::Exit = app.screen {
|
if let CurrentScreen::Exit = app.screen {
|
||||||
frame.render_widget(
|
let area = centered_rect(60, 25, titleBodyChunks[1]);
|
||||||
exitPrompt::getExitPara(),
|
frame.render_widget(Clear, area);
|
||||||
centered_rect(60, 25, titleBodyChunks[1]),
|
frame.render_widget(exitPrompt::getExitPara(), area);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Editing screen popup
|
// Editing screen popup
|
||||||
if let Some(edit) = &app.currentlyEditing {
|
if let Some(edit) = &app.currentlyEditing {
|
||||||
let popup = Block::default()
|
let popup = Block::default()
|
||||||
.title("Add an entry")
|
.title("Add an entry")
|
||||||
.borders(Borders::NONE)
|
.borders(Borders::all())
|
||||||
.style(Style::default().bg(Color::DarkGray));
|
.style(Style::default().bg(Color::Rgb(42, 61, 69)).fg(Color::Green));
|
||||||
let area = centered_rect(75, 30, titleBodyChunks[1]);
|
let area = centered_rect(75, 30, titleBodyChunks[1]);
|
||||||
|
frame.render_widget(Clear, area);
|
||||||
frame.render_widget(popup, area);
|
frame.render_widget(popup, area);
|
||||||
|
|
||||||
let fields = Layout::default()
|
let fields = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.margin(1)
|
.margin(1)
|
||||||
.constraints([
|
.constraints([
|
||||||
Constraint::Percentage(25),
|
Constraint::Percentage(30),
|
||||||
Constraint::Percentage(25),
|
Constraint::Percentage(20),
|
||||||
Constraint::Percentage(25),
|
Constraint::Percentage(30),
|
||||||
Constraint::Percentage(25),
|
Constraint::Percentage(25),
|
||||||
])
|
])
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let mut fromIPBlock = Block::default().title("From IP").borders(Borders::ALL);
|
let mut fromIPBlock = Block::default()
|
||||||
let mut toIPBlock = Block::default().title("To IP").borders(Borders::ALL);
|
.title("From IP")
|
||||||
let mut fromPortBlock = Block::default().title("From Port").borders(Borders::ALL);
|
.borders(Borders::ALL)
|
||||||
let mut toPortBlock = Block::default().title("To Port").borders(Borders::ALL);
|
.style(Style::default().fg(Color::White));
|
||||||
|
let mut toIPBlock = Block::default()
|
||||||
|
.title("To IP")
|
||||||
|
.borders(Borders::ALL)
|
||||||
|
.style(Style::default().fg(Color::White));
|
||||||
|
let mut fromPortBlock = Block::default()
|
||||||
|
.title("From Port")
|
||||||
|
.borders(Borders::ALL)
|
||||||
|
.style(Style::default().fg(Color::White));
|
||||||
|
let mut toPortBlock = Block::default()
|
||||||
|
.title("To Port")
|
||||||
|
.borders(Borders::ALL)
|
||||||
|
.style(Style::default().fg(Color::White));
|
||||||
|
|
||||||
let activeStyle = Style::default().bg(Color::LightYellow).fg(Color::Black);
|
let activeStyle = Style::default().bg(Color::LightYellow).fg(Color::Black);
|
||||||
|
|
||||||
@@ -173,7 +185,7 @@ pub fn ui(frame: &mut Frame, app: &mut AppState) {
|
|||||||
};
|
};
|
||||||
Span::styled(errString, Style::default().fg(Color::Red))
|
Span::styled(errString, Style::default().fg(Color::Red))
|
||||||
}
|
}
|
||||||
AppStatus::Saved => Span::styled("Saved", Style::default()),
|
AppStatus::Saved => Span::styled("Saved", Style::default().fg(Color::Green)),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user