Update progress says what it is: 'Downloading update' / 'Installing update' above the bar
Browse files at this commit7a892d6a2d3bfa5f663fffb41ea5d98e9379ffc9Parent: e541d69- style
- update progress says what it is: 'Downloading update' / 'Installing update' above the bar
3 changed files +20 -13
- crates/client/lang/en/update.txt +2 -2
- crates/client/lang/tr/update.txt +2 -2
- crates/client/src/gui/update_view.rs +16 -9
crates/client/lang/en/update.txtmodified+2 -2
| @@ -2,6 +2,6 @@ update = Update | ||
| 2 | 2 | restart = Restart |
| 3 | 3 | retry = Retry |
| 4 | 4 | required = Update required |
| 5 | -downloading = Downloading | |
| 6 | -installing = Installing | |
| 5 | +downloading = Downloading update | |
| 6 | +installing = Installing update | |
| 7 | 7 | restarting = Restarting |
crates/client/lang/tr/update.txtmodified+2 -2
| @@ -2,6 +2,6 @@ update = Güncelle | ||
| 2 | 2 | restart = Yeniden başlat |
| 3 | 3 | retry = Tekrar dene |
| 4 | 4 | required = Güncelleme gerekli |
| 5 | -downloading = İndiriliyor | |
| 6 | -installing = Kuruluyor | |
| 5 | +downloading = Güncelleme indiriliyor | |
| 6 | +installing = Güncelleme kuruluyor | |
| 7 | 7 | restarting = Yeniden başlatılıyor |
crates/client/src/gui/update_view.rsmodified+16 -9
| @@ -11,6 +11,15 @@ fn percent(fraction: f32) -> String { | ||
| 11 | 11 | format!("{}%", (fraction * 100.) as u32) |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | +fn status(phase: Phase) -> &'static str { | |
| 15 | + match phase { | |
| 16 | + Phase::Downloading { .. } => w().update.downloading, | |
| 17 | + Phase::Installing { .. } => w().update.installing, | |
| 18 | + Phase::Ready(_) => w().update.restarting, | |
| 19 | + _ => "", | |
| 20 | + } | |
| 21 | +} | |
| 22 | + | |
| 14 | 23 | impl Yumush { |
| 15 | 24 | pub(super) fn update_control(&self, palette: Palette) -> Option<AnyElement> { |
| 16 | 25 | if self.update.required() { |
| @@ -27,15 +36,18 @@ impl Yumush { | ||
| 27 | 36 | return Some( |
| 28 | 37 | div() |
| 29 | 38 | .flex() |
| 30 | - .items_center() | |
| 31 | - .gap(px(space::SM)) | |
| 32 | - .child(parts::track(parts::Fill::Part(fraction), false, t).flex_1()) | |
| 39 | + .flex_col() | |
| 40 | + .gap(px(space::XS)) | |
| 33 | 41 | .child( |
| 34 | 42 | div() |
| 43 | + .flex() | |
| 44 | + .justify_between() | |
| 35 | 45 | .text_size(t.text(text::CAPTION)) |
| 36 | 46 | .text_color(palette.muted) |
| 47 | + .child(status(self.update)) | |
| 37 | 48 | .child(percent(fraction)), |
| 38 | 49 | ) |
| 50 | + .child(parts::track(parts::Fill::Part(fraction), false, t)) | |
| 39 | 51 | .into_any_element(), |
| 40 | 52 | ); |
| 41 | 53 | } |
| @@ -60,12 +72,7 @@ impl Yumush { | ||
| 60 | 72 | |
| 61 | 73 | pub(super) fn update_required(&self, palette: Palette) -> impl IntoElement { |
| 62 | 74 | let t = palette.tokens; |
| 63 | - let status = match self.update { | |
| 64 | - Phase::Downloading { .. } => w().update.downloading, | |
| 65 | - Phase::Installing { .. } => w().update.installing, | |
| 66 | - Phase::Ready(_) => w().update.restarting, | |
| 67 | - _ => "", | |
| 68 | - }; | |
| 75 | + let status = status(self.update); | |
| 69 | 76 | let label = match self.update.progress() { |
| 70 | 77 | Some(fraction) => format!("{status} {}", percent(fraction)), |
| 71 | 78 | None => status.to_string(), |