From 13da7177070eef349d58b9b5ecdde5201662f8cf Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 22 Jan 2026 23:54:02 +0300 Subject: [PATCH 1/2] Update ConnectionModal.tsx --- src/components/ConnectionModal.tsx | 219 ++++++++++++++++++++--------- 1 file changed, 154 insertions(+), 65 deletions(-) diff --git a/src/components/ConnectionModal.tsx b/src/components/ConnectionModal.tsx index bab8768..1dcb078 100644 --- a/src/components/ConnectionModal.tsx +++ b/src/components/ConnectionModal.tsx @@ -132,6 +132,7 @@ export default function ConnectionModal({ onClose }: ConnectionModalProps) { const [selectedApp, setSelectedApp] = useState(null) const [copied, setCopied] = useState(false) const [showAppSelector, setShowAppSelector] = useState(false) + const [selectedPlatform, setSelectedPlatform] = useState(null) const { isTelegramWebApp, isFullscreen, safeAreaInset, contentSafeAreaInset, webApp } = useTelegramWebApp() const isMobileScreen = useIsMobile() @@ -180,8 +181,12 @@ export default function ConnectionModal({ onClose }: ConnectionModalProps) { }, [onClose]) const handleBack = useCallback(() => { - setShowAppSelector(false) - }, []) + if (selectedPlatform) { + setSelectedPlatform(null) + } else { + setShowAppSelector(false) + } + }, [selectedPlatform]) useEffect(() => { const handleKeyDown = (e: KeyboardEvent) => { @@ -332,82 +337,166 @@ export default function ConnectionModal({ onClose }: ConnectionModalProps) { macos: 'macOS', linux: 'Linux', androidTV: 'Android TV', appleTV: 'Apple TV' } + const platformIcons: Record = { + ios: ( + + + + ), + android: ( + + + + ), + windows: ( + + + + ), + macos: ( + + + + ), + linux: ( + + + + ), + androidTV: ( + + + + ), + appleTV: ( + + + + ), + } + + // Step 1: Platform selection + if (!selectedPlatform) { + return ( + +
+ +

{t('subscription.connection.selectPlatform') || 'Выберите платформу'}

+
+
+ {availablePlatforms.map(platform => { + const apps = appConfig.platforms[platform] + if (!apps?.length) return null + const isCurrentPlatform = platform === detectedPlatform + const appCount = apps.length + + return ( + + ) + })} +
+
+ ) + } + + // Step 2: App selection for chosen platform + const apps = appConfig.platforms[selectedPlatform] || [] + const isCurrentPlatform = selectedPlatform === detectedPlatform + return (
-

{t('subscription.connection.selectApp')}

+
+

{platformNames[selectedPlatform] || selectedPlatform}

+ {isCurrentPlatform && ( + {t('subscription.connection.yourDevice')} + )} +
- {availablePlatforms.map(platform => { - const apps = appConfig.platforms[platform] - if (!apps?.length) return null - const isCurrentPlatform = platform === detectedPlatform - return ( -
-
- - {platformNames[platform] || platform} - - {isCurrentPlatform && ( - - {t('subscription.connection.yourDevice')} - +
+ {apps.map(app => { + const isSelected = selectedApp?.id === app.id + return ( +
-
- {apps.map(app => { - const isSelected = selectedApp?.id === app.id - return ( - - ) - })} -
-
- ) - })} + {/* App icon */} +
+ {getAppIcon(app.name)} +
+ {/* App name */} + + {app.name} + + {/* Selection indicator */} + {isSelected && ( +
+ )} + + ) + })} +
) From 50ed5bbc2bdfd7c97f722de0c14971fd834bf4be Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 22 Jan 2026 23:54:25 +0300 Subject: [PATCH 2/2] Add files via upload --- src/locales/en.json | 5 ++++- src/locales/fa.json | 6 +++++- src/locales/ru.json | 5 ++++- src/locales/zh.json | 6 +++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 66dd6a6..abf4758 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -191,7 +191,10 @@ "copied": "Link copied!", "openLink": "Open link", "instructions": "Instructions", - "changeApp": "Change app" + "changeApp": "Change app", + "selectPlatform": "Select platform", + "app": "app", + "apps": "apps" }, "myDevices": "My Devices", "noDevices": "No connected devices", diff --git a/src/locales/fa.json b/src/locales/fa.json index ea11732..39580de 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -175,7 +175,11 @@ "yourDevice": "دستگاه شما", "copyLink": "کپی لینک اشتراک", "copied": "لینک کپی شد!", - "openLink": "باز کردن لینک" + "openLink": "باز کردن لینک", + "changeApp": "تغییر برنامه", + "selectPlatform": "انتخاب پلتفرم", + "app": "برنامه", + "apps": "برنامه" } }, "balance": { diff --git a/src/locales/ru.json b/src/locales/ru.json index 25f8fbc..8ece17f 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -191,7 +191,10 @@ "copied": "Ссылка скопирована!", "openLink": "Открыть ссылку", "instructions": "Инструкция", - "changeApp": "Сменить приложение" + "changeApp": "Сменить приложение", + "selectPlatform": "Выберите платформу", + "app": "приложение", + "apps": "приложений" }, "myDevices": "Мои устройства", "noDevices": "Нет подключенных устройств", diff --git a/src/locales/zh.json b/src/locales/zh.json index 9f8bf6e..2f3b724 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -176,7 +176,11 @@ "yourDevice": "您的设备", "copyLink": "复制订阅链接", "copied": "链接已复制!", - "openLink": "打开链接" + "openLink": "打开链接", + "changeApp": "更换应用", + "selectPlatform": "选择平台", + "app": "个应用", + "apps": "个应用" } }, "balance": {