add contact info to member cards, implement broken mailto link workaround

This commit is contained in:
David Rodenkirchen 2024-05-27 12:23:06 +02:00
parent 833e3ef250
commit e5c71c049e
5 changed files with 50 additions and 12 deletions

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from pathlib import Path
import rio
from from_root import from_root
from . import pages
from . import components as comps
@ -99,6 +100,11 @@ themes = [
async def on_session_start(s: rio.Session) -> None:
await s.set_title("EZ GG e.V.")
rio.Icon.register_single_icon(
set_name="custom",
icon_name="steam",
icon_source=from_root("ezgg_website/assets/icons/steam.svg")
)
# Create the Rio app
app = rio.App(

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" id="mdi-steam" viewBox="0 0 24 24"><path d="M12,2A10,10 0 0,1 22,12A10,10 0 0,1 12,22C7.4,22 3.55,18.92 2.36,14.73L6.19,16.31C6.45,17.6 7.6,18.58 8.97,18.58C10.53,18.58 11.8,17.31 11.8,15.75V15.62L15.2,13.19H15.28C17.36,13.19 19.05,11.5 19.05,9.42C19.05,7.34 17.36,5.65 15.28,5.65C13.2,5.65 11.5,7.34 11.5,9.42V9.47L9.13,12.93L8.97,12.92C8.38,12.92 7.83,13.1 7.38,13.41L2,11.2C2.43,6.05 6.73,2 12,2M8.28,17.17C9.08,17.5 10,17.13 10.33,16.33C10.66,15.53 10.28,14.62 9.5,14.29L8.22,13.76C8.71,13.58 9.26,13.57 9.78,13.79C10.31,14 10.72,14.41 10.93,14.94C11.15,15.46 11.15,16.04 10.93,16.56C10.5,17.64 9.23,18.16 8.15,17.71C7.65,17.5 7.27,17.12 7.06,16.67L8.28,17.17M17.8,9.42C17.8,10.81 16.67,11.94 15.28,11.94C13.9,11.94 12.77,10.81 12.77,9.42A2.5,2.5 0 0,1 15.28,6.91C16.67,6.91 17.8,8.04 17.8,9.42M13.4,9.42C13.4,10.46 14.24,11.31 15.29,11.31C16.33,11.31 17.17,10.46 17.17,9.42C17.17,8.38 16.33,7.53 15.29,7.53C14.24,7.53 13.4,8.38 13.4,9.42Z" /></svg>

After

Width:  |  Height:  |  Size: 993 B

View File

@ -1,14 +1,18 @@
from pathlib import Path
from dataclasses import dataclass
from typing import Optional
import rio
@dataclass
class MemberInfo:
picture_path: Path
name: str
position: str
entry_date: str
contact_mail: Optional[str]
contact_steam: Optional[str]
class MemberCard(rio.Component):
@ -21,13 +25,26 @@ class MemberCard(rio.Component):
self.margin_right = 1
def build(self) -> rio.Component:
return rio.Rectangle(
content=rio.Column(
contact_row = rio.Row()
content = rio.Column(
rio.Image(self._info.picture_path, height=9, margin_bottom=1.3),
rio.Text(self._info.name, margin_bottom=0.4, style=rio.TextStyle(font_weight="bold")),
rio.Text(self._info.position, margin_bottom=0.4, style=rio.TextStyle(italic=True)),
rio.Text(f"Mitglied seit {self._info.entry_date}", style=rio.TextStyle(italic=True), margin_bottom=0.4)
),
rio.Text(f"Mitglied seit {self._info.entry_date}", style=rio.TextStyle(italic=True), margin_bottom=0.4),
contact_row
)
# @Todo: Icon alignment broken if only one icon should be shown.
if self._info.contact_mail:
contact_row.add(rio.Link(rio.Icon("material/mail"), f"mailto://{self._info.contact_mail}", open_in_new_tab=True, margin_top=1, margin_bottom=1, align_x=0.9))
if self._info.contact_steam:
contact_row.add(rio.Link(rio.Icon("custom/steam"), self._info.contact_steam, open_in_new_tab=True, margin_top=1, margin_bottom=1, align_x=0.1))
if not self._info.contact_steam and not self._info.contact_mail:
contact_row.add(rio.Text("", margin_top=2))
return rio.Rectangle(
content=content,
fill=self.session.theme.neutral_color,
corner_radius=self.session.theme.corner_radius_medium,
shadow_radius=0.5,

View File

@ -18,7 +18,7 @@ Wir freuen uns sehr, dass du Interesse daran hast, Mitglied bei der Einfach Zock
Als Mitglied hast du die Möglichkeit, aktiv an unseren Veranstaltungen teilzunehmen und die Entwicklung des Vereins mitzugestalten. Egal, ob du ein erfahrener Gamer oder ein Neuling bist bei uns bist du herzlich willkommen!
Um Mitglied zu werden, fülle bitte das untenstehende Formular aus. Wir freuen uns darauf, dich bald in unserer Gemeinschaft begrüßen zu dürfen!
Um Mitglied zu werden, fülle bitte das untenstehende Formular aus und sende es uns [per Mail an den Vorstand](./member) oder [per Post](./imprint). Wir freuen uns darauf, dich bald in unserer Gemeinschaft begrüßen zu dürfen!
_[Mitgliedsantragsformular kommt noch, wir bitten um Geduld]_

View File

@ -16,36 +16,50 @@ class DatabaseService:
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="David \"Typhus\" R.",
position="1. Vorsitzender",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail="davidr.develop@gmail.com",
contact_steam="https://steamcommunity.com/id/originaltyphus"
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Julia \"Ravenchild\" A.",
position="2. Vorsitzende",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail="Julia-albring95@hotmail.de",
contact_steam="https://steamcommunity.com/profiles/76561198089911312"
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Jessy \"JessySixx\" R.",
position="Schatzmeisterin",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail=None,
contact_steam=None
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Tim \"Matschwicht\" B.",
position="Mitglied",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail=None,
contact_steam=None
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Dennis \"Goodman\" P.",
position="Mitglied",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail=None,
contact_steam=None
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Tom \"Tcprod\" C.",
position="Mitglied",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail=None,
contact_steam=None
), MemberInfo(
picture_path=from_root("ezgg_website/assets/member_pictures/anon.png"),
name="Chris \"Meliodas\" K.",
position="Mitglied",
entry_date="29.10.2023"
entry_date="29.10.2023",
contact_mail=None,
contact_steam=None
)
]