feat(ui): add web UI with Jinja2 templates and Gitea themes
- Add Jinja2 templates with data-testid attributes for testing - Create light/dark themes based on Gitea color scheme - Add theme switching with localStorage persistence - Create base CSS, components, and layout styles - Add mock web routes for UI demonstration - Register web router and static files in main.py - Add data-testid requirements to AGENTS.md - Install jinja2 dependency
This commit is contained in:
16
app/main.py
16
app/main.py
@@ -12,6 +12,8 @@ from dishka import make_async_container
|
||||
from dishka.integrations.fastapi import setup_dishka
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import HTMLResponse
|
||||
from fastapi.staticfiles import StaticFiles
|
||||
|
||||
from app.infrastructure import close_db, init_db, register_exception_handlers, settings
|
||||
from app.infrastructure.di.providers import (
|
||||
@@ -22,6 +24,7 @@ from app.infrastructure.di.providers import (
|
||||
UseCaseProvider,
|
||||
)
|
||||
from app.presentation import router
|
||||
from app.presentation.web import router as web_router
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
@@ -77,6 +80,19 @@ def app_factory() -> FastAPI:
|
||||
)
|
||||
|
||||
app.include_router(router, prefix="/api")
|
||||
app.include_router(web_router)
|
||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||
|
||||
@app.get("/", response_class=HTMLResponse)
|
||||
async def root_redirect() -> HTMLResponse:
|
||||
"""Redirect root URL to web UI.
|
||||
|
||||
Returns:
|
||||
HTMLResponse with redirect to web interface.
|
||||
"""
|
||||
return HTMLResponse(
|
||||
content='<meta http-equiv="refresh" content="0;url=/web/">', status_code=200
|
||||
)
|
||||
|
||||
@app.get("/health", tags=["health"])
|
||||
async def health_check() -> dict[str, str]:
|
||||
|
||||
Reference in New Issue
Block a user