@@ -14,53 +14,46 @@ struct StatusTabs: View {
1414
1515 @EnvironmentObject var bleManager : BLEManager
1616 @State var trueIfHeart = true
17-
17+ @State var trueIfBat = false
18+ @Environment ( \. colorScheme) var colorScheme
19+
1820 var body : some View {
1921 VStack {
20- if !bleManager. isConnectedToPinetime {
21- Text ( " Disconnected " )
22- . foregroundColor ( Color . white)
22+ HStack {
23+ Button ( action: {
24+ self . trueIfHeart = true
25+ self . trueIfBat = false
26+ } ) {
27+ ( Text ( Image ( systemName: " heart " ) )
28+ . foregroundColor ( Color . pink) +
29+ Text( " : " + String( format: " %.0f " , bleManager. heartBPM) )
30+ . foregroundColor ( Color . white) )
31+ . frame ( maxWidth: . infinity, alignment: . center)
32+ . padding ( )
33+ . background ( colorScheme == . dark ? ( trueIfHeart ? Color . darkGray : Color . darkestGray) : ( trueIfHeart ? Color . gray : Color . lightGray) )
34+ . cornerRadius ( 5 )
35+ . font ( . title)
36+ } . padding ( . leading, 10 )
37+ Button ( action: {
38+ self . trueIfHeart = false
39+ self . trueIfBat = true
40+ } ) {
41+ ( Text ( Image ( systemName: " battery.100 " ) )
42+ . foregroundColor ( Color . green) +
43+ Text( " : " + String( format: " %.0f " , bleManager. batteryLevel) )
44+ . foregroundColor ( Color . white) )
2345 . frame ( maxWidth: . infinity, alignment: . center)
2446 . padding ( )
25- . background ( Color . darkGray)
47+ . background ( colorScheme == . dark ? ( trueIfBat ? Color . darkGray : Color . darkestGray ) : ( trueIfBat ? Color . gray : Color . lightGray ) )
2648 . cornerRadius ( 5 )
2749 . font ( . title)
28- . padding ( . horizontal, 10 )
29- } else {
30- HStack {
31- Button ( action: {
32- self . trueIfHeart = true
33- } ) {
34- ( Text ( Image ( systemName: " heart " ) )
35- . foregroundColor ( Color . pink) +
36- Text( " : " + String( format: " %.0f " , bleManager. heartBPM) )
37- . foregroundColor ( Color . white) )
38- . frame ( maxWidth: . infinity, alignment: . center)
39- . padding ( )
40- . background ( trueIfHeart ? Color . darkGray : Color . darkestGray)
41- . cornerRadius ( 5 )
42- . font ( . title)
43- } . padding ( . leading, 10 )
44- Button ( action: {
45- self . trueIfHeart = false
46- } ) {
47- ( Text ( Image ( systemName: " battery.100 " ) )
48- . foregroundColor ( Color . green) +
49- Text( " : " + String( format: " %.0f " , bleManager. batteryLevel) )
50- . foregroundColor ( Color . white) )
51- . frame ( maxWidth: . infinity, alignment: . center)
52- . padding ( )
53- . background ( trueIfHeart ? Color . darkestGray : Color . darkGray)
54- . cornerRadius ( 5 )
55- . font ( . title)
56- }
57- . padding ( . trailing, 10 )
58- }
59- if trueIfHeart {
60- HeartChart ( )
61- } else {
62- BatteryChart ( )
6350 }
51+ . padding ( . trailing, 10 )
52+ }
53+ if trueIfHeart {
54+ HeartChart ( )
55+ } else {
56+ BatteryChart ( )
6457 }
6558 }
6659 }
0 commit comments