@@ -61,11 +61,9 @@ struct MeterView: View {
|
||
| 61 | 61 |
private var portraitContent: some View {
|
| 62 | 62 |
ScrollView {
|
| 63 | 63 |
VStack(alignment: .leading, spacing: 16) {
|
| 64 |
- connectionCard() |
|
| 64 |
+ connectionCard(showsActions: meter.operationalState == .dataIsAvailable) |
|
| 65 | 65 |
|
| 66 | 66 |
if meter.operationalState == .dataIsAvailable {
|
| 67 |
- actionGrid() |
|
| 68 |
- |
|
| 69 | 67 |
LiveView() |
| 70 | 68 |
.padding(18) |
| 71 | 69 |
.meterCard(tint: meter.color, fillOpacity: 0.12, strokeOpacity: 0.20) |
@@ -86,18 +84,8 @@ struct MeterView: View {
|
||
| 86 | 84 |
private func landscapeDeck(size: CGSize) -> some View {
|
| 87 | 85 |
TabView {
|
| 88 | 86 |
landscapeFace {
|
| 89 |
- if meter.operationalState == .dataIsAvailable {
|
|
| 90 |
- HStack(alignment: .top, spacing: 16) {
|
|
| 91 |
- connectionCard(compact: true) |
|
| 92 |
- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) |
|
| 93 |
- |
|
| 94 |
- landscapeActionPanel(size: size) |
|
| 95 |
- } |
|
| 87 |
+ connectionCard(compact: true, showsActions: meter.operationalState == .dataIsAvailable) |
|
| 96 | 88 |
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) |
| 97 |
- } else {
|
|
| 98 |
- connectionCard(compact: true) |
|
| 99 |
- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topLeading) |
|
| 100 |
- } |
|
| 101 | 89 |
} |
| 102 | 90 |
|
| 103 | 91 |
if meter.operationalState == .dataIsAvailable {
|
@@ -148,7 +136,7 @@ struct MeterView: View {
|
||
| 148 | 136 |
size.width > size.height |
| 149 | 137 |
} |
| 150 | 138 |
|
| 151 |
- private func connectionCard(compact: Bool = false) -> some View {
|
|
| 139 |
+ private func connectionCard(compact: Bool = false, showsActions: Bool = false) -> some View {
|
|
| 152 | 140 |
VStack(alignment: .leading, spacing: compact ? 12 : 18) {
|
| 153 | 141 |
HStack(alignment: .top) {
|
| 154 | 142 |
VStack(alignment: .leading, spacing: 6) {
|
@@ -187,6 +175,16 @@ struct MeterView: View {
|
||
| 187 | 175 |
} |
| 188 | 176 |
|
| 189 | 177 |
connectionActionArea(compact: compact) |
| 178 |
+ |
|
| 179 |
+ if showsActions {
|
|
| 180 |
+ VStack(spacing: compact ? 10 : 12) {
|
|
| 181 |
+ Rectangle() |
|
| 182 |
+ .fill(Color.secondary.opacity(0.12)) |
|
| 183 |
+ .frame(height: 1) |
|
| 184 |
+ |
|
| 185 |
+ actionGrid(compact: compact, embedded: true) |
|
| 186 |
+ } |
|
| 187 |
+ } |
|
| 190 | 188 |
} |
| 191 | 189 |
.padding(compact ? 16 : 20) |
| 192 | 190 |
.frame(maxWidth: .infinity, maxHeight: compact ? .infinity : nil, alignment: .topLeading) |
@@ -233,35 +231,19 @@ struct MeterView: View {
|
||
| 233 | 231 |
|
| 234 | 232 |
HStack {
|
| 235 | 233 |
Spacer(minLength: 0) |
| 236 |
- if embedded {
|
|
| 237 |
- stripContent |
|
| 238 |
- } else {
|
|
| 239 |
- stripContent |
|
| 240 |
- .meterCard(tint: Color.secondary, fillOpacity: 0.10, strokeOpacity: 0.16) |
|
| 241 |
- } |
|
| 234 |
+ stripContent |
|
| 235 |
+ .meterCard( |
|
| 236 |
+ tint: embedded ? meter.color : Color.secondary, |
|
| 237 |
+ fillOpacity: embedded ? 0.08 : 0.10, |
|
| 238 |
+ strokeOpacity: embedded ? 0.14 : 0.16, |
|
| 239 |
+ cornerRadius: embedded ? 24 : 22 |
|
| 240 |
+ ) |
|
| 242 | 241 |
Spacer(minLength: 0) |
| 243 | 242 |
} |
| 244 | 243 |
} |
| 245 | 244 |
.frame(height: currentActionHeight + (actionStripPadding * 2)) |
| 246 | 245 |
} |
| 247 | 246 |
|
| 248 |
- private func landscapeActionPanel(size: CGSize) -> some View {
|
|
| 249 |
- VStack(alignment: .leading, spacing: 14) {
|
|
| 250 |
- Text("Actions")
|
|
| 251 |
- .font(.headline) |
|
| 252 |
- |
|
| 253 |
- Spacer(minLength: 0) |
|
| 254 |
- |
|
| 255 |
- actionGrid(compact: true, embedded: true) |
|
| 256 |
- |
|
| 257 |
- Spacer(minLength: 0) |
|
| 258 |
- } |
|
| 259 |
- .padding(18) |
|
| 260 |
- .frame(width: min(420, max(320, size.width * 0.34))) |
|
| 261 |
- .frame(maxHeight: .infinity, alignment: .topLeading) |
|
| 262 |
- .meterCard(tint: Color.secondary, fillOpacity: 0.10, strokeOpacity: 0.16) |
|
| 263 |
- } |
|
| 264 |
- |
|
| 265 | 247 |
private func connectionActionArea(compact: Bool = false) -> some View {
|
| 266 | 248 |
let connected = meter.operationalState >= .peripheralConnectionPending |
| 267 | 249 |
let tint = connected ? disconnectActionTint : connectActionTint |