from rio import Column, Component, event, Spacer

from src.ezgg_lan_manager import ConfigurationService
from src.ezgg_lan_manager.components.MainViewContentBox import MainViewContentBox
from src.ezgg_lan_manager.components.UserEditForm import UserEditForm


class EditProfilePage(Component):
    @event.on_populate
    async def on_populate(self) -> None:
        await self.session.set_title(f"{self.session[ConfigurationService].get_lan_info().name} - Profil bearbeiten")

    def build(self) -> Component:
        return Column(
            MainViewContentBox(UserEditForm(is_own_profile=True)),
            Spacer(grow_y=True)
        )
