text area on focus is now big
This commit is contained in:
@@ -33,7 +33,32 @@ pub fn render_add_logic(
|
||||
let inner_area = main_block.inner(area);
|
||||
f.render_widget(main_block, area);
|
||||
|
||||
// Calculate areas dynamically like add_table
|
||||
// --- Fullscreen Script Content Check ---
|
||||
if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
||||
let script_block_border_style = Style::default().fg(theme.highlight); // Always highlighted
|
||||
|
||||
let script_block = Block::default()
|
||||
.title(Span::styled(
|
||||
" Steel Script Content (Fullscreen) ",
|
||||
theme.fg,
|
||||
)) // Indicate fullscreen
|
||||
.title_alignment(Alignment::Center)
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(script_block_border_style);
|
||||
|
||||
let script_text =
|
||||
Text::from(add_logic_state.script_content_input.as_str());
|
||||
let script_paragraph = Paragraph::new(script_text)
|
||||
.block(script_block)
|
||||
.scroll(add_logic_state.script_content_scroll)
|
||||
.style(Style::default().fg(theme.fg));
|
||||
f.render_widget(script_paragraph, inner_area); // Use inner_area for fullscreen
|
||||
return; // IMPORTANT: Stop rendering here for fullscreen mode
|
||||
}
|
||||
|
||||
// --- Normal Layout ---
|
||||
// Calculate areas dynamically
|
||||
let main_chunks = Layout::default()
|
||||
.direction(Direction::Vertical)
|
||||
.constraints([
|
||||
@@ -49,15 +74,17 @@ pub fn render_add_logic(
|
||||
let script_content_area = main_chunks[2];
|
||||
let buttons_area = main_chunks[3];
|
||||
|
||||
// Top Info Rendering (like add_table)
|
||||
// Top Info Rendering
|
||||
let profile_text = Paragraph::new(vec![
|
||||
Line::from(Span::styled(
|
||||
format!("Profile: {}", add_logic_state.profile_name),
|
||||
theme.fg,
|
||||
)),
|
||||
Line::from(Span::styled(
|
||||
format!("Table: {}",
|
||||
add_logic_state.selected_table_id
|
||||
format!(
|
||||
"Table: {}",
|
||||
add_logic_state
|
||||
.selected_table_id
|
||||
.map(|id| format!("ID {}", id))
|
||||
.unwrap_or_else(|| "Global".to_string())
|
||||
),
|
||||
@@ -71,7 +98,7 @@ pub fn render_add_logic(
|
||||
);
|
||||
f.render_widget(profile_text, top_info_area);
|
||||
|
||||
// Canvas rendering for input fields (like add_table)
|
||||
// Canvas rendering for input fields
|
||||
let focus_on_canvas_inputs = matches!(
|
||||
add_logic_state.current_focus,
|
||||
AddLogicFocus::InputLogicName
|
||||
@@ -91,12 +118,13 @@ pub fn render_add_logic(
|
||||
highlight_state,
|
||||
);
|
||||
|
||||
// Script Content Area
|
||||
let script_block_border_style = if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
||||
Style::default().fg(theme.highlight)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
};
|
||||
// Script Content Area (Normal Mode)
|
||||
let script_block_border_style =
|
||||
if add_logic_state.current_focus == AddLogicFocus::InputScriptContent {
|
||||
Style::default().fg(theme.highlight)
|
||||
} else {
|
||||
Style::default().fg(theme.secondary)
|
||||
};
|
||||
|
||||
let script_block = Block::default()
|
||||
.title(" Steel Script Content ")
|
||||
@@ -104,14 +132,15 @@ pub fn render_add_logic(
|
||||
.border_type(BorderType::Rounded)
|
||||
.border_style(script_block_border_style);
|
||||
|
||||
let script_text = Text::from(add_logic_state.script_content_input.as_str());
|
||||
let script_text =
|
||||
Text::from(add_logic_state.script_content_input.as_str());
|
||||
let script_paragraph = Paragraph::new(script_text)
|
||||
.block(script_block)
|
||||
.scroll(add_logic_state.script_content_scroll)
|
||||
.style(Style::default().fg(theme.fg));
|
||||
f.render_widget(script_paragraph, script_content_area);
|
||||
|
||||
// Button Style Helpers (same as add_table)
|
||||
// Button Style Helpers
|
||||
let get_button_style = |button_focus: AddLogicFocus, current_focus| {
|
||||
let is_focused = current_focus == button_focus;
|
||||
let base_style = Style::default().fg(if is_focused {
|
||||
@@ -134,7 +163,7 @@ pub fn render_add_logic(
|
||||
}
|
||||
};
|
||||
|
||||
// Bottom Buttons (same style as add_table)
|
||||
// Bottom Buttons
|
||||
let button_chunks = Layout::default()
|
||||
.direction(Direction::Horizontal)
|
||||
.constraints([
|
||||
@@ -177,7 +206,7 @@ pub fn render_add_logic(
|
||||
);
|
||||
f.render_widget(cancel_button, button_chunks[1]);
|
||||
|
||||
// Dialog rendering (same as add_table)
|
||||
// Dialog rendering
|
||||
if app_state.ui.dialog.dialog_show {
|
||||
dialog::render_dialog(
|
||||
f,
|
||||
@@ -191,4 +220,3 @@ pub fn render_add_logic(
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user