Sidebar fix

Styles now actually get applied and sidebar doesn't block content
Also the login page doesn't have a sidebar now
This commit is contained in:
2026-05-02 19:09:41 +02:00
parent 4a3d432e9a
commit 931bd27c65
6 changed files with 64 additions and 10 deletions

View File

@@ -32,49 +32,82 @@ enum Route {
NotFound,
}
#[derive(Properties, PartialEq)]
pub struct SidebarShellProps {
pub children: Children,
}
#[component(SidebarShell)]
fn sidebar_shell(props: &SidebarShellProps) -> Html {
html! {
<div class="layout">
<sidebar::Sidebar/>
<main class="content">
{ for props.children.iter() }
</main>
</div>
}
}
fn switch(route: Route) -> Html {
match route {
Route::Home => html! {
<ProtectedRoute admin_page={false}>
<basic_pages::Home/>
<SidebarShell>
<basic_pages::Home/>
</SidebarShell>
</ProtectedRoute>
},
Route::NotFound => html! { <basic_pages::NotFound/> },
Route::Ticket => html! {
<ProtectedRoute admin_page={false}>
<ticket::SubmitTicket/>
<SidebarShell>
<ticket::SubmitTicket/>
</SidebarShell>
</ProtectedRoute>
},
Route::TicketById { id } => html! {
<ProtectedRoute admin_page={true}>
<ticket::TicketByID {id}/>
<SidebarShell>
<ticket::TicketByID {id}/>
</SidebarShell>
</ProtectedRoute>
},
Route::AllTickets => html! {
<ProtectedRoute admin_page={false}>
<ticket::AllTickets/>
<SidebarShell>
<ticket::AllTickets/>
</SidebarShell>
</ProtectedRoute>
},
Route::Register => html! {
<ProtectedRoute admin_page={true}>
<user::Register/>
<SidebarShell>
<user::Register/>
</SidebarShell>
</ProtectedRoute>
},
Route::Login => html! { <user::Login/> },
Route::AllUsers => html! {
<ProtectedRoute admin_page={true}>
<user::AllUsers/>
<SidebarShell>
<user::AllUsers/>
</SidebarShell>
</ProtectedRoute>
},
Route::UserByID { id } => html! {
<ProtectedRoute admin_page={true}>
<user::UserByID {id}/>
<SidebarShell>
<user::UserByID {id}/>
</SidebarShell>
</ProtectedRoute>
},
Route::PermissionDenied => html! { <basic_pages::PermissionDenied/> },
Route::Diagnostics => html! {
<ProtectedRoute admin_page={true}>
<utilities::Diagnostics/>
<SidebarShell>
<utilities::Diagnostics/>
</SidebarShell>
</ProtectedRoute>
},
}
@@ -84,7 +117,6 @@ fn switch(route: Route) -> Html {
pub fn app() -> Html {
html! {
<BrowserRouter>
<sidebar::Sidebar/>
<Switch<Route> render={switch} />
</BrowserRouter>
}