Docs.rs comments
Comments for generating the docs with cargo doc
This commit is contained in:
@@ -3,6 +3,23 @@ use wasm_bindgen_futures::spawn_local;
|
||||
use yew::prelude::*;
|
||||
use yew_router::prelude::*;
|
||||
|
||||
/// The main home page component of the application.
|
||||
///
|
||||
/// This component displays different content based on whether the logged-in user
|
||||
/// is an administrator. It fetches the user's admin status from the
|
||||
/// `/api/users/current` endpoint upon initialization.
|
||||
///
|
||||
/// # Behavior
|
||||
/// - **Loading**: Displays "Loading..." while fetching user data.
|
||||
/// - **Admin User**: Renders the `TicketCount` utility component.
|
||||
/// - **Non-Admin User**: Renders the `TicketCount` utility component.
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
/// html! {
|
||||
/// <Home />
|
||||
/// }
|
||||
/// ```
|
||||
#[component(Home)]
|
||||
pub fn home_component() -> Html {
|
||||
let is_admin = use_state(|| None::<bool>);
|
||||
@@ -44,6 +61,17 @@ pub fn home_component() -> Html {
|
||||
}
|
||||
}
|
||||
|
||||
/// A basic component displayed when a requested route does not match any defined paths (404 error).
|
||||
///
|
||||
/// It provides a simple message indicating that the page was not found and includes
|
||||
/// a link to navigate back to the home page.
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
/// html! {
|
||||
/// <NotFound />
|
||||
/// }
|
||||
/// ```
|
||||
#[component(NotFound)]
|
||||
pub fn not_found_component() -> Html {
|
||||
let message = "404 Not found";
|
||||
@@ -55,6 +83,18 @@ pub fn not_found_component() -> Html {
|
||||
}
|
||||
}
|
||||
|
||||
/// A component displayed when a user attempts to access a page for which they do not have sufficient permissions.
|
||||
///
|
||||
/// It informs the user about the access restriction and provides instructions to contact
|
||||
/// a specific person ("Herr Winter") if they believe this is an error.
|
||||
/// It also includes a link to return to the home page.
|
||||
///
|
||||
/// # Example
|
||||
/// ```rust
|
||||
/// html! {
|
||||
/// <PermissionDenied />
|
||||
/// }
|
||||
/// ```
|
||||
#[component(PermissionDenied)]
|
||||
pub fn denied_component() -> Html {
|
||||
html! {
|
||||
|
||||
Reference in New Issue
Block a user