app: Add navigation banner

Unstyled as of yet.
This commit is contained in:
Valentin Tolmer 2021-10-11 16:36:13 +02:00 committed by nitnelave
parent 7d21cc5126
commit 9e9129aa3a

View File

@ -96,6 +96,7 @@ impl Component for App {
html! { html! {
<div class="container"> <div class="container">
<h1>{ "LLDAP" }</h1> <h1>{ "LLDAP" }</h1>
{self.view_banner()}
<Router<AppRoute> <Router<AppRoute>
render = Router::render(move |switch: AppRoute| { render = Router::render(move |switch: AppRoute| {
match switch { match switch {
@ -180,6 +181,31 @@ impl App {
} }
} }
fn view_banner(&self) -> Html {
if !self.is_admin() {
html!{}
} else {
html!{
<>
<div>
<NavButton
classes="btn btn-primary"
route=AppRoute::ListUsers>
{"Users"}
</NavButton>
</div>
<div>
<NavButton
classes="btn btn-primary"
route=AppRoute::ListGroups>
{"Groups"}
</NavButton>
</div>
</>
}
}
}
fn is_admin(&self) -> bool { fn is_admin(&self) -> bool {
match &self.user_info { match &self.user_info {
None => false, None => false,