roles are now better

This commit is contained in:
filipriec
2025-08-30 13:19:45 +02:00
parent 60eb1c9f51
commit d6fd672409
5 changed files with 57 additions and 24 deletions

View File

@@ -12,6 +12,7 @@ use ratatui::{
widgets::{Block, BorderType, Borders, List, ListItem, Paragraph, Wrap},
Frame,
};
use crate::state::pages::auth::UserRole;
use crate::pages::admin::admin::ui::render_admin_panel_admin;
pub fn render_admin_panel(
@@ -44,23 +45,20 @@ pub fn render_admin_panel(
.constraints([Constraint::Percentage(30), Constraint::Percentage(70)])
.split(chunks[1]);
if auth_state.role.as_deref() != Some("admin") {
render_admin_panel_non_admin(
f,
admin_state,
&content_chunks,
theme,
profile_tree,
selected_profile,
);
} else {
render_admin_panel_admin(
f,
chunks[1],
app_state,
admin_state,
theme,
);
match auth_state.role {
Some(UserRole::Admin) => {
render_admin_panel_admin(f, chunks[1], app_state, admin_state, theme);
}
_ => {
render_admin_panel_non_admin(
f,
admin_state,
&content_chunks,
theme,
profile_tree,
selected_profile,
);
}
}
}