SidebarComponentProps

Struct SidebarComponentProps 

Source
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_open is true.
  • Renders a close button () in the header that emits props.on_close.

§Structure

  • Wraps its content in a SidebarStateProvider to 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:

§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: bool

A 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

Source§

fn eq(&self, other: &SidebarComponentProps) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Properties for SidebarComponentProps

Source§

type Builder = SidebarComponentPropsBuilder

Builder that will be used to construct properties
Source§

fn builder() -> Self::Builder

Entrypoint for building properties
Source§

impl StructuralPartialEq for SidebarComponentProps

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoPropValue<Option<T>> for T

§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
§

impl<T> IntoPropValue<T> for T

§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

§

impl<T> HasAllProps<(), T> for T