diff --git a/src/locales/en.json b/src/locales/en.json index e85fa57..970a201 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -320,7 +320,7 @@ "title": "Choose a plan to continue", "description": "Your trial period is ending soon. Select a plan to continue using VPN without restrictions." }, - "expired": { + "expiredBanner": { "title": "Subscription expired", "selectTariff": "Your subscription has expired. Choose a plan below to restore access to VPN." }, diff --git a/src/locales/ru.json b/src/locales/ru.json index 2ca16af..dfb82df 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -342,7 +342,7 @@ "title": "Выберите тариф для продолжения", "description": "Ваш пробный период скоро закончится. Выберите подходящий тариф, чтобы продолжить пользоваться VPN без ограничений." }, - "expired": { + "expiredBanner": { "title": "Подписка истекла", "selectTariff": "Ваша подписка истекла. Выберите тариф ниже, чтобы возобновить доступ к VPN." }, diff --git a/src/pages/Subscription.tsx b/src/pages/Subscription.tsx index e5b1891..00d39a7 100644 --- a/src/pages/Subscription.tsx +++ b/src/pages/Subscription.tsx @@ -181,7 +181,10 @@ export default function Subscription() { if (selectedPeriod?.traffic.selectable && (selectedPeriod.traffic.options?.length ?? 0) > 0) { result.push('traffic'); } - if (selectedPeriod && (selectedPeriod.servers.options?.length ?? 0) > 0) { + if ( + selectedPeriod && + (selectedPeriod.servers.options?.filter((s) => s.is_available).length ?? 0) > 0 + ) { result.push('servers'); } if (selectedPeriod && selectedPeriod.devices.max > selectedPeriod.devices.min) { @@ -203,7 +206,12 @@ export default function Subscription() { classicOptions.periods[0]; setSelectedPeriod(defaultPeriod); setSelectedTraffic(classicOptions.selection.traffic_value); - setSelectedServers(classicOptions.selection.servers); + const availableServerUuids = new Set( + defaultPeriod.servers.options?.filter((s) => s.is_available).map((s) => s.uuid) ?? [], + ); + setSelectedServers( + classicOptions.selection.servers.filter((uuid) => availableServerUuids.has(uuid)), + ); setSelectedDevices(classicOptions.selection.devices); } }, [classicOptions, selectedPeriod]); @@ -1636,99 +1644,101 @@ export default function Subscription() { )}
- {countriesData.countries.map((country) => { - const isCurrentlyConnected = country.is_connected; - const isSelected = selectedServersToUpdate.includes(country.uuid); - const willBeAdded = !isCurrentlyConnected && isSelected; - const willBeRemoved = isCurrentlyConnected && !isSelected; + {countriesData.countries + .filter((country) => country.is_available || country.is_connected) + .map((country) => { + const isCurrentlyConnected = country.is_connected; + const isSelected = selectedServersToUpdate.includes(country.uuid); + const willBeAdded = !isCurrentlyConnected && isSelected; + const willBeRemoved = isCurrentlyConnected && !isSelected; - return ( - - ); - })} + {country.country_code && ( + + {getFlagEmoji(country.country_code)} + + )} + + ); + })}
{(() => { @@ -2001,10 +2011,10 @@ export default function Subscription() {
- {t('subscription.expired.title')} + {t('subscription.expiredBanner.title')}
- {t('subscription.expired.selectTariff')} + {t('subscription.expiredBanner.selectTariff')}
@@ -3108,7 +3118,14 @@ export default function Subscription() { setSelectedTraffic(period.traffic.current); } if (period.servers.selected) { - setSelectedServers(period.servers.selected); + const availUuids = new Set( + period.servers.options + ?.filter((s) => s.is_available) + .map((s) => s.uuid) ?? [], + ); + setSelectedServers( + period.servers.selected.filter((uuid) => availUuids.has(uuid)), + ); } if (period.devices.current) { setSelectedDevices(period.devices.current); @@ -3193,8 +3210,9 @@ export default function Subscription() { {currentStep === 'servers' && selectedPeriod?.servers.options && (
{selectedPeriod.servers.options - // Hide Trial server for users who already have trial subscription + // Hide unavailable (disabled) servers and trial servers for existing trial users .filter((server) => { + if (!server.is_available) return false; if (subscription?.is_trial && server.name.toLowerCase().includes('trial')) { return false; }