diff --git a/frontend/src/pages/basic_pages.rs b/frontend/src/pages/basic_pages.rs index 1c02cde..9530436 100644 --- a/frontend/src/pages/basic_pages.rs +++ b/frontend/src/pages/basic_pages.rs @@ -3,6 +3,7 @@ use wasm_bindgen_futures::spawn_local; use yew::prelude::*; use yew_router::prelude::*; +/// A macro for dequoting a Json value returned from the backend #[macro_export] macro_rules! dequote { ($str:expr) => { diff --git a/frontend/src/pages/utilities.rs b/frontend/src/pages/utilities.rs index 1208c29..c619fad 100644 --- a/frontend/src/pages/utilities.rs +++ b/frontend/src/pages/utilities.rs @@ -9,6 +9,12 @@ use yew::prelude::*; use crate::dequote; 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. /// /// This struct is used to efficiently retrieve and process ticket data for diagnostics @@ -17,10 +23,6 @@ use crate::pages::ticket::{ActiveUser, Ticket}; /// # Fields /// - `date`: The creation date and time of the ticket in UTC. /// - `room`: The room number associated with the ticket. -#[derive(Deserialize)] -struct CountResponse { - value: i64, -} #[derive(Debug, Deserialize, Clone, PartialEq)] struct TicketPartial { @@ -29,6 +31,14 @@ struct TicketPartial { 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)] struct UserPartial { id: i16, @@ -471,7 +481,7 @@ pub fn submit_stats_component() -> Html { /// 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 /// 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! { +/// +/// } +/// ``` #[component(EasyFixCount)] fn easy_fix_component() -> Html { let count = use_state(|| 0);