implement more social links, change naming of e.V.

This commit is contained in:
David Rodenkirchen
2024-06-06 17:24:20 +00:00
parent 5dee350c6a
commit 09ff8c78a9
19 changed files with 152 additions and 53 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class Header(rio.Component):
texts=[
"Die EZ GG wurde in einer schlecht beleuchteten Kellerbar gegründet",
"Aktuelle hat der EZ GG e.V. sieben Mitglieder",
"Bist du auch ein Genießer? Dann tritt uns doch bei!",
"Bist du auch ein Gamer? Dann tritt uns doch bei!",
"Auch Wasser wird zum edlen Tropfen, mischt man es mit Malz und Hopfen."
],
refresh_interval=30,
+11 -23
View File
@@ -1,41 +1,29 @@
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]
from ..models import MemberInfo, SOCIAL_PLATFORM_ICON_MAP
class MemberCard(rio.Component):
info: MemberInfo
def build(self) -> rio.Component:
contact_row = rio.Row()
social_links_grid = rio.Grid(align_x=0.5, row_spacing=0.5, column_spacing=0.5, margin_bottom=0.3, height=3)
content = rio.Column(
rio.Image(self.info.picture_path, height=9, margin_bottom=1.3, margin_top=0.8),
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),
contact_row
social_links_grid
)
# @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))
for i, social_link in enumerate(self.info.socials):
social_links_grid.add(
rio.Link(
rio.Icon(SOCIAL_PLATFORM_ICON_MAP[social_link.platform], height=1.3, width=1.3, fill="primary"),
social_link.url,
open_in_new_tab=True
), i//5, i if i < 5 else i - 5)
return rio.Rectangle(
content=content,