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