Files
ELM/src/elm/pages/MyProfilePage.py
T
Typhus 1753d67752 prerelease/0.6.0 (#1)
Co-authored-by: David Rodenkirchen <drodenkirchen@linetco.com>
Reviewed-on: #1
2026-05-27 23:17:52 +00:00

55 lines
1.5 KiB
Python

from __future__ import annotations
from typing import Optional
from rio import Component, Column, Row, Spacer, page, GuardEvent
from elm.types import UserSession
from elm.components import AvatarEditBox, AccountInfoBox, PersonalInfoBox
def my_profile_page_guard(event: GuardEvent) -> Optional[str]:
try:
_ = event.session[UserSession].user_name
return None
except KeyError:
return "/"
@page(name="My Profile", url_segment="my-profile", guard=my_profile_page_guard)
class MyProfilePage(Component):
def build(self) -> Component:
if self.session.is_mobile():
return Column(
Column(
AvatarEditBox(),
Spacer(),
spacing=1
),
Column(
AccountInfoBox(),
PersonalInfoBox(),
Spacer(),
spacing=1,
grow_x=True
),
spacing=1,
margin=0.5
)
else:
return Row(
Column(
AvatarEditBox(),
Spacer(),
spacing=1
),
Column(
AccountInfoBox(),
PersonalInfoBox(),
Spacer(),
spacing=1,
grow_x=True
),
spacing=1,
margin=1,
margin_right=2
)