Layout
HTML layout templates and page rendering utilities.
Provides the base page structure including sidebar navigation and main content area.
All dashboard pages are rendered through render_page which wraps content in the
standard layout with navigation and base styles.
SIDEBAR_HTML = '\n<aside class="sidebar">\n <div class="sidebar-header">\n <h1>OneSecondTrader</h1>\n </div>\n <nav class="sidebar-nav">\n <a href="/backtest" class="{backtest_active}">\n <svg fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"></path></svg>\n Backtest\n </a>\n </nav>\n</aside>\n'
module-attribute
render_sidebar(active='')
Render the sidebar navigation HTML.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
active
|
str
|
Name of the currently active page for highlighting. |
''
|
Returns:
| Type | Description |
|---|---|
str
|
HTML string for the sidebar. |
Source code in src/onesecondtrader/dashboard/layout.py
render_page(title, content, active='')
Render a complete HTML page with layout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
title
|
str
|
Page title displayed in the browser tab. |
required |
content
|
str
|
HTML content to render in the main content area. |
required |
active
|
str
|
Name of the currently active page for sidebar highlighting. |
''
|
Returns:
| Type | Description |
|---|---|
str
|
Complete HTML document string. |