updated ui for recents when fully collapsed: instead of 0/10 its 10 items

This commit is contained in:
neon443
2025-08-17 18:35:45 +01:00
parent a6e59eec2c
commit 95fd3dfe07

View File

@@ -65,7 +65,11 @@ struct RecentsView: View {
.disabled(historyCount == hostsManager.history.count) .disabled(historyCount == hostsManager.history.count)
Spacer() Spacer()
Text("\(historyCount)/\(hostsManager.history.count)") Text(
historyCount == 0 ?
"\(hostsManager.history.count) item\(plural(hostsManager.history.count))" :
"\(historyCount)/\(hostsManager.history.count)"
)
.foregroundStyle(.gray) .foregroundStyle(.gray)
.font(.caption) .font(.caption)
.contentTransition(.numericText()) .contentTransition(.numericText())
@@ -96,3 +100,7 @@ struct RecentsView: View {
keyManager: KeyManager() keyManager: KeyManager()
) )
} }
func plural(_ num: Int) -> String {
return num == 1 ? "" : "s"
}