feat: Integrate HTML templates with FastAPI

- Created template_helpers.py for centralized template rendering
- Added ux_features.css for enhanced UX styling
- Implemented JavaScript modules for:
  - Keyboard shortcuts (Ctrl+K, Ctrl+R navigation)
  - User preferences persistence
  - Undo/redo functionality (Ctrl+Z/Ctrl+Y)
  - Mobile responsive features
  - Touch gesture support
  - Accessibility features (ARIA, focus management)
  - Screen reader support
  - Color contrast compliance (WCAG)
  - Multi-screen support
- Updated page_controller.py and error_controller.py to use template helpers
- Created comprehensive template integration tests
- All templates verified: index.html, login.html, setup.html, queue.html, error.html
- Maintained responsive layout and theme switching
- Updated instructions.md (removed completed task)
- Updated infrastructure.md with template integration details
This commit is contained in:
2025-10-17 12:01:22 +02:00
parent 043d8a2877
commit 99e24a2fc3
20 changed files with 1497 additions and 38 deletions

View File

@@ -6,7 +6,7 @@ This module provides custom error handlers for different HTTP status codes.
from fastapi import HTTPException, Request
from fastapi.responses import JSONResponse
from src.server.utils.templates import templates
from src.server.utils.template_helpers import render_template
async def not_found_handler(request: Request, exc: HTTPException):
@@ -16,9 +16,11 @@ async def not_found_handler(request: Request, exc: HTTPException):
status_code=404,
content={"detail": "API endpoint not found"}
)
return templates.TemplateResponse(
return render_template(
"error.html",
{"request": request, "error": "Page not found", "status_code": 404}
request,
context={"error": "Page not found", "status_code": 404},
title="404 - Not Found"
)
@@ -29,11 +31,9 @@ async def server_error_handler(request: Request, exc: Exception):
status_code=500,
content={"detail": "Internal server error"}
)
return templates.TemplateResponse(
return render_template(
"error.html",
{
"request": request,
"error": "Internal server error",
"status_code": 500
}
)
request,
context={"error": "Internal server error", "status_code": 500},
title="500 - Server Error"
)