Fix nag timeout dropdown

Fix up circle text view
This commit is contained in:
Garth Vander Houwen 2024-05-31 20:25:37 -07:00
parent 3911703f81
commit 7341d0b32a
4 changed files with 38 additions and 13 deletions

View file

@ -7,6 +7,40 @@
import Foundation
enum NagIntervals: Int, CaseIterable, Identifiable {
case unset = 0
case oneSecond = 1
case fiveSeconds = 5
case tenSeconds = 10
case fifteenSeconds = 15
case thirtySeconds = 30
case oneMinute = 60
case fiveMinutes = 300
var id: Int { self.rawValue }
var description: String {
switch self {
case .unset:
return "unset".localized
case .oneSecond:
return "interval.one.second".localized
case .fiveSeconds:
return "interval.five.seconds".localized
case .tenSeconds:
return "interval.ten.seconds".localized
case .fifteenSeconds:
return "interval.fifteen.seconds".localized
case .thirtySeconds:
return "interval.thirty.seconds".localized
case .oneMinute:
return "interval.one.minute".localized
case .fiveMinutes:
return "interval.five.minutes".localized
}
}
}
enum OutputIntervals: Int, CaseIterable, Identifiable {
case unset = 0

View file

@ -16,20 +16,11 @@ struct CircleText: View {
Circle()
.fill(color)
.frame(width: circleSize, height: circleSize)
#if os(macOS)
Text(text)
.frame(width: circleSize * 0.95, height: circleSize * 0.95, alignment: .center)
.frame(width: circleSize * 0.9, height: circleSize * 0.9, alignment: .center)
.foregroundColor(color.isLight() ? .black : .white)
.font(.system(size: 3000))
.font(.system(size: 1500))
.minimumScaleFactor(0.001)
#else
Text(text)
.frame(width: circleSize * 0.95, height: circleSize * 0.95, alignment: .center)
.foregroundColor(color.isLight() ? .black : .white)
.font(.system(size: 5000))
.minimumScaleFactor(0.001)
#endif
}
.aspectRatio(1, contentMode: .fit)
}

View file

@ -25,7 +25,7 @@ struct NodeInfoItem: View {
}
if node.user != nil {
Divider()
VStack {
VStack (alignment: .center) {
if node.user?.hwModel != "UNSET" {
Image(node.user!.hwModel ?? "unset".localized)
.resizable()

View file

@ -102,7 +102,7 @@ struct ExternalNotificationConfig: View {
.listRowSeparator(.visible)
Picker("Nag timeout", selection: $nagTimeout ) {
ForEach(OutputIntervals.allCases) { oi in
ForEach(NagIntervals.allCases) { oi in
Text(oi.description)
}
}