Diagnosics styling
It looks nice now
This commit is contained in:
@@ -254,7 +254,7 @@ pub fn submit_stats_component() -> Html {
|
||||
.unwrap_or((0, ()));
|
||||
|
||||
html! {
|
||||
<div>
|
||||
<div class="diagnostics-section">
|
||||
if *loading {
|
||||
<p>{ "Loading..." }</p>
|
||||
}
|
||||
@@ -262,17 +262,32 @@ pub fn submit_stats_component() -> Html {
|
||||
<p style="color: red;">{ e.clone() }</p>
|
||||
}
|
||||
<h3>{ "Tickets per weekday" }</h3>
|
||||
<ul>
|
||||
<div class="weekday-chart">
|
||||
<div class="weekday-bars">
|
||||
{ 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! {
|
||||
<li style={ if is_max { "font-weight: bold; color: green;" } else { "" } }>
|
||||
{ format!("{}: {:3}", weekdays[i], avg[i]) }
|
||||
{ if is_max { html!{ <span>{ " ← most" }</span> } } else { html!{} } }
|
||||
</li>
|
||||
<div class="weekday-bar">
|
||||
<div class={format!("bar{}", if is_max { " max" } else { "" })} style={format!("height: {}px;", bar_height_px)}>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="weekday-labels">
|
||||
{ for (0..7).map(|i| {
|
||||
html! {
|
||||
<div class="label-item">
|
||||
<div class="day">{ weekdays[i] }</div>
|
||||
<div class="value">{ format!("{:.1}", avg[i]) }</div>
|
||||
</div>
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
<RoomTotalTickets tickets={(*tickets).clone()}/>
|
||||
</div>
|
||||
}
|
||||
@@ -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! {
|
||||
<div>
|
||||
<div class="diagnostics-section">
|
||||
<h3>{ "Tickets pro Raum" }</h3>
|
||||
<ul>
|
||||
<div class="room-chart">
|
||||
{ for totals_vec.into_iter().map(|(room, count)| {
|
||||
let label = parse_room(room);
|
||||
html! { <li>{ format!("{}: {}", label, count) }</li> }
|
||||
let bar_width_percent = (count as f64 / max_count as f64) * 100.0;
|
||||
html! {
|
||||
<div class="room-bar-item">
|
||||
<div class="room-header">
|
||||
<span class="room-label">{ label }</span>
|
||||
<span class="room-count">{ count }</span>
|
||||
</div>
|
||||
<div class="room-bar-container">
|
||||
<div class="room-bar" style={format!("width: {}%;", bar_width_percent)}>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}) }
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
||||
137
frontend/src/styles/components/_diagnostics.scss
Normal file
137
frontend/src/styles/components/_diagnostics.scss
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
@use "utilities";
|
||||
@use "components/sidebar";
|
||||
@use "components/tickets";
|
||||
@use "components/diagnostics";
|
||||
|
||||
body {
|
||||
background: variables.$color-bg;
|
||||
|
||||
Reference in New Issue
Block a user