mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: use openTelegramLink for CryptoBot payment to open invoice in Telegram
This commit is contained in:
@@ -87,7 +87,7 @@ export default function TopUpAmount() {
|
|||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { formatAmount, currencySymbol, convertAmount, convertToRub, targetCurrency } =
|
const { formatAmount, currencySymbol, convertAmount, convertToRub, targetCurrency } =
|
||||||
useCurrency();
|
useCurrency();
|
||||||
const { openInvoice } = usePlatform();
|
const { openInvoice, openTelegramLink, openLink } = usePlatform();
|
||||||
const haptic = useHaptic();
|
const haptic = useHaptic();
|
||||||
const inputRef = useRef<HTMLInputElement>(null);
|
const inputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
@@ -281,6 +281,15 @@ export default function TopUpAmount() {
|
|||||||
: convertAmount(rub).toFixed(currencyDecimals);
|
: convertAmount(rub).toFixed(currencyDecimals);
|
||||||
const isPending = topUpMutation.isPending || starsPaymentMutation.isPending;
|
const isPending = topUpMutation.isPending || starsPaymentMutation.isPending;
|
||||||
|
|
||||||
|
const handleOpenPayment = () => {
|
||||||
|
if (!paymentUrl) return;
|
||||||
|
if (paymentUrl.includes('t.me/')) {
|
||||||
|
openTelegramLink(paymentUrl);
|
||||||
|
} else {
|
||||||
|
openLink(paymentUrl);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleCopyUrl = async () => {
|
const handleCopyUrl = async () => {
|
||||||
if (!paymentUrl) return;
|
if (!paymentUrl) return;
|
||||||
try {
|
try {
|
||||||
@@ -478,15 +487,14 @@ export default function TopUpAmount() {
|
|||||||
|
|
||||||
<p className="text-sm text-dark-400">{t('balance.clickToOpenPayment')}</p>
|
<p className="text-sm text-dark-400">{t('balance.clickToOpenPayment')}</p>
|
||||||
|
|
||||||
<a
|
<button
|
||||||
href={paymentUrl}
|
type="button"
|
||||||
target="_blank"
|
onClick={handleOpenPayment}
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="flex h-12 w-full items-center justify-center gap-2 rounded-xl bg-success-500 font-bold text-white transition-colors hover:bg-success-400 active:bg-success-600"
|
className="flex h-12 w-full items-center justify-center gap-2 rounded-xl bg-success-500 font-bold text-white transition-colors hover:bg-success-400 active:bg-success-600"
|
||||||
>
|
>
|
||||||
<ExternalLinkIcon />
|
<ExternalLinkIcon />
|
||||||
<span>{t('balance.openPaymentPage')}</span>
|
<span>{t('balance.openPaymentPage')}</span>
|
||||||
</a>
|
</button>
|
||||||
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<div className="min-w-0 flex-1 rounded-lg border border-dark-700/50 bg-dark-800/70 px-3 py-2">
|
<div className="min-w-0 flex-1 rounded-lg border border-dark-700/50 bg-dark-800/70 px-3 py-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user