NEW PAGE ADD TABLE

This commit is contained in:
filipriec
2025-04-16 22:07:07 +02:00
parent 93a3c246c6
commit 69953401b1
8 changed files with 51 additions and 6 deletions

View File

@@ -6,7 +6,7 @@ use crate::state::app::buffer::AppView;
pub fn get_view_layer(view: &AppView) -> u8 {
match view {
AppView::Intro => 1,
AppView::Login | AppView::Register | AppView::Admin => 2,
AppView::Login | AppView::Register | AppView::Admin | AppView::AddTable => 2,
AppView::Form(_) | AppView::Scratch => 3,
}
}

View File

@@ -6,14 +6,17 @@ use crate::state::{
pages::admin::{AdminFocus, AdminState},
};
use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use crate::state::app::buffer::AppView;
use crate::state::app::buffer::BufferState;
/// Handles navigation events specifically for the Admin Panel view.
/// Returns true if the event was handled, false otherwise.
pub fn handle_admin_navigation(
key: KeyEvent,
config: &Config,
app_state: &AppState, // Read-only access needed for counts
admin_state: &mut AdminState, // Mutable to change focus/selection
app_state: &AppState,
admin_state: &mut AdminState,
buffer_state: &mut BufferState,
command_message: &mut String,
) -> bool {
let action = config.get_general_action(key.code, key.modifiers);
@@ -157,8 +160,8 @@ pub fn handle_admin_navigation(
// TODO: Trigger action for Button 1
}
AdminFocus::Button2 => {
*command_message = "Action: Add Table (Not Implemented)".to_string();
// TODO: Trigger action for Button 2
buffer_state.update_history(AppView::AddTable);
*command_message = "Navigating to Add Table page...".to_string();
}
AdminFocus::Button3 => {
*command_message = "Action: Change Table (Not Implemented)".to_string();