Update Support.tsx

This commit is contained in:
Egor
2026-01-16 02:37:20 +03:00
committed by GitHub
parent 083770d0c6
commit e4ce26a8df

View File

@@ -269,7 +269,11 @@ export default function Support() {
// If tickets are disabled, show redirect message // If tickets are disabled, show redirect message
if (supportConfig && !supportConfig.tickets_enabled) { if (supportConfig && !supportConfig.tickets_enabled) {
console.log('[Support] Tickets disabled, config:', supportConfig)
const getSupportMessage = () => { const getSupportMessage = () => {
console.log('[Support] Getting support message for type:', supportConfig.support_type)
if (supportConfig.support_type === 'profile') { if (supportConfig.support_type === 'profile') {
const supportUsername = supportConfig.support_username || '@support' const supportUsername = supportConfig.support_username || '@support'
console.log('[Support] Opening profile:', supportUsername) console.log('[Support] Opening profile:', supportUsername)
@@ -342,20 +346,34 @@ export default function Support() {
} }
} }
// Fallback: contact support (should not normally happen if config is correct)
const supportUsername = supportConfig.support_username || '@support' const supportUsername = supportConfig.support_username || '@support'
console.log('[Support] Fallback: Opening profile:', supportUsername)
return { return {
title: t('support.ticketsDisabled'), title: t('support.ticketsDisabled'),
message: t('support.contactSupport', { username: supportUsername }), message: t('support.contactSupport', { username: supportUsername }),
buttonText: t('support.contactUs'), buttonText: t('support.contactUs'),
buttonAction: () => { buttonAction: () => {
console.log('[Support] Fallback button clicked, opening:', supportUsername)
const webApp = window.Telegram?.WebApp const webApp = window.Telegram?.WebApp
const url = supportUsername.startsWith('@')
? `https://t.me/${supportUsername.slice(1)}` // Extract username without @
: `https://t.me/${supportUsername}` const username = supportUsername.startsWith('@')
? supportUsername.slice(1)
: supportUsername
const webUrl = `https://t.me/${username}`
console.log('[Support] Fallback opening URL:', webUrl)
if (webApp?.openTelegramLink) { if (webApp?.openTelegramLink) {
webApp.openTelegramLink(url) console.log('[Support] Fallback using openTelegramLink')
webApp.openTelegramLink(webUrl)
} else if (webApp?.openLink) {
console.log('[Support] Fallback using openLink')
webApp.openLink(webUrl)
} else { } else {
window.open(url, '_blank') console.log('[Support] Fallback using window.open')
window.open(webUrl, '_blank')
} }
}, },
} }