Docs update

This commit is contained in:
2026-05-18 20:18:51 +02:00
parent 3cca849bd2
commit 46ac5a7817
2 changed files with 27 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ use wasm_bindgen_futures::spawn_local;
use yew::prelude::*; use yew::prelude::*;
use yew_router::prelude::*; use yew_router::prelude::*;
/// A macro for dequoting a Json value returned from the backend
#[macro_export] #[macro_export]
macro_rules! dequote { macro_rules! dequote {
($str:expr) => { ($str:expr) => {

View File

@@ -9,6 +9,12 @@ use yew::prelude::*;
use crate::dequote; use crate::dequote;
use crate::pages::ticket::{ActiveUser, Ticket}; use crate::pages::ticket::{ActiveUser, Ticket};
/// The response struct for the [EasyFixCount]
#[derive(Deserialize)]
struct CountResponse {
value: i64,
}
/// A partial representation of a ticket, containing only the fields necessary for statistical analysis. /// A partial representation of a ticket, containing only the fields necessary for statistical analysis.
/// ///
/// This struct is used to efficiently retrieve and process ticket data for diagnostics /// This struct is used to efficiently retrieve and process ticket data for diagnostics
@@ -17,10 +23,6 @@ use crate::pages::ticket::{ActiveUser, Ticket};
/// # Fields /// # Fields
/// - `date`: The creation date and time of the ticket in UTC. /// - `date`: The creation date and time of the ticket in UTC.
/// - `room`: The room number associated with the ticket. /// - `room`: The room number associated with the ticket.
#[derive(Deserialize)]
struct CountResponse {
value: i64,
}
#[derive(Debug, Deserialize, Clone, PartialEq)] #[derive(Debug, Deserialize, Clone, PartialEq)]
struct TicketPartial { struct TicketPartial {
@@ -29,6 +31,14 @@ struct TicketPartial {
user_id: i16, user_id: i16,
} }
/// A partial representation of a user, containing only the fields necessary for statistical analysis.
///
/// This struct is used to retrieve and process user data for diagnostics
///
/// # Fields
/// - `id`: The users id
/// - `first_name`: The users first name
/// - `last_name`: The users last name
#[derive(Debug, Deserialize, Clone, PartialEq)] #[derive(Debug, Deserialize, Clone, PartialEq)]
struct UserPartial { struct UserPartial {
id: i16, id: i16,
@@ -471,7 +481,7 @@ pub fn submit_stats_component() -> Html {
/// A component that displays the total number of tickets per room. /// A component that displays the total number of tickets per room.
/// ///
/// This component takes a list of `TicketPartial` items and calculates the /// This component takes a list of [`TicketPartial`] items and calculates the
/// total number of tickets for each room. It then displays these totals /// total number of tickets for each room. It then displays these totals
/// in a sorted list with a bar chart visualization. /// in a sorted list with a bar chart visualization.
/// ///
@@ -582,6 +592,17 @@ fn user_total_component(props: &UserTotalProps) -> Html {
} }
} }
/// A component for displaying how many problems were solved without creating a ticket
///
/// # Functionality
/// Fetches the value for the count from `/api/count` and parses it into a [`CountResponse`]
///
/// # Example
/// ``` rust
/// html! {
/// <EasyFixCount/>
/// }
/// ```
#[component(EasyFixCount)] #[component(EasyFixCount)]
fn easy_fix_component() -> Html { fn easy_fix_component() -> Html {
let count = use_state(|| 0); let count = use_state(|| 0);