Skip to content

Commit e1f42f1

Browse files
committed
Fix missing scope details in status page
1 parent 8d5929f commit e1f42f1

1 file changed

Lines changed: 34 additions & 28 deletions

File tree

src/gui.rs

Lines changed: 34 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -902,20 +902,19 @@ impl AcceleratorApp {
902902
.color(egui::Color32::from_rgb(243, 179, 74)),
903903
);
904904
ui.add_space(4.0);
905-
ui.horizontal_wrapped(|ui| {
906-
compact_metric(ui, "域名", &self.config.proxy_domains.len().to_string());
907-
compact_metric(ui, "DoH", &self.config.doh_endpoints.len().to_string());
908-
compact_metric(
909-
ui,
910-
"证书",
911-
&self.config.certificate_domains.len().to_string(),
912-
);
905+
let hosts_count = self.config.hosts_domains().len().to_string();
906+
let doh_count = self.config.doh_endpoints.len().to_string();
907+
let cert_count = self.config.certificate_domains.len().to_string();
908+
ui.columns(3, |columns| {
909+
scope_metric_card(&mut columns[0], "域名", &hosts_count);
910+
scope_metric_card(&mut columns[1], "DoH", &doh_count);
911+
scope_metric_card(&mut columns[2], "证书", &cert_count);
913912
});
914913
ui.add_space(6.0);
915-
compact_row(ui, "上游", &self.config.upstream);
916-
compact_row(
914+
detail_value_row(ui, "上游", &self.config.upstream);
915+
detail_value_row(
917916
ui,
918-
"DoH",
917+
"DoH 端点",
919918
&self
920919
.config
921920
.doh_endpoints
@@ -1895,23 +1894,30 @@ fn compact_metric(ui: &mut egui::Ui, label: &str, value: &str) {
18951894
});
18961895
}
18971896

1898-
fn compact_row(ui: &mut egui::Ui, label: &str, value: &str) {
1899-
ui.horizontal(|ui| {
1900-
ui.add_sized(
1901-
[42.0, 18.0],
1902-
egui::Label::new(
1903-
RichText::new(label)
1904-
.font(FontId::proportional(10.5))
1905-
.strong()
1906-
.color(egui::Color32::from_rgb(185, 191, 197)),
1907-
),
1908-
);
1909-
ui.label(
1910-
RichText::new(value)
1911-
.font(FontId::monospace(10.5))
1912-
.color(egui::Color32::from_rgb(224, 227, 230)),
1913-
);
1914-
});
1897+
fn scope_metric_card(ui: &mut egui::Ui, label: &str, value: &str) {
1898+
egui::Frame::new()
1899+
.fill(egui::Color32::from_rgb(19, 22, 27))
1900+
.stroke(egui::Stroke::new(1.0, egui::Color32::from_rgb(46, 52, 60)))
1901+
.inner_margin(egui::Margin::symmetric(10, 10))
1902+
.corner_radius(egui::CornerRadius::same(8))
1903+
.show(ui, |ui| {
1904+
ui.set_min_size(egui::vec2(0.0, 64.0));
1905+
ui.vertical_centered(|ui| {
1906+
ui.label(
1907+
RichText::new(label)
1908+
.font(FontId::proportional(10.2))
1909+
.strong()
1910+
.color(egui::Color32::from_rgb(160, 171, 179)),
1911+
);
1912+
ui.add_space(3.0);
1913+
ui.label(
1914+
RichText::new(value)
1915+
.font(FontId::proportional(18.0))
1916+
.strong()
1917+
.color(egui::Color32::from_rgb(243, 179, 74)),
1918+
);
1919+
});
1920+
});
19151921
}
19161922

19171923
fn detail_value_row(ui: &mut egui::Ui, label: &str, value: &str) {

0 commit comments

Comments
 (0)