from __future__ import annotations

from quart import (
    request, Blueprint, g
)


def register():
    bp = Blueprint("admin", __name__, url_prefix='/admin')

    @bp.before_request
    async def _prepare_page_data():
        if "defpage_" not in (request.endpoint or ""):
            return
        from sx.sx_components import _day_admin_main_panel_html
        g.day_admin_content = _day_admin_main_panel_html({})

    from shared.sx.pages import mount_pages
    mount_pages(bp, "events", names=["day-admin"])

    return bp
