From 2888eb341b6be79aed824c5513981706e87c4d49 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 12 Jul 2024 17:52:21 -0700 Subject: [PATCH] Clean up weather view --- .../Weather/LocalWeatherConditions.swift | 102 ++++++++---------- 1 file changed, 47 insertions(+), 55 deletions(-) diff --git a/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift b/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift index d2735e43..8f057610 100644 --- a/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift +++ b/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift @@ -94,17 +94,15 @@ struct WeatherConditionsCompactWidget: View { let symbolName: String let description: String var body: some View { - ViewThatFits { - VStack(alignment: .leading) { - Label { Text(description) } icon: { Image(systemName: symbolName).symbolRenderingMode(.multicolor) } - .font(.caption) - Text(temperature) - .font(temperature.length < 4 ? .system(size: 90) : .system(size: 60) ) - } - .frame(maxWidth: .infinity) - .frame(height: 175) - .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) + VStack(alignment: .leading) { + Label { Text(description) } icon: { Image(systemName: symbolName).symbolRenderingMode(.multicolor) } + .font(.caption) + Text(temperature) + .font(temperature.length < 4 ? .system(size: 90) : .system(size: 60) ) } + .frame(maxWidth: .infinity) + .frame(height: 175) + .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) } } @@ -112,23 +110,21 @@ struct HumidityCompactWidget: View { let humidity: Int let dewPoint: String var body: some View { - ViewThatFits { - VStack(alignment: .leading) { - Label { Text("HUMIDITY") } icon: { Image(systemName: "humidity").symbolRenderingMode(.multicolor) } - .font(.caption) - Text("\(humidity)%") - .font(.largeTitle) - .padding(.bottom) - Text("The dew point is \(dewPoint) right now.") - .lineLimit(3) - .fixedSize(horizontal: false, vertical: true) - .font(.caption) - } - .padding(.horizontal) - .frame(maxWidth: .infinity) - .frame(height: 175) - .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) + VStack(alignment: .leading) { + Label { Text("HUMIDITY") } icon: { Image(systemName: "humidity").symbolRenderingMode(.multicolor) } + .font(.caption) + Text("\(humidity)%") + .font(.largeTitle) + .padding(.bottom) + Text("The dew point is \(dewPoint) right now.") + .lineLimit(3) + .fixedSize(horizontal: false, vertical: true) + .font(.caption) } + .padding(.horizontal) + .frame(maxWidth: .infinity) + .frame(height: 175) + .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) } } @@ -137,21 +133,19 @@ struct PressureCompactWidget: View { let unit: String let low: Bool var body: some View { - ViewThatFits { - VStack(alignment: .leading) { - Label { Text("PRESSURE") } icon: { Image(systemName: "gauge").symbolRenderingMode(.multicolor) } - .font(.caption2) - Text(pressure) - .font(pressure.length < 7 ? .system(size: 35) : .system(size: 30) ) - Text(low ? "LOW" : "HIGH") - .padding(.bottom) - Text(unit) - } - .padding(.horizontal) - .frame(maxWidth: .infinity) - .frame(height: 175) - .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) + VStack(alignment: .leading) { + Label { Text("PRESSURE") } icon: { Image(systemName: "gauge").symbolRenderingMode(.multicolor) } + .font(.caption2) + Text(pressure) + .font(pressure.length < 7 ? .system(size: 35) : .system(size: 30) ) + Text(low ? "LOW" : "HIGH") + .padding(.bottom) + Text(unit) } + .padding(.horizontal) + .frame(maxWidth: .infinity) + .frame(height: 175) + .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) } } @@ -160,22 +154,20 @@ struct WindCompactWidget: View { let gust: String let direction: String var body: some View { - ViewThatFits { - VStack(alignment: .leading) { - Label { Text("WIND") } icon: { Image(systemName: "wind").foregroundColor(.accentColor) } - .font(.caption) - Text("\(direction)") - .font(.caption) - .padding(.bottom, 10) - Text(speed) - .font(.system(size: 35)) - Text("Gusts \(gust)") - } - .padding(.horizontal) - .frame(maxWidth: .infinity) - .frame(height: 175) - .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) + VStack(alignment: .leading) { + Label { Text("WIND") } icon: { Image(systemName: "wind").foregroundColor(.accentColor) } + .font(.caption) + Text("\(direction)") + .font(.caption) + .padding(.bottom, 10) + Text(speed) + .font(.system(size: 35)) + Text("Gusts \(gust)") } + .padding(.horizontal) + .frame(maxWidth: .infinity) + .frame(height: 175) + .background(.tertiary, in: RoundedRectangle(cornerRadius: 20, style: .continuous)) } }