Reorganize weather popup hero layout

Move the weather icon next to the big temperature on the left and stack
the location and stats columns on the right, matching the new mockup.
This commit is contained in:
Jake Weaver
2026-05-15 15:55:14 -04:00
parent 8eb91cd06b
commit 9c859a4c9b
@@ -42,13 +42,6 @@ Item {
readonly property string reportFeels: current ? formatTemp(useImperial ? current.FeelsLikeF : current.FeelsLikeC) : "" readonly property string reportFeels: current ? formatTemp(useImperial ? current.FeelsLikeF : current.FeelsLikeC) : ""
readonly property string reportWind: current ? (useImperial ? (current.windspeedMiles + " mph") : (current.windspeedKmph + " km/h")) : "" readonly property string reportWind: current ? (useImperial ? (current.windspeedMiles + " mph") : (current.windspeedKmph + " km/h")) : ""
readonly property string reportHumidity: current ? (current.humidity + "%") : "" readonly property string reportHumidity: current ? (current.humidity + "%") : ""
readonly property string conditionLine: {
var parts = []
if (reportCondition) parts.push(reportCondition)
var wd = windDescriptor()
if (wd) parts.push(wd)
return parts.join(" · ")
}
visible: label !== "" visible: label !== ""
implicitWidth: button.implicitWidth + 8 implicitWidth: button.implicitWidth + 8
@@ -85,22 +78,6 @@ Item {
return formatTemp(useImperial ? day.mintempF : day.mintempC) return formatTemp(useImperial ? day.mintempF : day.mintempC)
} }
// Beaufort-ish descriptor based on current windspeed in mph.
function windDescriptor() {
if (!current) return ""
var mph = parseInt(String(current.windspeedMiles || "0"), 10)
if (isNaN(mph)) return ""
if (mph < 1) return "Calm"
if (mph < 4) return "Light air"
if (mph < 8) return "Light breeze"
if (mph < 13) return "Gentle breeze"
if (mph < 19) return "Moderate breeze"
if (mph < 25) return "Fresh breeze"
if (mph < 32) return "Strong breeze"
if (mph < 39) return "Near gale"
return "Gale"
}
// Bare degree value (no unit letter), used in the forecast row. // Bare degree value (no unit letter), used in the forecast row.
function bareTempForDay(day, kind) { function bareTempForDay(day, kind) {
if (!day) return "" if (!day) return ""
@@ -202,7 +179,7 @@ Item {
bar: root.bar bar: root.bar
open: root.popupOpen open: root.popupOpen
triggerMode: "click" triggerMode: "click"
contentWidth: 460 contentWidth: 520
contentHeight: card.implicitHeight + 28 contentHeight: card.implicitHeight + 28
Column { Column {
@@ -210,16 +187,54 @@ Item {
anchors.fill: parent anchors.fill: parent
spacing: 14 spacing: 14
// ---- Hero row: location/temp/condition on the left, big icon on the right. // ---- Hero row: big icon + temp on the left; location and stats stacked on the right.
Item { Item {
width: parent.width width: parent.width
height: heroLeft.height height: Math.max(heroLeft.height, heroRight.height)
Column { Row {
id: heroLeft id: heroLeft
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.verticalCenter: parent.verticalCenter
spacing: 6 spacing: 12
Text {
id: heroIcon
anchors.verticalCenter: parent.verticalCenter
text: root.label || "—"
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 64
}
Row {
anchors.verticalCenter: parent.verticalCenter
spacing: 2
Text {
id: tempBig
text: root.reportTempNum || "—"
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 56
font.bold: true
}
Text {
text: root.current ? root.tempUnit : ""
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 22
anchors.top: tempBig.top
anchors.topMargin: 10
}
}
}
Column {
id: heroRight
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
spacing: 8
Row { Row {
visible: root.reportLocation !== "" visible: root.reportLocation !== ""
@@ -243,100 +258,59 @@ Item {
} }
Row { Row {
spacing: 2 visible: !!root.current
spacing: 22
Text { Column {
id: tempBig spacing: 4
text: root.reportTempNum || "—" Text {
color: root.bar.foreground text: "FEELS"
font.family: root.bar.fontFamily color: Qt.darker(root.bar.foreground, 1.5)
font.pixelSize: 56 font.family: root.bar.fontFamily
font.bold: true font.pixelSize: 10
font.letterSpacing: 1
}
Text {
text: root.reportFeels
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 13
}
} }
Text {
text: root.current ? root.tempUnit : "" Column {
color: root.bar.foreground spacing: 4
font.family: root.bar.fontFamily Text {
font.pixelSize: 22 text: "WIND"
anchors.top: tempBig.top color: Qt.darker(root.bar.foreground, 1.5)
anchors.topMargin: 10 font.family: root.bar.fontFamily
font.pixelSize: 10
font.letterSpacing: 1
}
Text {
text: root.reportWind
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 13
}
} }
}
Text { Column {
visible: text !== "" spacing: 4
text: root.conditionLine Text {
color: Qt.darker(root.bar.foreground, 1.2) text: "HUMIDITY"
font.family: root.bar.fontFamily color: Qt.darker(root.bar.foreground, 1.5)
font.pixelSize: 12 font.family: root.bar.fontFamily
} font.pixelSize: 10
} font.letterSpacing: 1
}
Text { Text {
id: heroIcon text: root.reportHumidity
anchors.right: parent.right color: root.bar.foreground
anchors.verticalCenter: heroLeft.verticalCenter font.family: root.bar.fontFamily
text: root.label || "—" font.pixelSize: 13
color: root.bar.foreground }
font.family: root.bar.fontFamily }
font.pixelSize: 80
}
}
// ---- Stats row: three caps-labeled columns.
Row {
visible: !!root.current
width: parent.width
spacing: 36
Column {
spacing: 4
Text {
text: "FEELS"
color: Qt.darker(root.bar.foreground, 1.5)
font.family: root.bar.fontFamily
font.pixelSize: 10
font.letterSpacing: 1
}
Text {
text: root.reportFeels
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 13
}
}
Column {
spacing: 4
Text {
text: "WIND"
color: Qt.darker(root.bar.foreground, 1.5)
font.family: root.bar.fontFamily
font.pixelSize: 10
font.letterSpacing: 1
}
Text {
text: root.reportWind
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 13
}
}
Column {
spacing: 4
Text {
text: "HUMIDITY"
color: Qt.darker(root.bar.foreground, 1.5)
font.family: root.bar.fontFamily
font.pixelSize: 10
font.letterSpacing: 1
}
Text {
text: root.reportHumidity
color: root.bar.foreground
font.family: root.bar.fontFamily
font.pixelSize: 13
} }
} }
} }