pub struct SidebarComponentProps {
pub is_open: bool,
pub on_close: Callback<()>,
}Expand description
The main sidebar component of the application.
This component dynamically renders its content based on the user’s authentication
and administrative status. It fetches the current user’s details via /api/users/current
to determine what menu items to display.
§Mobile Support
On small screens:
- Slides into view from the left when
props.is_openistrue. - Renders a close button (
✕) in the header that emitsprops.on_close.
§Structure
- Wraps its content in a
SidebarStateProviderto allow nested menus to manage their state. - Contains a navigation (
<nav>) element with an unordered list (<ul>) of menu items.
§Conditional Rendering
- Loading: Displays “Loading…” while fetching user data.
- Non-Admin User: Renders a condensed sidebar including:
TicketMenu: For managing tickets.- A “Logout” button.
- Admin User: Renders a full sidebar including:
TicketMenu: For managing tickets.UsersMenu: For managing user accounts.- A direct link to
crate::Route::Diagnostics(Statistiken). - A “Logout” button.
§Logout Functionality
The “Logout” button sends a GET request to /api/logout, clears the user’s session,
and then redirects the user to the login page (crate::Route::Login).
Properties for the Sidebar component.
These properties enable managing and controlling the responsive mobile sidebar layout and its visibility settings.
Fields§
§is_open: boolA boolean flag indicating whether the mobile sidebar is currently slid open (true) or hidden (false).
on_close: Callback<()>A callback emitted when the user requests to close/hide the mobile sidebar.
Trait Implementations§
Source§impl PartialEq for SidebarComponentProps
impl PartialEq for SidebarComponentProps
Source§impl Properties for SidebarComponentProps
impl Properties for SidebarComponentProps
impl StructuralPartialEq for SidebarComponentProps
Auto Trait Implementations§
impl Freeze for SidebarComponentProps
impl !RefUnwindSafe for SidebarComponentProps
impl !Send for SidebarComponentProps
impl !Sync for SidebarComponentProps
impl Unpin for SidebarComponentProps
impl !UnwindSafe for SidebarComponentProps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self to a value of a Properties struct.§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self to a value of a Properties struct.