From 95fd3dfe07bab64e42866cd0d67803760f776133 Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sun, 17 Aug 2025 18:35:45 +0100 Subject: [PATCH] updated ui for recents when fully collapsed: instead of 0/10 its 10 items --- ShhShell/Views/Hosts/RecentsView.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ShhShell/Views/Hosts/RecentsView.swift b/ShhShell/Views/Hosts/RecentsView.swift index 53e642e..52b93a1 100644 --- a/ShhShell/Views/Hosts/RecentsView.swift +++ b/ShhShell/Views/Hosts/RecentsView.swift @@ -65,10 +65,14 @@ struct RecentsView: View { .disabled(historyCount == hostsManager.history.count) Spacer() - Text("\(historyCount)/\(hostsManager.history.count)") - .foregroundStyle(.gray) - .font(.caption) - .contentTransition(.numericText()) + Text( + historyCount == 0 ? + "\(hostsManager.history.count) item\(plural(hostsManager.history.count))" : + "\(historyCount)/\(hostsManager.history.count)" + ) + .foregroundStyle(.gray) + .font(.caption) + .contentTransition(.numericText()) Spacer() Button { @@ -96,3 +100,7 @@ struct RecentsView: View { keyManager: KeyManager() ) } + +func plural(_ num: Int) -> String { + return num == 1 ? "" : "s" +}