Improve padding and hot temperature font sizes

This commit is contained in:
Garth Vander Houwen 2024-07-12 11:22:39 -07:00
parent 152a449b9a
commit a221455b0c
2 changed files with 7 additions and 4 deletions

View file

@ -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)

View file

@ -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)
}
}
}