From a221455b0cf3658ab6b712aac45d63350b9054bc Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 12 Jul 2024 11:22:39 -0700 Subject: [PATCH] Improve padding and hot temperature font sizes --- .../Views/Helpers/Weather/LocalWeatherConditions.swift | 7 ++++--- Meshtastic/Views/Nodes/Helpers/NodeDetail.swift | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift b/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift index 9bb65111..6411e7d3 100644 --- a/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift +++ b/Meshtastic/Views/Helpers/Weather/LocalWeatherConditions.swift @@ -38,6 +38,7 @@ struct LocalWeatherConditions: View { WindCompactWidget(speed: windSpeed, gust: windGust, direction: windCompassDirection) } } + .padding(.top) .task { do { if location != nil { @@ -53,7 +54,7 @@ struct LocalWeatherConditions: View { dewPoint = measurementFormatter.string(from: weather.currentWeather.dewPoint) humidity = Int(weather.currentWeather.humidity * 100) pressure = weather.currentWeather.pressure - windSpeed = measurementFormatter.string(from: weather.currentWeather.wind.speed)//weather.currentWeather.wind.speed + windSpeed = measurementFormatter.string(from: weather.currentWeather.wind.speed) windGust = measurementFormatter.string(from: weather.currentWeather.wind.gust ?? Measurement(value: 0.0, unit: weather.currentWeather.wind.gust!.unit)) windDirection = weather.currentWeather.wind.direction windCompassDirection = weather.currentWeather.wind.compassDirection.description @@ -98,7 +99,7 @@ struct WeatherConditionsCompactWidget: View { Label { Text(description) } icon: { Image(systemName: symbolName).symbolRenderingMode(.multicolor) } .font(.caption) Text(temperature) - .font(.system(size: 90)) + .font(temperature.length < 4 ? .system(size: 90) : .system(size: 60) ) } .frame(maxWidth: .infinity) .frame(height: 175) @@ -140,7 +141,7 @@ struct PressureCompactWidget: View { Label { Text("PRESSURE") } icon: { Image(systemName: "gauge").symbolRenderingMode(.multicolor) } .font(.caption2) Text(pressure) - .font(.system(size: 35)) + .font(pressure.length < 7 ? .system(size: 35) : .system(size: 30) ) .padding(.bottom) Text(unit) .padding(.top) diff --git a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift index 5ce73bb9..8ed10f46 100644 --- a/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift +++ b/Meshtastic/Views/Nodes/Helpers/NodeDetail.swift @@ -162,6 +162,7 @@ struct NodeDetail: View { Section("Environment") { if !node.hasEnvironmentMetrics { LocalWeatherConditions(location: node.latestPosition?.nodeLocation) + // .padding(.top) } else { VStack { IndoorAirQuality(iaq: Int(node.latestEnvironmentMetrics?.iaq ?? 0), displayMode: .gradient) @@ -169,9 +170,10 @@ struct NodeDetail: View { LazyVGrid(columns: gridItemLayout) { WeatherConditionsCompactWidget(temperature: String(node.latestEnvironmentMetrics?.temperature.shortFormattedTemperature() ?? "99°"), symbolName: "cloud.sun", description: "TEMP") HumidityCompactWidget(humidity: Int(node.latestEnvironmentMetrics?.relativeHumidity ?? 0.0), dewPoint: String(format: "%.0f", calculateDewPoint(temp: node.latestEnvironmentMetrics?.temperature ?? 0.0, relativeHumidity: node.latestEnvironmentMetrics?.relativeHumidity ?? 0.0)) + "°") - PressureCompactWidget(pressure: String(node.latestEnvironmentMetrics?.barometricPressure ?? 0.0), unit: "mbar") + PressureCompactWidget(pressure: String(format: "%.2f", node.latestEnvironmentMetrics?.barometricPressure ?? 0.0), unit: "mbar") // hectopascal WindCompactWidget(speed: String(node.latestEnvironmentMetrics?.windSpeed ?? 0.0), gust: String(node.latestEnvironmentMetrics?.windGust ?? 0.0), direction: "") } + .padding(.bottom) } } }