Skip to content

Reduce boilerplate for setting up new pages #8

@richard-to

Description

@richard-to

Currently we need to make updates in two places:

side_nav.py -> to add the menu entry
main.py -> mostly boilerplate to add the page.

A lot of this is copy and paste and then make some edits.

@me.page(
  path="/",
  title="Mesop / Gemini Experiments",
  security_policy=me.SecurityPolicy(
    allowed_script_srcs=[
      "https://cdn.jsdelivr.net",
    ]
  ),
  on_load=on_load,
)
def home_demo():
  """Main Page"""
  state = me.state(AppState)
  with page_scaffold():  # pylint: disable=not-context-manager
    home_content(state)

I don't have any specific suggestions on how to reduce the boilerplate though. I think fine for now. Can always ask an LLM to write the boilerplate anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions