diff --git a/app/routers/board.py b/app/routers/board.py index 3c6597a..3a3de30 100644 --- a/app/routers/board.py +++ b/app/routers/board.py @@ -216,6 +216,22 @@ def _load_children(parent_id: int) -> list: return children +def _local_workspaces_for_user(user: dict | None, workspace_id: int = 0) -> list[dict]: + """Return list of local workspaces for a user.""" + if not user: + return [] + try: + from app.db import get_conn + with get_conn() as conn: + rows = conn.execute( + "SELECT id, name FROM workspaces WHERE owner_id = ? ORDER BY name", + (user["id"],) + ).fetchall() + return [{"id": r["id"], "name": r["name"]} for r in rows] + except Exception: + return [] + + def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict: user = SessionManager.decode_session(request.cookies.get("flowdeck_session", "")) ws_name = user.get("login", "Bruno") if user else "Bruno" @@ -280,7 +296,7 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict: active = first recent.append({ "id": f"{owner}/{repo}/{view}", - "name": label, "icon": "πŸ“" if first else "Β·", + "name": label, "icon": "folder" if first else "", "url": f"/board/{owner}/{repo}?view={view}", "active": active, "indent": indent, "depth": indent, "has_children": False, "children": [], @@ -380,7 +396,9 @@ def _sidebar_data(request: Request, owner: str = "", repo: str = "") -> dict: "auth_method": auth_method, "gitea_linked": gitea_linked, "github_linked": github_linked, - "has_active_workspace": has_active_workspace} + "has_active_workspace": has_active_workspace, + "app_version": "4.0.3", + "local_workspaces": _local_workspaces_for_user(user)} def _extract_ai_keywords(owner: str, repo: str, labels: list[dict], body: str = ""): @@ -510,7 +528,7 @@ async def library_page(request: Request, owner: str = Query(default=""), repo: s "icon": "πŸ“„", "url": f"/pages/{page['id']}", "created_by": "You", - "source": page.get("workspace") or "πŸ”’ Private", + "source": page.get("workspace") or "Private", "last_edited": page.get("updated_at", "now"), "last_visited": page.get("updated_at", "now"), }) diff --git a/app/routers/dashboard.py b/app/routers/dashboard.py index 1983258..4cc4072 100644 --- a/app/routers/dashboard.py +++ b/app/routers/dashboard.py @@ -31,6 +31,21 @@ def _get_user_or_redirect(request: Request): return user +def _local_workspaces_for_user(user: dict | None, workspace_id: int = 0) -> list[dict]: + """Return list of local workspaces for a user.""" + if not user: + return [] + try: + with get_conn() as conn: + rows = conn.execute( + "SELECT id, name FROM workspaces WHERE owner_id = ? ORDER BY name", + (user["id"],) + ).fetchall() + return [{"id": r["id"], "name": r["name"]} for r in rows] + except Exception: + return [] + + def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool = True) -> dict: user = SessionManager.decode_session(request.cookies.get("flowdeck_session", "")) ws = user.get("login", "Bruno") if user else "Bruno" @@ -176,19 +191,7 @@ def _sidebar_data(request: Request, repos: list[dict], include_workspace: bool = "app_version": "4.0.3", } - # List local workspaces for user menu - local_workspaces = [] - if user: - try: - with get_conn() as conn: - ws_rows = conn.execute( - "SELECT id, name FROM workspaces WHERE owner_id = ? ORDER BY name", - (user["id"],) - ).fetchall() - local_workspaces = [{"id": r["id"], "name": r["name"]} for r in ws_rows] - except Exception: - pass - sidebar["local_workspaces"] = local_workspaces + sidebar["local_workspaces"] = _local_workspaces_for_user(user) return sidebar diff --git a/app/templates/_header.html b/app/templates/_header.html index f085e78..c98fdd6 100644 --- a/app/templates/_header.html +++ b/app/templates/_header.html @@ -67,7 +67,7 @@ @mouseleave="dragCloseTimer()"> @@ -110,7 +110,7 @@
- + ›