feat: Notion page editor — top bar, share modal, star toggle, empty toolbar
Replicates Notion's page layout from reference images: - Top bar: Private badge, Share button, Link copy, Star/favorite toggle, ⋮ menu - Share modal: Publish toggle, Copy link, Invite people with permission select - Empty page toolbar: Get started with H1/H2/H3/bullet/todo/callout/quote - Star toggle integrated with favorites API (POST/DELETE /board/api/favorites) - board.py view_page now passes workspace context + page_favorited - dashboard.py view_page_root also passes page_favorited - CSS: .page-topbar, .share-modal, .empty-page-toolbar, toggle switch, more menu
This commit is contained in:
+13
-2
@@ -720,8 +720,19 @@ async def view_page(request: Request, page_id: int):
|
||||
row = conn.execute("SELECT * FROM pages WHERE id=?", (page_id,)).fetchone()
|
||||
if not row:
|
||||
return HTMLResponse("<h2>Page not found</h2>", status_code=404)
|
||||
sidebar = _sidebar_data(request)
|
||||
ctx = {**sidebar, "page": dict(row)}
|
||||
page = dict(row)
|
||||
ws = page.get("workspace", "")
|
||||
parts = ws.split("/") if "/" in ws else ["", ""]
|
||||
owner, repo = parts[0], parts[1] if len(parts) > 1 else ""
|
||||
sidebar = _sidebar_data(request, owner, repo)
|
||||
# Check if page is favorited
|
||||
user = SessionManager.decode_session(request.cookies.get("flowdeck_session", ""))
|
||||
uid = user["id"] if user and user.get("id") else 1
|
||||
with get_conn() as conn:
|
||||
fav = conn.execute(
|
||||
"SELECT id FROM favorites WHERE user_id=? AND page_id=?", (uid, page_id)
|
||||
).fetchone()
|
||||
ctx = {**sidebar, "page": page, "page_favorited": fav is not None}
|
||||
template = env.get_template("page_editor.html")
|
||||
return template.render(**ctx)
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ async def view_page_root(request: Request, page_id: int):
|
||||
"SELECT id, title FROM pages WHERE parent_id=? ORDER BY updated_at DESC",
|
||||
(page_id,),
|
||||
).fetchall()
|
||||
ctx = {**sidebar, "page": page, "sub_pages": [dict(s) for s in subs]}
|
||||
ctx = {**sidebar, "page": page, "sub_pages": [dict(s) for s in subs], "page_favorited": False}
|
||||
template = env.get_template("page_editor.html")
|
||||
return template.render(**ctx)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user