mirror of
https://github.com/neon443/ShhShell.git
synced 2026-03-11 13:26:16 +00:00
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
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user