Add end of service notifications (#30982)

Release Notes:

- N/A

---------

Co-authored-by: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-authored-by: Marshall Bowers <git@maxdeviant.com>
This commit is contained in:
Mikayla Maki 2025-05-20 02:20:00 +02:00 committed by GitHub
parent c747a57b7e
commit 315321bf8c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 327 additions and 201 deletions

View file

@ -13,6 +13,7 @@ pub struct ProgressBar {
value: f32,
max_value: f32,
bg_color: Hsla,
over_color: Hsla,
fg_color: Hsla,
}
@ -23,6 +24,7 @@ impl ProgressBar {
value,
max_value,
bg_color: cx.theme().colors().background,
over_color: cx.theme().status().error,
fg_color: cx.theme().status().info,
}
}
@ -50,6 +52,12 @@ impl ProgressBar {
self.fg_color = color;
self
}
/// Sets the over limit color of the progress bar.
pub fn over_color(mut self, color: Hsla) -> Self {
self.over_color = color;
self
}
}
impl RenderOnce for ProgressBar {
@ -74,7 +82,8 @@ impl RenderOnce for ProgressBar {
div()
.h_full()
.rounded_full()
.bg(self.fg_color)
.when(self.value > self.max_value, |div| div.bg(self.over_color))
.when(self.value <= self.max_value, |div| div.bg(self.fg_color))
.w(relative(fill_width)),
)
}