Redesign UI and fix several bugs

- Add navbar with login/logout, search form, and Find Link branding
- Clean up index page: search-only, examples behind ?debug=1
- Improve article page: remove debug clutter, named Wikipedia links, collapsible candidates
- Add SVG favicon (🔗 emoji)
- Fix diff CSS: compact layout, auto table layout to eliminate wide marker column gap
- Catch TokenRequestDenied in OAuth start and show error page
- Store username in session at login; clear bad session on API failure
- Raise NoMatch when diff is empty (edit already applied)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Edward Betts 2026-05-11 11:30:12 +01:00
parent 7867122326
commit bc6265d4cd
11 changed files with 167 additions and 90 deletions

View file

@ -1,25 +1,44 @@
{% extends "base.html" %}
{% block title %}Index{% endblock %}
{% block title %}Find Link{% endblock %}
{% block content %}
<div class="container">
<h1>Index</h1>
<form>
<input name="q">
<input type="submit" value="search">
</form>
<div>Username: {{ g.user }}</div>
<table class="table w-auto">
{% for item in examples %}
<tr>
<td><a href="{{ article_url(item.title) }}">{{ item.title }}</a></td>
<td>{{ item.total }}</td>
<td>{{ "{:.1%}".format(item.with_links / item.total) }}</td>
</tr>
{% endfor %}
</table>
<div class="container">
<div class="row justify-content-center mt-5">
<div class="col-md-6 text-center">
<h1 class="mb-2">Find Link</h1>
<p class="text-muted mb-4">Find unlinked mentions of a Wikipedia article and add the links.</p>
<form class="d-flex gap-2 justify-content-center" action="{{ url_for('index') }}">
<input class="form-control" name="q" placeholder="Article title…" style="max-width:360px" autofocus>
<button class="btn btn-primary" type="submit">Search</button>
</form>
</div>
</div>
{% if debug %}
<div class="row mt-5">
<div class="col">
<h2 class="h6 text-muted text-uppercase mb-3">Examples</h2>
<table class="table table-sm table-hover w-auto">
<thead class="table-light">
<tr>
<th>Article</th>
<th class="text-end">Total</th>
<th class="text-end">% linked</th>
</tr>
</thead>
<tbody>
{% for item in examples %}
<tr>
<td><a href="{{ article_url(item.title) }}">{{ item.title }}</a></td>
<td class="text-end text-muted">{{ item.total }}</td>
<td class="text-end text-muted">{{ "{:.0%}".format(item.with_links / item.total) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>
{% endblock %}