05/21 Fix issue's photo problems

This commit is contained in:
Nguyen Ngo
2026-05-21 13:24:10 -04:00
parent 437ed913cd
commit 6aa3b74e61
8 changed files with 602 additions and 103 deletions
@@ -619,34 +619,15 @@ struct ReadOnlyCellView: View {
.clipShape(RoundedRectangle(cornerRadius: 5))
} else {
// Local file cleaned up show placeholder
Label("Photo no longer on device", systemImage: "photo.badge.exclamationmark")
Label("Photo no longer on device", systemImage: "exclamationmark.triangle")
.font(.system(size: 11))
.foregroundStyle(.secondary)
}
} else if value.hasPrefix("uploads/") {
// Photo synced to server load via AsyncImage
let url = URL(string: "\(Constants.baseURL)/static/\(value)")
AsyncImage(url: url) { phase in
switch phase {
case .success(let img):
img.resizable()
.scaledToFit()
.clipShape(RoundedRectangle(cornerRadius: 5))
case .failure:
Label("Could not load photo", systemImage: "photo.badge.exclamationmark")
.font(.system(size: 11))
.foregroundStyle(.secondary)
case .empty:
HStack(spacing: 6) {
ProgressView().scaleEffect(0.7)
Text("Loading photo…")
.font(.system(size: 11))
.foregroundStyle(.secondary)
}
@unknown default:
EmptyView()
}
}
// Photo synced to server load with retry support
RetryablePhotoView(
url: URL(string: "\(ServerConfig.current)/static/\(value)")
)
} else if !value.isEmpty {
// Unknown path format generic indicator
Label("Photo attached", systemImage: "photo")