adjusted login not working yet, wrong changes
This commit is contained in:
@@ -5,12 +5,11 @@ use crate::{
|
|||||||
state::pages::auth::AuthState,
|
state::pages::auth::AuthState,
|
||||||
};
|
};
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
layout::{Alignment, Constraint, Direction, Layout, Rect, Margin},
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
widgets::{Block, BorderType, Borders, Paragraph},
|
widgets::{Block, BorderType, Borders, Paragraph},
|
||||||
Frame,
|
Frame,
|
||||||
};
|
};
|
||||||
use ratatui::prelude::Margin;
|
|
||||||
|
|
||||||
pub fn render_login(
|
pub fn render_login(
|
||||||
f: &mut Frame,
|
f: &mut Frame,
|
||||||
@@ -18,11 +17,11 @@ pub fn render_login(
|
|||||||
theme: &Theme,
|
theme: &Theme,
|
||||||
state: &AuthState,
|
state: &AuthState,
|
||||||
) {
|
) {
|
||||||
// Main login block with rounded borders
|
// Main login block with plain borders (matches main form style)
|
||||||
let block = Block::default()
|
let block = Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_type(BorderType::Rounded)
|
.border_type(BorderType::Plain) // Matches main form style
|
||||||
.border_style(Style::default().fg(theme.accent))
|
.border_style(Style::default().fg(theme.border))
|
||||||
.title(" Login ")
|
.title(" Login ")
|
||||||
.style(Style::default().bg(theme.bg));
|
.style(Style::default().bg(theme.bg));
|
||||||
|
|
||||||
@@ -40,12 +39,13 @@ pub fn render_login(
|
|||||||
let chunks = Layout::default()
|
let chunks = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints([
|
.constraints([
|
||||||
Constraint::Min(3), // Form area (will be managed by render_generic_form)
|
Constraint::Min(3), // Form area
|
||||||
|
Constraint::Length(1), // Error message area
|
||||||
Constraint::Length(3), // Buttons area
|
Constraint::Length(3), // Buttons area
|
||||||
])
|
])
|
||||||
.split(inner_area);
|
.split(inner_area);
|
||||||
|
|
||||||
// Render form using generic component
|
// Render form with plaintext display
|
||||||
render_generic_form(
|
render_generic_form(
|
||||||
f,
|
f,
|
||||||
chunks[0],
|
chunks[0],
|
||||||
@@ -60,7 +60,7 @@ pub fn render_login(
|
|||||||
let button_chunks = Layout::default()
|
let button_chunks = Layout::default()
|
||||||
.direction(Direction::Horizontal)
|
.direction(Direction::Horizontal)
|
||||||
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
|
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
|
||||||
.split(chunks[1]);
|
.split(chunks[2]);
|
||||||
|
|
||||||
// Login button
|
// Login button
|
||||||
let login_style = if !state.return_selected {
|
let login_style = if !state.return_selected {
|
||||||
@@ -121,6 +121,6 @@ pub fn render_login(
|
|||||||
let err_block = Paragraph::new(err.as_str())
|
let err_block = Paragraph::new(err.as_str())
|
||||||
.style(Style::default().fg(Color::Red))
|
.style(Style::default().fg(Color::Red))
|
||||||
.alignment(Alignment::Center);
|
.alignment(Alignment::Center);
|
||||||
f.render_widget(err_block, chunks[0]); // Render over form area
|
f.render_widget(err_block, chunks[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user