Show open Vikunja task count as badge on To-Do sidebar link

Fetched async via /api/todos/count so it doesn't block page render.
Badge hidden when count is zero.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martin Hohenberg
2026-06-20 19:16:19 +02:00
parent f713fbe2fb
commit 38e6d38a2f
2 changed files with 16 additions and 1 deletions

View File

@@ -4,6 +4,12 @@ from app.vikunja import create_task, delete_task, get_tasks, update_task
router = APIRouter(prefix="/todos", tags=["todos"])
@router.get("/count")
def count_todos():
tasks = get_tasks()
return {"open": sum(1 for t in tasks if not t.get("done"))}
@router.get("/")
def list_todos():
return get_tasks()