Add hub iframe embed shell with tab fragment API.

Replace full-page soft nav with a persistent shell and /api/embed/page loads so tab switches in the hub iframe avoid document.write flicker.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-06-24 01:13:34 +08:00
parent 157d9ada21
commit 4ad335ca84
15 changed files with 2711 additions and 31 deletions
+26
View File
@@ -0,0 +1,26 @@
from instance_embed_lib import (
EMBED_TABS,
path_to_embed_tab,
rewrite_embed_dest,
)
def test_path_to_embed_tab():
assert path_to_embed_tab("/trade") == "trade"
assert path_to_embed_tab("/key_monitor") == "key_monitor"
assert path_to_embed_tab("/strategy/records") == "strategy_records"
assert path_to_embed_tab("/unknown") is None
def test_rewrite_embed_dest():
url = rewrite_embed_dest("/trade", hub_theme="dark")
assert url.startswith("/embed?")
assert "tab=trade" in url
assert "embed=1" in url
assert "hub_theme=dark" in url
def test_embed_tabs_cover_main_nav():
assert "trade" in EMBED_TABS
assert "key_monitor" in EMBED_TABS
assert "records" in EMBED_TABS