From 65d61a0359f90a7864bc02ec9876f211eb7a2fdf Mon Sep 17 00:00:00 2001 From: b3ni15 Date: Sun, 21 Dec 2025 00:17:00 +0100 Subject: [PATCH] feat: add custom deposit amount input in LobbyScreen --- src/screens/LobbyScreen.js | 71 +++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/src/screens/LobbyScreen.js b/src/screens/LobbyScreen.js index ec3fb4c..70acd81 100644 --- a/src/screens/LobbyScreen.js +++ b/src/screens/LobbyScreen.js @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { ActivityIndicator, StyleSheet, Text, View } from 'react-native'; +import { ActivityIndicator, StyleSheet, Text, TextInput, View } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import { useStripe } from '@stripe/stripe-react-native'; import { apiFetch } from '../api'; @@ -11,6 +11,7 @@ export default function LobbyScreen({ user, token, onLogout, onSelectTable, onRe const [loading, setLoading] = useState(true); const [depositLoading, setDepositLoading] = useState(false); const [depositError, setDepositError] = useState(''); + const [customAmount, setCustomAmount] = useState(''); const { initPaymentSheet, presentPaymentSheet } = useStripe(); const loadTables = async () => { @@ -75,6 +76,9 @@ export default function LobbyScreen({ user, token, onLogout, onSelectTable, onRe } }; + const customValue = Number(customAmount); + const customValid = Number.isFinite(customValue) && customValue >= 50 && customValue <= 100; + return ( @@ -91,6 +95,29 @@ export default function LobbyScreen({ user, token, onLogout, onSelectTable, onRe handleDeposit(50)} variant="gold" disabled={depositLoading} /> handleDeposit(100)} variant="gold" disabled={depositLoading} /> + + + Egyedi összeg + + setCustomAmount(value.replace(/[^0-9]/g, ''))} + placeholder="pl. 75" + placeholderTextColor="rgba(255,255,255,0.35)" + keyboardType="number-pad" + style={styles.customInput} + /> + Ft + + Minimum 50 Ft, maximum 100 Ft. + + handleDeposit(customValue)} + variant="gold" + disabled={depositLoading || !customValid} + /> + {depositError ? {depositError} : null} @@ -163,6 +190,48 @@ const styles = StyleSheet.create({ flexDirection: 'row', gap: 12 }, + customRow: { + marginTop: 12, + flexDirection: 'row', + alignItems: 'flex-end', + justifyContent: 'space-between', + gap: 12 + }, + customInputWrap: { + flex: 1 + }, + customLabel: { + color: colors.text, + fontFamily: fonts.body, + marginBottom: 6 + }, + customInputRow: { + flexDirection: 'row', + alignItems: 'center', + backgroundColor: 'rgba(255,255,255,0.08)', + borderRadius: 12, + paddingHorizontal: 12, + paddingVertical: 10, + borderWidth: 1, + borderColor: 'rgba(255,255,255,0.12)' + }, + customInput: { + flex: 1, + color: colors.text, + fontFamily: fonts.mono, + fontSize: 16 + }, + customSuffix: { + color: colors.muted, + fontFamily: fonts.mono, + marginLeft: 8 + }, + customHint: { + color: colors.muted, + fontFamily: fonts.body, + fontSize: 11, + marginTop: 6 + }, tableList: { gap: 12 },