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