admin panel compiled
This commit is contained in:
@@ -3,7 +3,7 @@ use crate::components::{
|
||||
render_background,
|
||||
render_command_line,
|
||||
render_status_line,
|
||||
handlers::{sidebar::{self, calculate_sidebar_layout}, intro},
|
||||
handlers::{sidebar::{self, calculate_sidebar_layout}, intro, admin_panel::AdminPanelState},
|
||||
};
|
||||
use crate::config::colors::Theme;
|
||||
use ratatui::layout::{Constraint, Direction, Layout};
|
||||
@@ -24,6 +24,7 @@ pub fn render_ui(
|
||||
command_message: &str,
|
||||
app_state: &AppState,
|
||||
intro_state: &intro::IntroState,
|
||||
admin_panel_state: &AdminPanelState,
|
||||
) {
|
||||
render_background(f, f.area(), theme);
|
||||
|
||||
@@ -42,7 +43,11 @@ pub fn render_ui(
|
||||
.split(f.area());
|
||||
|
||||
let main_content_area = root[0];
|
||||
let (sidebar_area, form_area) = calculate_sidebar_layout(app_state.ui.show_sidebar, main_content_area);
|
||||
let (sidebar_area, form_area) = if app_state.ui.show_admin {
|
||||
(None, main_content_area)
|
||||
} else {
|
||||
calculate_sidebar_layout(app_state.ui.show_sidebar, main_content_area)
|
||||
};
|
||||
let available_width = form_area.width;
|
||||
|
||||
let form_constraint = if available_width >= 80 {
|
||||
@@ -74,7 +79,9 @@ pub fn render_ui(
|
||||
current_position,
|
||||
);
|
||||
|
||||
if let Some(sidebar_rect) = sidebar_area {
|
||||
if app_state.ui.show_admin {
|
||||
admin_panel_state.render(f, form_area, theme);
|
||||
} else if let Some(sidebar_rect) = sidebar_area {
|
||||
sidebar::render_sidebar(f, sidebar_rect, theme, &app_state.profile_tree);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user