add next/prev session links + shorten admin recent feed

This commit is contained in:
SowinskiBraeden committed 2026-03-16 16:03:47 -07:00
1 parent f232135863
commit 515e1a8063
2 files changed
+28 -1

No files matched your search

+17 -1
View File
@@ -126,9 +126,25 @@ def session_detail(session_date: str) -> str:
flash("That session was not found.", "error")
return redirect(url_for("sessions"))
# sessions are in reverse order
idx = sessions.index(target_session)
next_session_idx = idx - 1
prev_session_idx = idx + 1
next_session = None
prev_session = None
if next_session_idx >= 0:
next_session = sessions[next_session_idx]
if prev_session_idx < len(sessions):
prev_session = sessions[prev_session_idx]
return render_template(
"session_detail.html",
session=target_session,
next_session=next_session,
prev_session=prev_session,
raw_events=session_events(events, session_date),
)
@@ -217,7 +233,7 @@ def admin_dashboard() -> str:
events = load_events(DATA_PATH)
sessions = build_session_summaries(events)
recent_sessions = sessions[:6]
recent_events = list(reversed(events[-20:]))
recent_events = list(reversed(events[-10:]))
return render_template(
"admin_dashboard.html",
recent_sessions=recent_sessions,
+11
View File
@@ -2,11 +2,22 @@
{% block title %}{{ session.session_date }} · Poker Portal{% endblock %}
{% block content %}
<section class="hero-card compact">
<div style="display: flex; justify-content: space-between;">
<div>
<p class="eyebrow">Session detail</p>
<h1>{{ session.session_date | pretty_date }}</h1>
<p class="muted-text">Current totals are derived from the event log for this date.</p>
</div>
<div style="align-content: center;">
{% if prev_session %}
<a class="secondary-button" href="{{ url_for('session_detail', session_date=prev_session.session_date) }}">Previous Session</a>
{% endif %}
{% if next_session %}
<a class="secondary-button" href="{{ url_for('session_detail', session_date=next_session.session_date) }}">Next Session</a>
{% endif %}
</div>
</div>
</section>
<section class="grid two-col session-layout">