Improve cap row display

This commit is contained in:
Christoph Hagen 2023-04-17 14:20:25 +02:00
parent 344d926b9b
commit 96f2043d73
2 changed files with 29 additions and 30 deletions

View File

@ -1,4 +1,5 @@
import SwiftUI import SwiftUI
import SFSafeSymbols
struct CapRowView: View { struct CapRowView: View {
@ -17,42 +18,40 @@ struct CapRowView: View {
database.serverUrl.appendingPathComponent(cap.mainImagePath) database.serverUrl.appendingPathComponent(cap.mainImagePath)
} }
var imageCountText: String {
guard cap.imageCount != 1 else {
return "\(cap.id) (1 image)"
}
return "\(cap.id) (\(cap.imageCount) images)"
}
var body: some View { var body: some View {
HStack(alignment: .center) { HStack(alignment: .center) {
VStack(alignment: .leading, spacing: 0) { VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 8) {
Text(imageCountText)
.font(.footnote)
if !cap.classifiable(by: database.classifierVersion) {
Text("📵")
}
if cap.imageCount < sufficientImageCount {
Text("⚠️")
}
if database.hasPendingUpdates(for: cap.id) {
Text("")
}
if database.hasPendingOperations(for: cap.id) {
ProgressView()
}
}
.padding(.top, 0)
.font(.footnote)
Text(cap.name) Text(cap.name)
.font(.headline) .font(.headline)
.padding(.bottom, 3) .padding(.bottom, 3)
if let match = match { HStack(spacing: 4) {
Text("\(Int((match * 100).rounded())) % match") Image(systemSymbol: .tag)
.font(.footnote) Text("\(cap.id)")
.padding(.trailing, 8)
Image(systemSymbol: .photoCircle)
Text("\(cap.imageCount)")
.padding(.trailing, 8)
if cap.imageCount < sufficientImageCount {
Image(systemSymbol: .eyeTrianglebadgeExclamationmark)
.padding(.trailing, 8)
}
if !database.canClassify(cap: cap.id) {
Image(systemSymbol: .eyeSlash)
.padding(.trailing, 8)
}
if database.hasPendingUpdates(for: cap.id) {
Image(systemSymbol: .arrowUpArrowDownCircle)
.padding(.trailing, 8)
}
if let match = match {
Image(systemSymbol: .target)
Text("\(Int((match * 100).rounded())) %")
.padding(.trailing, 8)
}
} }
.foregroundColor(.secondary)
.padding(.top, 0)
.font(.footnote)
}//.padding(.vertical) }//.padding(.vertical)
Spacer() Spacer()
CachedCapImage(cap, cap.image, cache: database.images) { image in CachedCapImage(cap, cap.image, cache: database.images) { image in

View File

@ -58,7 +58,7 @@ struct SettingsView: View {
Spacer() Spacer()
} }
.padding(.horizontal) .padding(.horizontal)
.navigationTitle("Settings") .navigationTitle("Info")
.onAppear(perform: updateImageCacheSize) .onAppear(perform: updateImageCacheSize)
} }
} }