align auth popup error to center

This commit is contained in:
ChristianVisintin
2020-12-14 13:39:47 +01:00
parent c493ba45a8
commit bd99a0c2b2
2 changed files with 12 additions and 6 deletions

View File

@@ -18,6 +18,8 @@ Released on 14/12/2020
- File explorer: - File explorer:
- Fixed color mismatch in local explorer - Fixed color mismatch in local explorer
- Explorer tabs have now 70% of layout height, while logging area is 30% - Explorer tabs have now 70% of layout height, while logging area is 30%
- Auth page:
- align popup text to center
- Bugfix: - Bugfix:
- Fixed memory vulnerability in Windows version - Fixed memory vulnerability in Windows version

View File

@@ -31,6 +31,7 @@ extern crate unicode_width;
// locals // locals
use super::{Activity, Context}; use super::{Activity, Context};
use crate::filetransfer::FileTransferProtocol; use crate::filetransfer::FileTransferProtocol;
use crate::utils::align_text_center;
// Includes // Includes
use crossterm::event::Event as InputEvent; use crossterm::event::Event as InputEvent;
@@ -397,9 +398,9 @@ impl AuthActivity {
.direction(Direction::Vertical) .direction(Direction::Vertical)
.constraints( .constraints(
[ [
Constraint::Percentage((80) / 2), Constraint::Percentage(30), // Offset top
Constraint::Percentage(20), Constraint::Percentage(10), // Actual height
Constraint::Percentage((80) / 2), Constraint::Percentage(60), // Offset bottom
] ]
.as_ref(), .as_ref(),
) )
@@ -415,9 +416,12 @@ impl AuthActivity {
.as_ref(), .as_ref(),
) )
.split(popup_layout[1])[1]; .split(popup_layout[1])[1];
let popup: Paragraph = Paragraph::new(self.popup_message.as_ref().unwrap().as_ref()) let popup: Paragraph = Paragraph::new(align_text_center(
.style(Style::default().fg(Color::Red)) self.popup_message.as_ref().unwrap().as_ref(),
.block(Block::default().borders(Borders::ALL).title("Alert")); area.width,
))
.style(Style::default().fg(Color::Red))
.block(Block::default().borders(Borders::ALL).title("Alert"));
(popup, area) (popup, area)
} }
} }