mirror of
https://github.com/kennethreitz/kjvstudy.org.git
synced 2026-06-05 23:00:16 +00:00
Fix ] key navigation on Verse of the Day
- next_date is now None when viewing today (can't go to future) - ] only navigates when viewing a past date - Simplified template logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -240,8 +240,9 @@ async def verse_of_the_day_page(
|
||||
|
||||
# Calculate prev/next dates for navigation
|
||||
prev_date = (current_date - timedelta(days=1)).strftime("%Y-%m-%d")
|
||||
next_date = (current_date + timedelta(days=1)).strftime("%Y-%m-%d")
|
||||
today_str = datetime.now().strftime("%Y-%m-%d")
|
||||
# Only allow next_date if viewing a past date (can't go to future)
|
||||
next_date = (current_date + timedelta(days=1)).strftime("%Y-%m-%d") if date_str < today_str else None
|
||||
|
||||
# Generate past 30 days of verses (from the viewed date)
|
||||
past_verses = []
|
||||
|
||||
@@ -465,11 +465,8 @@
|
||||
} else if (e.key === ']') {
|
||||
// Next day (only if not viewing future)
|
||||
e.preventDefault();
|
||||
{% if not is_today %}
|
||||
{% if next_date %}
|
||||
window.location.href = '/verse-of-the-day?date={{ next_date }}';
|
||||
{% else %}
|
||||
// Already on today, go to today's page (removes query param)
|
||||
window.location.href = '/verse-of-the-day';
|
||||
{% endif %}
|
||||
} else if (e.key === 't') {
|
||||
// Jump to today
|
||||
|
||||
Reference in New Issue
Block a user