better overview design in dark mode
This commit is contained in:
@@ -310,7 +310,7 @@ struct SystemOverviewView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||
.fill(Color(.systemBackground))
|
||||
.fill(Color(.tertiarySystemBackground))
|
||||
)
|
||||
} else {
|
||||
Button {
|
||||
@@ -386,7 +386,7 @@ struct SystemOverviewView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||
.fill(Color(.systemBackground))
|
||||
.fill(Color(.tertiarySystemBackground))
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -477,7 +477,7 @@ struct SystemOverviewView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||
.fill(Color(.systemBackground))
|
||||
.fill(Color(.tertiarySystemBackground))
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -560,7 +560,7 @@ struct SystemOverviewView: View {
|
||||
.frame(maxWidth: .infinity, alignment: .leading)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 20, style: .continuous)
|
||||
.fill(Color(.systemBackground))
|
||||
.fill(Color(.tertiarySystemBackground))
|
||||
)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
@@ -743,21 +743,47 @@ struct SystemOverviewView: View {
|
||||
}
|
||||
|
||||
private var completedBOMItemCount: Int {
|
||||
settledLoads.reduce(0) { result, load in
|
||||
let loadCount = settledLoads.reduce(0) { result, load in
|
||||
let uniqueItems = Set(load.bomCompletedItemIDs)
|
||||
let cappedCount = min(uniqueItems.count, Self.bomItemsPerLoad)
|
||||
return result + cappedCount
|
||||
}
|
||||
|
||||
let batteryCount = settledBatteries.reduce(0) { result, battery in
|
||||
let uniqueItems = Set(battery.bomCompletedItemIDs)
|
||||
let cappedCount = min(uniqueItems.count, Self.bomItemsPerBattery)
|
||||
return result + cappedCount
|
||||
}
|
||||
|
||||
let chargerCount = settledChargers.reduce(0) { result, charger in
|
||||
let uniqueItems = Set(charger.bomCompletedItemIDs)
|
||||
let cappedCount = min(uniqueItems.count, Self.bomItemsPerCharger)
|
||||
return result + cappedCount
|
||||
}
|
||||
|
||||
return loadCount + batteryCount + chargerCount
|
||||
}
|
||||
|
||||
private var bomItemsCount: Int {
|
||||
settledLoads.isEmpty ? 0 : settledLoads.count * Self.bomItemsPerLoad
|
||||
let loadItems = settledLoads.count * Self.bomItemsPerLoad
|
||||
let batteryItems = settledBatteries.count * Self.bomItemsPerBattery
|
||||
let chargerItems = settledChargers.count * Self.bomItemsPerCharger
|
||||
let total = loadItems + batteryItems + chargerItems
|
||||
return total
|
||||
}
|
||||
|
||||
private var settledLoads: [SavedLoad] {
|
||||
loads.filter { $0.crossSection > 0 && $0.length > 0 }
|
||||
}
|
||||
|
||||
private var settledBatteries: [SavedBattery] {
|
||||
batteries.filter { $0.system == system }
|
||||
}
|
||||
|
||||
private var settledChargers: [SavedCharger] {
|
||||
chargers.filter { $0.system == system }
|
||||
}
|
||||
|
||||
private func progressBar(progress: CGFloat?, tint: Color) -> some View {
|
||||
RoundedRectangle(cornerRadius: 3, style: .continuous)
|
||||
.fill(Color(.tertiarySystemFill))
|
||||
@@ -1350,6 +1376,8 @@ struct SystemOverviewView: View {
|
||||
private static let fallbackGoalHours: Double = 4
|
||||
|
||||
private static let bomItemsPerLoad = 5
|
||||
private static let bomItemsPerBattery = 1
|
||||
private static let bomItemsPerCharger = 1
|
||||
|
||||
private enum BatteryWarning {
|
||||
case voltage(count: Int)
|
||||
|
||||
Reference in New Issue
Block a user