not working, needs more fixes
This commit is contained in:
@@ -13,15 +13,24 @@ use ratatui::{
|
||||
Frame,
|
||||
};
|
||||
use crate::state::app::highlight::HighlightState;
|
||||
use canvas::{FormEditor, render_canvas_default, render_canvas, render_suggestions_dropdown, DefaultCanvasTheme};
|
||||
use canvas::{
|
||||
FormEditor,
|
||||
render_canvas,
|
||||
render_suggestions_dropdown,
|
||||
DefaultCanvasTheme,
|
||||
};
|
||||
use canvas::canvas::HighlightState as CanvasHighlightState;
|
||||
|
||||
// Helper function to convert between HighlightState types
|
||||
fn convert_highlight_state(local: &HighlightState) -> CanvasHighlightState {
|
||||
match local {
|
||||
HighlightState::Off => CanvasHighlightState::Off,
|
||||
HighlightState::Characterwise { anchor } => CanvasHighlightState::Characterwise { anchor: *anchor },
|
||||
HighlightState::Linewise { anchor_line } => CanvasHighlightState::Linewise { anchor_line: *anchor_line },
|
||||
HighlightState::Characterwise { anchor } => {
|
||||
CanvasHighlightState::Characterwise { anchor: *anchor }
|
||||
}
|
||||
HighlightState::Linewise { anchor_line } => {
|
||||
CanvasHighlightState::Linewise { anchor_line: *anchor_line }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +38,7 @@ pub fn render_login(
|
||||
f: &mut Frame,
|
||||
area: Rect,
|
||||
theme: &Theme,
|
||||
// FIX: take &LoginState (reference), not owned
|
||||
login_state: &LoginState,
|
||||
app_state: &AppState,
|
||||
is_edit_mode: bool,
|
||||
@@ -62,14 +72,15 @@ pub fn render_login(
|
||||
// --- FORM RENDERING (Using new canvas API) ---
|
||||
let _canvas_highlight_state = convert_highlight_state(highlight_state);
|
||||
|
||||
// Wrap LoginState in FormEditor
|
||||
let editor = FormEditor::new(login_state.clone());
|
||||
// Wrap LoginState in FormEditor (no clone needed)
|
||||
let editor = FormEditor::new(login_state);
|
||||
|
||||
// Use DefaultCanvasTheme instead of app Theme
|
||||
let input_rect = render_canvas(
|
||||
f,
|
||||
chunks[0],
|
||||
&editor,
|
||||
theme,
|
||||
&DefaultCanvasTheme,
|
||||
);
|
||||
|
||||
// --- ERROR MESSAGE ---
|
||||
@@ -150,7 +161,7 @@ pub fn render_login(
|
||||
f.area(),
|
||||
input_rect,
|
||||
&DefaultCanvasTheme,
|
||||
&editor,
|
||||
&editor, // FIX: pass &editor
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ pub struct AuthState {
|
||||
}
|
||||
|
||||
/// Represents the state of the Login form UI
|
||||
#[derive(Clone)]
|
||||
pub struct LoginState {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
|
||||
Reference in New Issue
Block a user