Skip to content

Commit 088f0a3

Browse files
authored
Fixed Teagle capacities bug on gym detail view (#93)
* Fix teagle up/down capacity * Edit bug fix * Remove unused code
1 parent 25dd3da commit 088f0a3

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

Uplift/Views/Supporting/CapacitySemiCircleView.swift

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,26 @@ struct CapacitySemiCircleView: View {
1919
let status: CapacityStatus?
2020
let timeUpdated: Date?
2121

22-
@State private var color: Color = Constants.Colors.open
23-
@State private var progress: Double = 0.0
22+
private var color: Color {
23+
switch status {
24+
case .notBusy:
25+
return Constants.Colors.open
26+
case .slightlyBusy:
27+
return Constants.Colors.orange
28+
case .veryBusy:
29+
return Constants.Colors.red
30+
default:
31+
return Constants.Colors.open
32+
}
33+
}
34+
private var progress: Double {
35+
switch status {
36+
case .notBusy(let double), .slightlyBusy(let double), .veryBusy(let double):
37+
return double
38+
default:
39+
return 0
40+
}
41+
}
2442

2543
// MARK: - UI
2644

@@ -93,21 +111,6 @@ struct CapacitySemiCircleView: View {
93111
}
94112
}
95113
.padding(lineWidth / 2)
96-
.onAppear {
97-
switch status {
98-
case .notBusy(let double):
99-
color = Constants.Colors.open
100-
progress = double
101-
case .slightlyBusy(let double):
102-
color = Constants.Colors.orange
103-
progress = double
104-
case .veryBusy(let double):
105-
color = Constants.Colors.red
106-
progress = double
107-
case nil:
108-
break
109-
}
110-
}
111114
}
112115

113116
}

0 commit comments

Comments
 (0)