fix: card thumbnail overflow — use GeometryReader to constrain image
All checks were successful
Security Checks / dependency-audit (push) Successful in 14s
Security Checks / secret-scanning (push) Successful in 4s
Security Checks / dockerfile-lint (push) Successful in 4s

Images with .fill were expanding beyond the 180pt frame because
SwiftUI's .clipped() doesn't constrain the layout, only the
rendering. Now uses GeometryReader to set explicit width + height
on the image, then clips the container. Guarantees 180pt max
regardless of image aspect ratio.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Yusuf Suleman
2026-04-04 13:15:19 -05:00
parent 92a44faac3
commit ae3b3f11bf

View File

@@ -255,12 +255,14 @@ struct EntryCardView: View {
AsyncImage(url: thumbURL) { phase in
switch phase {
case .success(let image):
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(maxWidth: .infinity)
.frame(height: 180)
.clipped()
GeometryReader { geo in
image
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: geo.size.width, height: 180)
}
.frame(height: 180)
.clipped()
default:
Rectangle()
.fill(Color.surfaceCard)