@@ -78,7 +78,7 @@ struct StepChartView: View {
7878 y: . value( " Steps " , $0. steps)
7979 )
8080 . foregroundStyle ( . blue)
81- . opacity ( !showSelectionBar || selectedDate. formatted ( . dateTime . dayOfYear ( ) ) == $0. date. formatted ( . dateTime . dayOfYear ( ) ) ? 1 : 0.5 )
81+ . opacity ( !showSelectionBar || selectedDate. comparable ( ) == $0. date. comparable ( ) ? 1 : 0.5 )
8282 }
8383 }
8484 . chartOverlay { proxy in
@@ -103,7 +103,7 @@ struct StepChartView: View {
103103
104104 let ( day, _) = proxy. value ( at: location, as: ( Date, Int) . self) ?? ( Date ( ) , 0 )
105105 // We compare the formatted dates because the dates are too specific otherwise
106- let steps = weekSteps ( ) . first ( where: { $0. date. formatted ( . dateTime . dayOfYear ( ) ) == day. formatted ( . dateTime . dayOfYear ( ) ) } ) ? . steps ?? 0
106+ let steps = weekSteps ( ) . first ( where: { $0. date. comparable ( ) == day. comparable ( ) } ) ? . steps ?? 0
107107
108108 selectedDate = day
109109 selectedSteps = steps
@@ -128,11 +128,11 @@ struct StepChartView: View {
128128 if showSelectionBar {
129129 return " \( selectedSteps) "
130130 } else if !weekSteps( ) . isEmpty {
131- return " \( weekSteps ( ) . reduce ( 0 ) { $0 + $1. steps } ) "
131+ return " \( weekSteps ( ) . reduce ( 0 ) { $0 + $1. steps } / weekSteps ( ) . count ) "
132132 }
133133 return " 0 "
134134 } ( ) )
135- . font ( . system( . title , design : . rounded ) )
135+ . font ( . system( size : 28 ) )
136136 . foregroundColor ( . primary)
137137 + Text( " steps " )
138138 Text ( showSelectionBar ? " \( selectedDate. formatted ( date: . abbreviated, time: . omitted) ) " : " \( earliestDate. formatted ( date: . abbreviated, time: . omitted) ) - \( latestDate. formatted ( date: . abbreviated, time: . omitted) ) " )
@@ -149,17 +149,23 @@ struct StepChartView: View {
149149 if ( stepCountManager. stepGoal - bleManager. stepCount) <= 1000 {
150150 return " Take a short walk or a start an activity to complete your goal. "
151151 }
152- return " Set aside some time to complete a few activities to reach your goal."
152+ return " Complete a few activities to reach your goal."
153153 } ( )
154154
155- Text ( " Your daily step goal is \( stepCountManager. stepGoal - bleManager. stepCount) steps away. \( encouragementString) " )
155+ Text ( " You're \( stepCountManager. stepGoal - bleManager. stepCount) steps away your daily step goal! \( encouragementString) " )
156156 }
157157 }
158+ // TODO: move to separate component
158159 Section {
159160 // TODO: add a monthly overview chart
160161 } header: {
161- Text ( " Monthly Overview • \( earliestDate. formatted ( date: . abbreviated, time: . omitted) ) - \( latestDate. formatted ( date: . abbreviated, time: . omitted) ) " )
162- . fontWeight ( . semibold)
162+ VStack ( alignment: . leading, spacing: 7 ) {
163+ Text ( " Monthly Overview " )
164+ Text ( " \( earliestDate. formatted ( . dateTime. month ( . abbreviated) . day ( ) ) ) - \( latestDate. formatted ( date: . abbreviated, time: . omitted) ) " )
165+ . font ( . system( size: 20 ) )
166+ . foregroundColor ( . primary)
167+ }
168+ . fontWeight ( . semibold)
163169 }
164170 . listRowBackground ( Color . clear)
165171 . listRowInsets ( EdgeInsets ( top: 18 , leading: 0 , bottom: 0 , trailing: 0 ) )
0 commit comments