Add day navigation to the Today board toolbar
Back/forward chevrons step the board a day at a time around the existing calendar button, and a Today button — shown only when the board is off today — jumps back. Also add the missing changelog entries for the Today board itself. Claude-Session: https://claude.ai/code/session_012qw2itfzKyEJ1HpsFt8Ex4
This commit is contained in:
@@ -123,12 +123,28 @@ struct TodayView: View {
|
||||
}
|
||||
.navigationTitle(isViewingToday ? "\(greetingLine) Today" : selectedDate.formatDate())
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .topBarLeading) {
|
||||
ToolbarItemGroup(placement: .topBarLeading) {
|
||||
Button {
|
||||
shiftDay(by: -1)
|
||||
} label: {
|
||||
Label("Previous Day", systemImage: "chevron.backward")
|
||||
}
|
||||
Button {
|
||||
showingDayPicker = true
|
||||
} label: {
|
||||
Label("Go to Day", systemImage: "calendar")
|
||||
}
|
||||
Button {
|
||||
shiftDay(by: 1)
|
||||
} label: {
|
||||
Label("Next Day", systemImage: "chevron.forward")
|
||||
}
|
||||
// Quick way home — redundant on today itself, so hidden there.
|
||||
if !isViewingToday {
|
||||
Button("Today") {
|
||||
withAnimation { selectedDate = Date() }
|
||||
}
|
||||
}
|
||||
}
|
||||
ToolbarItem(placement: .topBarTrailing) {
|
||||
Button {
|
||||
@@ -243,6 +259,14 @@ struct TodayView: View {
|
||||
.background(.secondary.opacity(0.15), in: Capsule())
|
||||
}
|
||||
|
||||
/// Step the viewed day back or forward (day precision; the time component is
|
||||
/// irrelevant to the board).
|
||||
private func shiftDay(by days: Int) {
|
||||
withAnimation {
|
||||
selectedDate = Calendar.current.date(byAdding: .day, value: days, to: selectedDate) ?? selectedDate
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Resolution helpers
|
||||
|
||||
/// The live routine this schedule points at, following the seed clone-on-edit
|
||||
|
||||
Reference in New Issue
Block a user