experiments/arena/components/side_nav.py [34:114]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        "align": "bottom",
    },
]


def on_sidenav_menu_click(e: me.ClickEvent):  # pylint: disable=unused-argument
    """Side navigation menu click handler"""
    state = me.state(AppState)
    state.sidenav_open = not state.sidenav_open


def navigate_to(e: me.ClickEvent):
    """navigate to a specific page"""
    s = me.state(AppState)
    idx = int(e.key)
    print(f"idx: {idx}")

    page = get_page_by_id(idx)
    if page is None:
        print(f"requested {idx}, but couldn't find page with that id.")
        return

    print(f"navigating to: {page}")
    s.current_page = page["route"]
    me.navigate(s.current_page)
    yield


def get_page_by_id(page_id):
    """Gets the page object with the given ID.

    Args:
      page_json: A list of page objects (dictionaries).
      page_id: The ID of the page to retrieve.

    Returns:
      The page object (dictionary) if found, or None if not found.
    """
    for page in page_json:
        if page["id"] == page_id:
            return page
    return None


@me.component
def sidenav(current_page: str):
    """Render side navigation"""
    app_state = me.state(AppState)
    # print(f"received current page: {current_page}")

    with me.sidenav(
        opened=True,
        style=me.Style(
            width=SIDENAV_MAX_WIDTH if app_state.sidenav_open else SIDENAV_MIN_WIDTH,
            background=me.theme_var("secondary-container"),
        ),
    ):
        with me.box(
            style=me.Style(
                margin=me.Margin(top=16, left=16, right=16, bottom=16),
                display="flex",
                flex_direction="column",
                gap=5,
            ),
        ):
            with me.box(
                style=me.Style(
                    display="flex",
                    flex_direction="row",
                    gap=5,
                    align_items="center",
                ),
            ):
                with me.content_button(
                    type="icon",
                    on_click=on_sidenav_menu_click,
                ):
                    with me.box():
                        with me.tooltip(message="Expand menu"):
                            me.icon(icon="menu")
                if app_state.sidenav_open:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



experiments/veo-app/components/side_nav.py [36:114]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        "align": "bottom",
    },
]


def on_sidenav_menu_click(e: me.ClickEvent):  # pylint: disable=unused-argument
    """Side navigation menu click handler"""
    state = me.state(AppState)
    state.sidenav_open = not state.sidenav_open


def navigate_to(e: me.ClickEvent):
    """navigate to a specific page"""
    s = me.state(AppState)
    idx = int(e.key)
    print(f"idx: {idx}")

    page = get_page_by_id(idx)
    if page is None:
        print(f"requested {idx}, but couldn't find page with that id.")
        return

    print(f"navigating to: {page}")
    s.current_page = page["route"]
    me.navigate(s.current_page)
    yield

def get_page_by_id(page_id):
    """Gets the page object with the given ID.

    Args:
      page_json: A list of page objects (dictionaries).
      page_id: The ID of the page to retrieve.

    Returns:
      The page object (dictionary) if found, or None if not found.
    """
    for page in page_json:
        if page["id"] == page_id:
            return page
    return None

@me.component
def sidenav(current_page: str):
    """Render side navigation"""
    app_state = me.state(AppState)
    # print(f"received current page: {current_page}")

    with me.sidenav(
        opened=True,
        style=me.Style(
            width=SIDENAV_MAX_WIDTH if app_state.sidenav_open else SIDENAV_MIN_WIDTH,
            background=me.theme_var("secondary-container"),
        ),
    ):
        with me.box(
            style=me.Style(
                margin=me.Margin(top=16, left=16, right=16, bottom=16),
                display="flex",
                flex_direction="column",
                gap=5,
            ),
        ):
            with me.box(
                style=me.Style(
                    display="flex",
                    flex_direction="row",
                    gap=5,
                    align_items="center",
                ),
            ):
                with me.content_button(
                    type="icon",
                    on_click=on_sidenav_menu_click,
                ):
                    with me.box():
                        with me.tooltip(message="Expand menu"):
                            me.icon(icon="menu")
                if app_state.sidenav_open:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



