Skip to content

Commit

Permalink
add visual indication when stats are unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
DAcodedBEAT committed Jul 15, 2023
1 parent 9aecf5c commit 8aa6b0d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions App/Views/Lists/StatisticsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ struct StatisticsView: View {
Spacer()

ForEach(Config.chartLevels, id: \.days) { level in
let levelDisabled = level.days > glucoseStatistics.maxDays

Spacer()
Button(
action: {
Expand All @@ -71,16 +73,19 @@ struct StatisticsView: View {
.if(isSelectedChartLevel(days: level.days)) {
$0.fill(Color.ui.label)
} else: {
$0.stroke(Color.ui.label)
$0.stroke(levelDisabled ? Color.ui.gray : Color.ui.label )
}
.frame(width: 12, height: 12)

Text(verbatim: level.name)
.if(levelDisabled) {
$0.strikethrough()
}
.font(.subheadline)
.foregroundColor(Color.ui.label)
.foregroundColor(levelDisabled ? Color.ui.gray : Color.ui.label)
}
)
.disabled(level.days > glucoseStatistics.maxDays)
.disabled(levelDisabled)
.lineLimit(1)
.buttonStyle(.plain)
}
Expand Down

0 comments on commit 8aa6b0d

Please sign in to comment.