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:
@@ -193,12 +193,6 @@ struct EntryDetailView: View {
|
||||
// Notes section
|
||||
notesSection
|
||||
|
||||
// Weather section
|
||||
if let weatherJSON = entry.weatherJSON,
|
||||
let weatherData = WeatherData.decode(from: weatherJSON) {
|
||||
weatherSection(weatherData)
|
||||
}
|
||||
|
||||
// Photo section
|
||||
photoSection
|
||||
|
||||
@@ -259,18 +253,40 @@ struct EntryDetailView: View {
|
||||
}
|
||||
|
||||
private var dateHeader: some View {
|
||||
VStack(spacing: 8) {
|
||||
Text(entry.forDate, format: .dateTime.weekday(.wide))
|
||||
.font(.title2)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundColor(textColor)
|
||||
HStack {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Text(entry.forDate, format: .dateTime.weekday(.wide))
|
||||
.font(.title2)
|
||||
.fontWeight(.semibold)
|
||||
.foregroundColor(textColor)
|
||||
|
||||
Text(entry.forDate, format: .dateTime.month(.wide).day().year())
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
Text(entry.forDate, format: .dateTime.month(.wide).day().year())
|
||||
.font(.subheadline)
|
||||
.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(.vertical, 20)
|
||||
.padding(.horizontal, 20)
|
||||
.padding(.vertical, 16)
|
||||
.background(
|
||||
RoundedRectangle(cornerRadius: 16)
|
||||
.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 {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack {
|
||||
|
||||
Reference in New Issue
Block a user