From 56c5634d9a21de2dd5a9ca0720636a4bde25d6de Mon Sep 17 00:00:00 2001 From: neon443 <69979447+neon443@users.noreply.github.com> Date: Sat, 16 Aug 2025 22:24:50 +0100 Subject: [PATCH] ok fix stupid things in recents: - crash when expanding recents but theres only one more - ui improvements make the down arrow grayed out if its all the way down - up arrow disabled if fully collapsed - something else i forgot --- ShhShell/Views/Hosts/RecentsView.swift | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ShhShell/Views/Hosts/RecentsView.swift b/ShhShell/Views/Hosts/RecentsView.swift index e2b3469..53e642e 100644 --- a/ShhShell/Views/Hosts/RecentsView.swift +++ b/ShhShell/Views/Hosts/RecentsView.swift @@ -47,10 +47,14 @@ struct RecentsView: View { .tint(.red) } } - if historyCount != hostsManager.history.count { + if historyCount <= hostsManager.history.count { HStack(alignment: .center) { Button() { - withAnimation { historyCount += 2 } + var increment = 2 + if historyCount+2 > hostsManager.history.count { + increment = 1 + } + withAnimation { historyCount += increment } } label: { Image(systemName: "chevron.down") .resizable().scaledToFit() @@ -58,14 +62,17 @@ struct RecentsView: View { .foregroundStyle(hostsManager.tint) } .buttonStyle(.plain) + .disabled(historyCount == hostsManager.history.count) + Spacer() Text("\(historyCount)/\(hostsManager.history.count)") .foregroundStyle(.gray) .font(.caption) .contentTransition(.numericText()) Spacer() + Button { - withAnimation { historyCount = 2 } + withAnimation { historyCount = 0 } } label: { Image(systemName: "chevron.up.2") .resizable().scaledToFit() @@ -73,10 +80,12 @@ struct RecentsView: View { .foregroundStyle(hostsManager.tint) } .buttonStyle(.plain) + .disabled(historyCount == 0) } } } + .transition(.opacity) } } }