Split webui into Flask blueprints and data domain modules

- Split app.py (66 routes) into 3 blueprints: pages (public), api (JSON), admin (@admin_required)
- Split data.py (4,360 LOC) into 7 domain modules: drafts, authors, ratings, gaps, analysis, search, proposals
- Add data/__init__.py re-exporting all public functions for backward compatibility
- Add custom 404/500 error pages matching dark theme
- Add request timing logging via before_request/after_request hooks
- Refactor app.py into create_app() factory pattern
- All 106 tests pass, all 66 routes preserved

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 03:37:15 +01:00
parent c066b04d74
commit 3fb17100d7
17 changed files with 4144 additions and 5170 deletions

View File

@@ -0,0 +1,23 @@
{% extends "base.html" %}
{% block title %}404 — Not Found{% endblock %}
{% block content %}
<div class="flex items-center justify-center min-h-[60vh]">
<div class="text-center max-w-lg">
<h1 class="text-8xl font-bold text-gray-600 mb-4">404</h1>
<h2 class="text-2xl font-semibold text-gray-300 mb-4">Page Not Found</h2>
<p class="text-gray-400 mb-8">
The page you're looking for doesn't exist or has been moved.
</p>
<div class="flex gap-4 justify-center">
<a href="/" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition">
Back to Overview
</a>
<a href="/search" class="px-6 py-2 bg-gray-700 hover:bg-gray-600 text-gray-200 rounded-lg transition">
Search Drafts
</a>
</div>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block title %}500 — Server Error{% endblock %}
{% block content %}
<div class="flex items-center justify-center min-h-[60vh]">
<div class="text-center max-w-lg">
<h1 class="text-8xl font-bold text-gray-600 mb-4">500</h1>
<h2 class="text-2xl font-semibold text-gray-300 mb-4">Internal Server Error</h2>
<p class="text-gray-400 mb-8">
Something went wrong on our end. Please try again later.
</p>
<div class="flex gap-4 justify-center">
<a href="/" class="px-6 py-2 bg-blue-600 hover:bg-blue-700 text-white rounded-lg transition">
Back to Overview
</a>
</div>
</div>
</div>
{% endblock %}