From 3c4ff66150a8f925c33386c261bf386d238af8a7 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Sun, 24 May 2026 19:10:36 +0300 Subject: [PATCH] feat: streamline admin tariff settings --- .../src/admin/sections/SettingsSection.svelte | 73 +----- .../src/admin/sections/TariffsSection.svelte | 246 ++++++++++-------- frontend/src/styles/admin.css | 5 + locales/en.json | 37 +++ locales/ru.json | 47 +++- tests/test_admin_settings_manifest_i18n.py | 76 ++++++ 6 files changed, 305 insertions(+), 179 deletions(-) diff --git a/frontend/src/admin/sections/SettingsSection.svelte b/frontend/src/admin/sections/SettingsSection.svelte index 0630027..9524ecf 100644 --- a/frontend/src/admin/sections/SettingsSection.svelte +++ b/frontend/src/admin/sections/SettingsSection.svelte @@ -7,7 +7,6 @@ EyeOff, FileText, Search, - TriangleAlert, X, } from "$components/ui/icons.js"; import * as UiIcons from "$components/ui/icons.js"; @@ -28,7 +27,12 @@ const settingsStore = getContext("settingsStore"); $: ({ settingsSections, settingsLoading, settingsDirty, settingsSaving } = $settingsStore); - $: visibleSettingsSections = settingsSections.filter((section) => section.id !== "appearance"); + + const SETTINGS_SECTION_IDS_HIDDEN_IN_GENERAL_SETTINGS = new Set(["appearance", "pricing"]); + + $: visibleSettingsSections = settingsSections.filter( + (section) => !SETTINGS_SECTION_IDS_HIDDEN_IN_GENERAL_SETTINGS.has(section.id) + ); let settingsOpenSections = []; let settingsOpenSubsections = {}; @@ -41,22 +45,11 @@ const PLATEGA_SBP_KEYS = new Set(["PLATEGA_SBP_ENABLED", "PLATEGA_SBP_METHOD"]); const PLATEGA_CRYPTO_KEYS = new Set(["PLATEGA_CRYPTO_ENABLED", "PLATEGA_CRYPTO_METHOD"]); const PLATEGA_LEGACY_KEYS = new Set(["PLATEGA_PAYMENT_METHOD"]); - const LEGACY_TARIFF_TRAFFIC_KEYS = new Set(["TRAFFIC_PACKAGES", "STARS_TRAFFIC_PACKAGES"]); - const TRIAL_TARIFF_KEYS = new Set([ - "TRIAL_ENABLED", - "TRIAL_DURATION_DAYS", - "TRIAL_TRAFFIC_LIMIT_GB", - "TRIAL_TRAFFIC_STRATEGY", - "TRIAL_SQUAD_UUIDS", - ]); const SEMANTIC_FIELD_GROUP_ORDER = { platega_common: 1, platega_sbp: 2, platega_crypto: 3, platega_legacy: 4, - trial_tariff_settings: 0, - legacy_tariff_periods: 1, - legacy_tariff_traffic: 2, }; $: settingsAllOpen = @@ -289,42 +282,10 @@ ); } - function legacyTariffSemanticGroup(field) { - const key = String(field?.key || ""); - if (TRIAL_TARIFF_KEYS.has(key)) { - return fieldGroupMeta( - "trial_tariff_settings", - "settings_group_trial_tariff_settings", - "Trial access", - "settings_group_trial_tariff_settings_hint", - "Trial duration, traffic limit, and Remnawave squads are also available on the Tariffs page." - ); - } - if (LEGACY_TARIFF_TRAFFIC_KEYS.has(key)) { - return fieldGroupMeta( - "legacy_tariff_traffic", - "settings_group_legacy_tariff_traffic", - "Legacy traffic packages", - "settings_group_legacy_tariff_traffic_hint", - "Packages used only when the JSON tariff catalog is not configured." - ); - } - return fieldGroupMeta( - "legacy_tariff_periods", - "settings_group_legacy_tariff_periods", - "Legacy subscription periods", - "settings_group_legacy_tariff_periods_hint", - "Month toggles and prices used only by the old remnawave-tg-shop mode." - ); - } - function semanticFieldGroup(section, group, field) { if (section?.id === "payments" && group?.id === "Platega") { return plategaSemanticGroup(field); } - if (section?.id === "pricing") { - return legacyTariffSemanticGroup(field); - } return null; } @@ -471,25 +432,6 @@ {/snippet} -{#snippet renderLegacyTariffsWarning()} -
- {at( - "settings_legacy_tariffs_warning_body", - {}, - "These settings are ignored when tariffs are configured in the dedicated Tariffs section." - )} -
-