diff --git a/frontend/src/pages/utilities.rs b/frontend/src/pages/utilities.rs index 8e1a155..af5790c 100644 --- a/frontend/src/pages/utilities.rs +++ b/frontend/src/pages/utilities.rs @@ -254,7 +254,7 @@ pub fn submit_stats_component() -> Html { .unwrap_or((0, ())); html! { -
+
if *loading {

{ "Loading..." }

} @@ -262,17 +262,32 @@ pub fn submit_stats_component() -> Html {

{ e.clone() }

}

{ "Tickets per weekday" }

- +
+
+ { for (0..7).map(|i| { + let is_max = i == max_idx; + let max_value = counts.iter().cloned().max().unwrap_or(1).max(1); + let bar_height_percent = if max_value > 0 { (avg[i] / max_value as f64) * 100.0 } else { 0.0 }; + let bar_height_px = (bar_height_percent * 200.0 / 100.0) as i32; + html! { +
+
+
+
+ } + })} +
+
+ { for (0..7).map(|i| { + html! { +
+
{ weekdays[i] }
+
{ format!("{:.1}", avg[i]) }
+
+ } + })} +
+
} @@ -288,15 +303,29 @@ fn room_total_component(props: &RoomTotalsProps) -> Html { let mut totals_vec: Vec<(i16, usize)> = totals.into_iter().collect(); totals_vec.sort_by(|a, b| b.1.cmp(&a.1)); + let max_count = totals_vec.iter().map(|(_, c)| *c).max().unwrap_or(1).max(1); + html! { -
+

{ "Tickets pro Raum" }

-
    +
    { for totals_vec.into_iter().map(|(room, count)| { let label = parse_room(room); - html! {
  • { format!("{}: {}", label, count) }
  • } + let bar_width_percent = (count as f64 / max_count as f64) * 100.0; + html! { +
    +
    + { label } + { count } +
    +
    +
    +
    +
    +
    + } }) } -
+
} } diff --git a/frontend/src/styles/components/_diagnostics.scss b/frontend/src/styles/components/_diagnostics.scss new file mode 100644 index 0000000..ec73468 --- /dev/null +++ b/frontend/src/styles/components/_diagnostics.scss @@ -0,0 +1,137 @@ +@use "../mixins" as *; +@use "../variables" as *; + +.diagnostics-container { + display: flex; + flex-direction: column; + gap: $spacing-md; +} + +.diagnostics-section { + background-color: $color-bg; + border-radius: $border-radius; + padding: $spacing-md; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); + + h3 { + margin: 0 0 $spacing-md 0; + color: #1f2937; + font-size: 1.1rem; + font-weight: 600; + } +} + +.weekday-chart { + display: flex; + flex-direction: column; + gap: 12px; + border: 1px solid #e5e7eb; + border-radius: $border-radius; + background-color: #f9fafb; +} + +.weekday-bars { + display: flex; + gap: 12px; + align-items: flex-end; + height: 205px; + padding: $spacing-md; + overflow-x: auto; + padding-bottom: 0px; +} + +.weekday-bar { + display: flex; + flex-direction: column; + align-items: center; + flex: 1; + min-width: 60px; + height: 100%; + + .bar { + width: 100%; + background-color: $color-accent; + border-radius: 4px 4px 0 0; + transition: background-color 0.2s ease; + + &.max { + background-color: #10b981; + } + } +} + +.weekday-labels { + display: flex; + gap: 12px; + padding: $spacing-md; + padding-top: 0; + overflow-x: auto; + + .label-item { + flex: 1; + min-width: 60px; + text-align: center; + white-space: nowrap; + + .day { + font-weight: 600; + font-size: 12px; + color: #1f2937; + margin-bottom: 2px; + } + + .value { + font-size: 11px; + color: $color-muted; + } + } +} + +.room-chart { + display: flex; + flex-direction: column; + gap: 12px; + padding: $spacing-md; + border: 1px solid #e5e7eb; + border-radius: $border-radius; + background-color: #f9fafb; +} + +.room-bar-item { + display: flex; + flex-direction: column; + gap: 4px; + + .room-header { + display: flex; + justify-content: space-between; + align-items: center; + + .room-label { + font-weight: 600; + font-size: 14px; + color: #1f2937; + min-width: 50px; + } + + .room-count { + font-size: 12px; + color: $color-muted; + font-weight: 500; + } + } + + .room-bar-container { + width: 100%; + height: 24px; + background-color: #e5e7eb; + border-radius: 4px; + overflow: hidden; + + .room-bar { + height: 100%; + background-color: #f97316; + transition: width 0.3s ease; + } + } +} diff --git a/frontend/src/styles/main.scss b/frontend/src/styles/main.scss index 601272a..a8d7160 100644 --- a/frontend/src/styles/main.scss +++ b/frontend/src/styles/main.scss @@ -3,6 +3,7 @@ @use "utilities"; @use "components/sidebar"; @use "components/tickets"; +@use "components/diagnostics"; body { background: variables.$color-bg;