From 865d0870d72d60a936d0a1d5feee712b24a16e03 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 Mar 2026 22:38:12 +0000 Subject: [PATCH] feat: critical flag toggle on focus items MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a clickable flag marker (⚑) on each focus row to mark items as critical. Red when active, subtle when inactive. Toggle via POST. Co-Authored-By: Claude Opus 4.6 --- routers/focus.py | 9 +++++++++ templates/focus.html | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/routers/focus.py b/routers/focus.py index f651e4f..755e3db 100644 --- a/routers/focus.py +++ b/routers/focus.py @@ -592,6 +592,15 @@ async def toggle_focus(focus_id: str, request: Request, db: AsyncSession = Depen return RedirectResponse(url=referer, status_code=303) +@router.post("/{focus_id}/toggle-critical") +async def toggle_critical(focus_id: str, request: Request, db: AsyncSession = Depends(get_db)): + repo = BaseRepository("daily_focus", db) + item = await repo.get(focus_id) + if item: + await repo.update(focus_id, {"critical": not item.get("critical", False)}) + return RedirectResponse(url="/focus", status_code=303) + + @router.post("/{focus_id}/remove") async def remove_from_focus(focus_id: str, request: Request, db: AsyncSession = Depends(get_db)): repo = BaseRepository("daily_focus", db) diff --git a/templates/focus.html b/templates/focus.html index be4f921..6dbc3c3 100644 --- a/templates/focus.html +++ b/templates/focus.html @@ -24,13 +24,13 @@
- + {% for domain in hierarchy %} - +
+ @@ -50,6 +50,11 @@
+
+ +
+
{{ item.due_date or '' }} {% if item.task_id %}{% elif item.list_item_id %}{% else %}{% endif %} {% if item.task_id %}{% if item.task_title %}{{ item.task_title }}{% else %}[Deleted]{% endif %}{% elif item.list_item_id %}{% if item.list_item_content %}{{ item.list_item_content }}{% else %}[Deleted]{% endif %}{% else %}{{ item.title }}{% endif %}