Source code for bacommon.docui.routes.classicaccount

# Released under the MIT License. See LICENSE for details.
#
"""Routes for the classic account doc-ui domain (``classicaccount``).

Pages about an account, served by the master server: the place to link
to whenever an account is shown (a party member's verified account, a
stats row, and so on). Other domains open them through local-actions of
their own (see ``TypedDocUIController.browse_from()`` on the client).
"""

from __future__ import annotations  # Docs-generation hack.

from dataclasses import dataclass
from typing import Annotated, override

from efro.dataclassio import ioprepped, IOAttrs

import bacommon.docui.v2 as dui2
from bacommon.docui.routes import (
    DocUIRoute,
    DocUILocalActionBase,
    family_members,
)


[docs] class ClassicAccountRoute(DocUIRoute): """Family class for classic account routes."""
[docs] @override @classmethod def get_route_types(cls) -> tuple[type[DocUIRoute], ...]: return family_members(AnyClassicAccountRoute)
[docs] @override @classmethod def get_window_layout(cls) -> dui2.WindowLayout: return dui2.WindowLayout.WIDE_TALL
[docs] @ioprepped @dataclass class Account(ClassicAccountRoute, path='/account'): """About one account.""" #: The account (``a-XXX``). account_id: str
# All routes in the family (just the one for now). AnyClassicAccountRoute = Account
[docs] class ClassicAccountLocalAction(DocUILocalActionBase): """Family class for classic account local-actions."""
[docs] @override @classmethod def get_action_types(cls) -> tuple[type[DocUILocalActionBase], ...]: return family_members(AnyClassicAccountLocalAction)
[docs] @ioprepped @dataclass class Placeholder(ClassicAccountLocalAction, name='placeholder'): """Does nothing; holds the family's place until it has real ones. (A family needs a member.) """
# All local-actions in the family. AnyClassicAccountLocalAction = Placeholder # Docs-generation hack; import some stuff that we likely only forward-declared # in our actual source code so that docs tools can find it. from typing import (Coroutine, Any, Literal, Callable, Generator, Awaitable, Sequence, Self, TypeIs) import asyncio from concurrent.futures import Future from pathlib import Path from enum import Enum