From 6cd9ae8d9f015c0158c2790bab09e7f2fc5260c4 Mon Sep 17 00:00:00 2001 From: David Rodenkirchen Date: Sun, 2 Feb 2025 01:06:33 +0100 Subject: [PATCH] add paypal support --- src/ez_lan_manager/pages/Account.py | 32 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/ez_lan_manager/pages/Account.py b/src/ez_lan_manager/pages/Account.py index eb585ec..446bf40 100644 --- a/src/ez_lan_manager/pages/Account.py +++ b/src/ez_lan_manager/pages/Account.py @@ -1,6 +1,7 @@ +from functools import partial from typing import Optional -from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle +from rio import Column, Component, event, Text, TextStyle, Button, Color, Revealer, Row, ProgressCircle, Link from src.ez_lan_manager import ConfigurationService, UserService, AccountingService from src.ez_lan_manager.components.MainViewContentBox import MainViewContentBox @@ -13,6 +14,7 @@ class AccountPage(Component): user: Optional[User] = None balance: Optional[int] = None transaction_history: list[Transaction] = list() + banking_info_revealer_open: bool = False @event.on_populate async def on_populate(self) -> None: @@ -22,7 +24,7 @@ class AccountPage(Component): self.transaction_history = await self.session[AccountingService].get_transaction_history(self.user.user_id) async def _on_banking_info_press(self): - self.banking_info_revealer.is_open = not self.banking_info_revealer.is_open + self.banking_info_revealer_open = not self.banking_info_revealer_open def build(self) -> Component: if not self.user and not self.balance: @@ -38,7 +40,8 @@ class AccountPage(Component): align_y=0, ) - self.banking_info_revealer = Revealer( + banking_info_revealer = Revealer( + is_open=self.bind().banking_info_revealer_open, header=None, content=Column( Text( @@ -157,16 +160,19 @@ class AccountPage(Component): margin_bottom=1, on_press=self._on_banking_info_press ), - self.banking_info_revealer, - Button( - content=Text("PAYPAL", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"), - shape="rectangle", - style="major", - color="secondary", - grow_x=True, - margin=2, - margin_top=0, - is_sensitive=False + banking_info_revealer, + Link( + content=Button( + content=Text("PAYPAL (3% Gebühr)", style=TextStyle(fill=Color.from_hex("121212"), font_size=0.8), justify="center"), + shape="rectangle", + style="major", + color="secondary", + grow_x=True, + margin=2, + margin_top=0 + ), + target_url="https://www.paypal.com/ncp/payment/89YMGVZ4S33RS", + open_in_new_tab=True ) ) ),