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