Add live search progress, session counter, and fix URLs

- Search candidates client-side with JS, showing "Checking X..." spinner
  instead of leaving user waiting on a blank page
- Fix broken api_valid_hit endpoint (get_diff returns dict, not tuple)
- Remove server-side get_best_hit; article_page now returns candidate list
  immediately and JS iterates via /api/1/valid_hit
- URL now reflects current article via history.replaceState (?title=X),
  Skip navigates to ?after=X to advance past it
- Track saves in session; show count as green badge in navbar
- Add session counter incremented on each successful save

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-05-11 12:24:15 +01:00
parent bc6265d4cd
commit 2c197f5c43
3 changed files with 114 additions and 71 deletions

View file

@ -20,6 +20,9 @@
</form>
{% if g.user %}
<span class="text-light small opacity-75">{{ g.user }}</span>
{% if session.get("saves") %}
<span class="badge bg-success">{{ session["saves"] }} saved</span>
{% endif %}
<a class="btn btn-outline-light btn-sm" href="{{ url_for('oauth_disconnect') }}">Log out</a>
{% else %}
<a class="btn btn-outline-light btn-sm" href="{{ url_for('start_oauth') }}">Log in with Wikipedia</a>