Template
Common templates used between pages in the app.
ADMIN_ONLY_ROUTES = set()
module-attribute
CURRENT_VERSION = backend.version.__version__
module-attribute
MAX_WAIT_FOR_LOGGED_IN_SECONDS = 3
module-attribute
MENU_EXCLUDED_ROUTES = set()
module-attribute
MENU_ROUTES = set()
module-attribute
default_meta = [{'name': 'viewport', 'content': 'width=device-width, initial-scale=1'}]
module-attribute
logger = logging.getLogger(__name__)
module-attribute
CheckLoggedInState
Bases: MyState
handle_check_logged_in_on_initial_load()
async
Continuously check whether the user is logged in for some time.
This is necessary because the way the clerk state is loaded can be delayed until after some of the on_load events are triggered. This should delay the later events until the clerk state is actually loaded.
handle_redirect_if_not_logged_in()
async
add_background(content)
add_scroll_area(content)
make_layout(page_content, additional_navbar_items, page_scrollable, requires_auth, admin_only)
menu_item_link(text, href, admin_only)
menu_stack()
The menu button on the top right of the page.
The menu button component.
navbar(page_specific_items)
The navigation bar for the app.
The navigation bar component.
page_template(route=None, title=None, image=None, description=None, meta=None, on_load=None, require_login=False, admin_only=False, additional_navbar_items=None, exclude_from_menu=False, page_scrollable=True)
The template for each page of the app.
route: The route to reach the page.
title: The title of the page.
image: The favicon of the page.
description: The description of the page.
meta: Additional meta to add to the page.
on_load: The event handler(s) called when the page loads.
require_login: Whether the page requires a Google login.
admin_only: Whether the page is only accessible to admins.
additional_navbar_items: Additional items to add to the navbar specific to the page.
exclude_from_menu: Whether to exclude the page from the menu.
page_scrollable: Whether the page should be scrollable
The template with the page content.