diff --git a/app/routers/board.py b/app/routers/board.py index ccfe352..f039572 100644 --- a/app/routers/board.py +++ b/app/routers/board.py @@ -140,9 +140,12 @@ def _build_page_tree(conn, parent_id: int | None, ws_key: str, depth: int = 0, m return items -def _file_icon(name: str) -> str: +def _file_icon(name: str, content_format: str = "") -> str: """Map file extension to emoji icon.""" import re + # FlowDeck internal pages (no extension) + if content_format and content_format != 'file': + return '📝' n = name.lower() if re.search(r'\.(png|jpe?g|gif|webp|svg|bmp|ico)$', n): return '🖼️' if n.endswith('.pdf'): return '📕' @@ -169,7 +172,7 @@ def _load_workspace_pages(ws_cookie: str) -> list: ws_id = int(ws_cookie) with get_conn() as conn: rows = conn.execute( - "SELECT id, title, parent_section FROM pages WHERE workspace_id=? AND parent_id IS NULL ORDER BY created_at DESC", + "SELECT id, title, parent_section, content_format FROM pages WHERE workspace_id=? AND parent_id IS NULL ORDER BY created_at DESC", (ws_id,), ).fetchall() items = [] @@ -179,7 +182,7 @@ def _load_workspace_pages(ws_cookie: str) -> list: items.append({ "db_id": r["id"], "name": title, "id": f"page/{r['id']}", - "icon": "📁" if is_folder else _file_icon(title), + "icon": "📁" if is_folder else _file_icon(title, r["content_format"]), "is_folder": is_folder, "children": _load_children(r["id"]), }) @@ -192,7 +195,7 @@ def _load_children(parent_id: int) -> list: """Recursively load children of a page.""" with get_conn() as conn: rows = conn.execute( - "SELECT id, title, parent_section FROM pages WHERE parent_id=? ORDER BY created_at", + "SELECT id, title, parent_section, content_format FROM pages WHERE parent_id=? ORDER BY created_at", (parent_id,), ).fetchall() children = [] @@ -202,7 +205,7 @@ def _load_children(parent_id: int) -> list: children.append({ "db_id": r["id"], "name": title, "id": f"page/{r['id']}", - "icon": "📁" if is_folder else _file_icon(title), + "icon": "📁" if is_folder else _file_icon(title, r["content_format"]), "is_folder": is_folder, "children": _load_children(r["id"]), }) diff --git a/app/templates/local_workspace.html b/app/templates/local_workspace.html index 628c07a..6e57e52 100644 --- a/app/templates/local_workspace.html +++ b/app/templates/local_workspace.html @@ -207,7 +207,7 @@ - +