admin panel compiled

This commit is contained in:
filipriec
2025-03-22 10:27:21 +01:00
parent c592dfc7f5
commit c198297a5c
5 changed files with 62 additions and 5 deletions

View File

@@ -6,6 +6,7 @@ pub mod canvas;
pub mod sidebar;
pub mod background;
pub mod intro;
pub mod admin_panel;
pub use command_line::render_command_line;
pub use form::*;
@@ -14,3 +15,4 @@ pub use canvas::*;
pub use sidebar::*;
pub use background::*;
pub use intro::*;
pub use admin_panel::*;

View File

@@ -0,0 +1,44 @@
// src/components/handlers/admin_panel.rs
use ratatui::{
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::Style,
text::{Line, Span},
widgets::{Block, BorderType, Borders, Paragraph},
Frame,
};
use crate::config::colors::Theme;
pub struct AdminPanelState;
impl AdminPanelState {
pub fn new() -> Self {
Self
}
pub fn render(&self, f: &mut Frame, area: Rect, theme: &Theme) {
let block = Block::default()
.borders(Borders::ALL)
.border_type(BorderType::Rounded)
.border_style(Style::default().fg(theme.accent))
.style(Style::default().bg(theme.bg));
let inner_area = block.inner(area);
f.render_widget(block, area);
let chunks = Layout::default()
.direction(Direction::Vertical)
.constraints([
Constraint::Length(3), // Title
Constraint::Min(1), // Content
])
.split(inner_area);
let title = Line::from(Span::styled("Admin Panel", Style::default().fg(theme.highlight)));
let title_para = Paragraph::new(title)
.alignment(Alignment::Center);
f.render_widget(title_para, chunks[0]);
let content = Paragraph::new("Admin panel content goes here");
f.render_widget(content, chunks[1]);
}
}