refactor: ProgressButton

This commit is contained in:
mrFq1
2023-05-23 23:19:29 +08:00
parent 088fc47329
commit 0a6ff05168
6 changed files with 115 additions and 87 deletions
@@ -82,24 +82,13 @@ struct ProxyGroupView: View {
Spacer()
Button() {
startBenchmark()
} label: {
HStack {
if isTesting {
ProgressView()
.controlSize(.small)
.frame(width: 12)
} else {
Image(systemName: "bolt.fill")
.frame(width: 12)
}
Text(isTesting ? "Testing" : (proxyGroup.type == .urltest ? "Retest" : "Benchmark"))
.frame(width: 70)
ProgressButton(
title: proxyGroup.type == .urltest ? "Retest" : "Benchmark",
title2: "Testing",
iconName: "bolt.fill",
inProgress: $isTesting) {
startBenchmark()
}
.foregroundColor(isTesting ? .gray : .blue)
}
.disabled(isTesting)
}
}