Move weather into entry detail date header
Display weather inline next to the date in a compact HStack layout (icon | condition + temps) instead of a separate Weather section. Removes the standalone weatherSection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10571,6 +10571,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"H: %lld° L: %lld°" : {
|
||||||
|
"comment" : "A pair of high and low temperatures displayed in degrees Celsius.",
|
||||||
|
"isCommentAutoGenerated" : true,
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "new",
|
||||||
|
"value" : "H: %1$lld° L: %2$lld°"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Haptic Feedback" : {
|
"Haptic Feedback" : {
|
||||||
"comment" : "A label displayed above the toggle for haptic feedback.",
|
"comment" : "A label displayed above the toggle for haptic feedback.",
|
||||||
"isCommentAutoGenerated" : true,
|
"isCommentAutoGenerated" : true,
|
||||||
|
|||||||
@@ -193,12 +193,6 @@ struct EntryDetailView: View {
|
|||||||
// Notes section
|
// Notes section
|
||||||
notesSection
|
notesSection
|
||||||
|
|
||||||
// Weather section
|
|
||||||
if let weatherJSON = entry.weatherJSON,
|
|
||||||
let weatherData = WeatherData.decode(from: weatherJSON) {
|
|
||||||
weatherSection(weatherData)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Photo section
|
// Photo section
|
||||||
photoSection
|
photoSection
|
||||||
|
|
||||||
@@ -259,18 +253,40 @@ struct EntryDetailView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var dateHeader: some View {
|
private var dateHeader: some View {
|
||||||
VStack(spacing: 8) {
|
HStack {
|
||||||
Text(entry.forDate, format: .dateTime.weekday(.wide))
|
VStack(alignment: .leading, spacing: 4) {
|
||||||
.font(.title2)
|
Text(entry.forDate, format: .dateTime.weekday(.wide))
|
||||||
.fontWeight(.semibold)
|
.font(.title2)
|
||||||
.foregroundColor(textColor)
|
.fontWeight(.semibold)
|
||||||
|
.foregroundColor(textColor)
|
||||||
|
|
||||||
Text(entry.forDate, format: .dateTime.month(.wide).day().year())
|
Text(entry.forDate, format: .dateTime.month(.wide).day().year())
|
||||||
.font(.subheadline)
|
.font(.subheadline)
|
||||||
.foregroundStyle(.secondary)
|
.foregroundStyle(.secondary)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
// Weather if available
|
||||||
|
if let weatherJSON = entry.weatherJSON,
|
||||||
|
let weather = WeatherData.decode(from: weatherJSON) {
|
||||||
|
HStack(spacing: 8) {
|
||||||
|
Image(systemName: weather.conditionSymbol)
|
||||||
|
.font(.title)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
VStack(alignment: .leading, spacing: 2) {
|
||||||
|
Text(weather.condition)
|
||||||
|
.font(.subheadline)
|
||||||
|
.foregroundStyle(.secondary)
|
||||||
|
Text("H: \(Int(round(weather.highTemperature)))° L: \(Int(round(weather.lowTemperature)))°")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundStyle(.tertiary)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity)
|
.padding(.horizontal, 20)
|
||||||
.padding(.vertical, 20)
|
.padding(.vertical, 16)
|
||||||
.background(
|
.background(
|
||||||
RoundedRectangle(cornerRadius: 16)
|
RoundedRectangle(cornerRadius: 16)
|
||||||
.fill(Color(.systemBackground))
|
.fill(Color(.systemBackground))
|
||||||
@@ -494,16 +510,6 @@ struct EntryDetailView: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private func weatherSection(_ weatherData: WeatherData) -> some View {
|
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
|
||||||
Text("Weather")
|
|
||||||
.font(.headline)
|
|
||||||
.foregroundColor(textColor)
|
|
||||||
|
|
||||||
WeatherCardView(weatherData: weatherData)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var photoSection: some View {
|
private var photoSection: some View {
|
||||||
VStack(alignment: .leading, spacing: 12) {
|
VStack(alignment: .leading, spacing: 12) {
|
||||||
HStack {
|
HStack {
|
||||||
|
|||||||
Reference in New Issue
Block a user