bottom panel moved

This commit is contained in:
Priec
2025-08-22 16:48:25 +02:00
parent ea7ff3796f
commit 3dff2ced6c
8 changed files with 129 additions and 79 deletions

View File

@@ -8,9 +8,8 @@ use crate::components::{
common::find_file_palette,
intro::intro::render_intro,
render_background,
render_command_line,
render_status_line,
};
use crate::bottom_panel::{command_line::render_command_line, status_line::render_status_line};
use crate::sidebar::{calculate_sidebar_layout, render_sidebar};
use crate::buffer::render_buffer_list;
use crate::search::render_search_palette;
@@ -24,6 +23,7 @@ use crate::state::pages::auth::LoginState;
use crate::state::pages::auth::RegisterState;
use crate::state::pages::form::FormState;
use crate::state::pages::intro::IntroState;
use crate::bottom_panel::layout::{bottom_panel_constraints, render_bottom_panel};
use crate::components::render_form;
use ratatui::{
layout::{Constraint, Direction, Layout},
@@ -52,38 +52,15 @@ pub fn render_ui(
) {
render_background(f, f.area(), theme);
// --- START DYNAMIC LAYOUT LOGIC ---
let status_line_height = 1;
#[cfg(feature = "ui-debug")]
{
if let Some(debug_state) = &app_state.debug_state {
if debug_state.is_error {
status_line_height = 4;
}
}
}
// --- END DYNAMIC LAYOUT LOGIC ---
const PALETTE_OPTIONS_HEIGHT_FOR_LAYOUT: u16 = 15;
let mut bottom_area_constraints: Vec<Constraint> = vec![Constraint::Length(status_line_height)];
let command_palette_area_height = if navigation_state.active {
1 + PALETTE_OPTIONS_HEIGHT_FOR_LAYOUT
} else if event_handler_command_mode_active {
1
} else {
0
};
if command_palette_area_height > 0 {
bottom_area_constraints.push(Constraint::Length(command_palette_area_height));
}
let mut main_layout_constraints = vec![Constraint::Min(1)];
if app_state.ui.show_buffer_list {
main_layout_constraints.insert(0, Constraint::Length(1));
}
main_layout_constraints.extend(bottom_area_constraints);
main_layout_constraints.extend(bottom_panel_constraints(
app_state,
navigation_state,
event_handler_command_mode_active,
));
let root_chunks = Layout::default()
.direction(Direction::Vertical)
@@ -102,19 +79,6 @@ pub fn render_ui(
let main_content_area = root_chunks[chunk_idx];
chunk_idx += 1;
let status_line_area = root_chunks[chunk_idx];
chunk_idx += 1;
let command_render_area = if command_palette_area_height > 0 {
if root_chunks.len() > chunk_idx {
Some(root_chunks[chunk_idx])
} else {
None
}
} else {
None
};
if app_state.ui.show_intro {
render_intro(f, intro_state, main_content_area, theme);
} else if app_state.ui.show_register {
@@ -209,36 +173,6 @@ pub fn render_ui(
render_buffer_list(f, area, theme, buffer_state, app_state);
}
render_status_line(
f,
status_line_area,
current_dir,
theme,
is_event_handler_edit_mode,
current_fps,
app_state,
);
if let Some(palette_or_command_area) = command_render_area {
if navigation_state.active {
find_file_palette::render_find_file_palette(
f,
palette_or_command_area,
theme,
navigation_state,
);
} else if event_handler_command_mode_active {
render_command_line(
f,
palette_or_command_area,
event_handler_command_input,
true,
theme,
event_handler_command_message,
);
}
}
// This block now correctly handles drawing popups over any view.
if app_state.ui.show_search_palette {
if let Some(search_state) = &app_state.search_state {
@@ -256,4 +190,19 @@ pub fn render_ui(
app_state.ui.dialog.is_loading,
);
}
render_bottom_panel(
f,
&root_chunks,
&mut chunk_idx,
current_dir,
theme,
is_event_handler_edit_mode,
current_fps,
app_state,
navigation_state,
event_handler_command_input,
event_handler_command_mode_active,
event_handler_command_message,
);
}

View File

@@ -33,6 +33,7 @@ use crossterm::event as crossterm_event;
use tracing::{error, info, warn};
use tokio::sync::mpsc;
use std::time::Instant;
use std::time::Duration;
#[cfg(feature = "ui-debug")]
use crate::state::app::state::DebugState;
#[cfg(feature = "ui-debug")]