From fb25df6f0f5dee55fc40496e29bf22c94efc27b3 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Mon, 9 Feb 2026 11:23:33 +0300 Subject: [PATCH] feat: add empty state for connection page when no apps configured Show different messages depending on user role: - Regular users see a friendly "check back later" message - Admins see a prompt with a link to /admin/apps settings --- src/locales/en.json | 6 +++- src/locales/fa.json | 6 +++- src/locales/ru.json | 6 +++- src/locales/zh.json | 6 +++- src/pages/Connection.tsx | 70 +++++++++++++++++++++++++++++++++++++--- 5 files changed, 86 insertions(+), 8 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index df1bd61..395d587 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -355,7 +355,11 @@ "selectPlatform": "Select platform", "app": "app", "apps": "apps", - "tutorial": "Tutorial" + "tutorial": "Tutorial", + "notConfigured": "Connection methods are not configured yet", + "notConfiguredUser": "Connection setup is in progress. Please check back later.", + "notConfiguredAdmin": "No connection apps have been configured. Set them up in the Apps settings.", + "goToApps": "Go to Apps settings" }, "myDevices": "My Devices", "noDevices": "No connected devices", diff --git a/src/locales/fa.json b/src/locales/fa.json index c1be32b..5ffd5a5 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -307,7 +307,11 @@ "selectPlatform": "انتخاب پلتفرم", "app": "برنامه", "apps": "برنامه", - "tutorial": "آموزش" + "tutorial": "آموزش", + "notConfigured": "روش‌های اتصال هنوز پیکربندی نشده‌اند", + "notConfiguredUser": "تنظیمات اتصال در حال انجام است. لطفاً بعداً مراجعه کنید.", + "notConfiguredAdmin": "هیچ برنامه اتصالی پیکربندی نشده است. آن‌ها را در تنظیمات برنامه‌ها تنظیم کنید.", + "goToApps": "رفتن به تنظیمات برنامه‌ها" }, "additionalOptions": { "title": "گزینه‌های اضافی", diff --git a/src/locales/ru.json b/src/locales/ru.json index bd2f537..e4bb5c1 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -377,7 +377,11 @@ "selectPlatform": "Выберите платформу", "app": "приложение", "apps": "приложений", - "tutorial": "Инструкция" + "tutorial": "Инструкция", + "notConfigured": "Способы подключения ещё не настроены", + "notConfiguredUser": "Настройка подключения в процессе. Пожалуйста, загляните позже.", + "notConfiguredAdmin": "Приложения для подключения не настроены. Настройте их в разделе Приложения.", + "goToApps": "Перейти к настройке приложений" }, "myDevices": "Мои устройства", "noDevices": "Нет подключенных устройств", diff --git a/src/locales/zh.json b/src/locales/zh.json index 3fc8ca5..61f417d 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -307,7 +307,11 @@ "selectPlatform": "选择平台", "app": "个应用", "apps": "个应用", - "tutorial": "教程" + "tutorial": "教程", + "notConfigured": "连接方式尚未配置", + "notConfiguredUser": "连接设置正在进行中,请稍后再来查看。", + "notConfiguredAdmin": "尚未配置连接应用。请在应用设置中进行配置。", + "goToApps": "前往应用设置" }, "additionalOptions": { "title": "附加选项", diff --git a/src/pages/Connection.tsx b/src/pages/Connection.tsx index a68d271..d862b16 100644 --- a/src/pages/Connection.tsx +++ b/src/pages/Connection.tsx @@ -1,5 +1,5 @@ -import { useEffect, useCallback, useRef } from 'react'; -import { useNavigate } from 'react-router'; +import { useEffect, useCallback, useMemo, useRef } from 'react'; +import { Link, useNavigate } from 'react-router'; import { useTranslation } from 'react-i18next'; import { useQuery } from '@tanstack/react-query'; import { openLink as sdkOpenLink } from '@telegram-apps/sdk-react'; @@ -8,13 +8,13 @@ import { useTelegramSDK } from '../hooks/useTelegramSDK'; import { useHaptic } from '@/platform'; import { resolveTemplate, hasTemplates } from '../utils/templateEngine'; import { useAuthStore } from '../store/auth'; -import type { AppConfig } from '../types'; +import type { AppConfig, RemnawavePlatformData } from '../types'; import InstallationGuide from '../components/connection/InstallationGuide'; export default function Connection() { const { t, i18n } = useTranslation(); const navigate = useNavigate(); - const { user } = useAuthStore(); + const { user, isAdmin } = useAuthStore(); const { isTelegramWebApp } = useTelegramSDK(); const { impact: hapticImpact } = useHaptic(); @@ -79,6 +79,14 @@ export default function Connection() { [isTelegramWebApp, i18n.language, resolveUrl], ); + // Check if any platform has configured apps + const hasApps = useMemo(() => { + if (!appConfig?.platforms) return false; + return Object.values(appConfig.platforms).some( + (p: RemnawavePlatformData) => p.apps && p.apps.length > 0, + ); + }, [appConfig?.platforms]); + // Loading if (isLoading) { return ( @@ -115,6 +123,60 @@ export default function Connection() { ); } + // No apps configured + if (!hasApps) { + return ( +
+
+ + + +
+

+ {t('subscription.connection.notConfigured')} +

+

+ {isAdmin + ? t('subscription.connection.notConfiguredAdmin') + : t('subscription.connection.notConfiguredUser')} +

+ {isAdmin && ( + + + + + + {t('subscription.connection.goToApps')} + + )} +
+ ); + } + return (