From 2df4d2d7709eed5daa2aea43c8fc80190c6bf3c9 Mon Sep 17 00:00:00 2001 From: 3252a8 <3252a8@proton.me> Date: Thu, 30 Apr 2026 00:06:31 +0300 Subject: [PATCH] feat: tune webapp visual --- .dockerignore | 1 + .gitignore | 1 + Dockerfile | 3 + bot/app/web/frontend/src/App.svelte | 1621 +- bot/app/web/frontend/src/PreviewBoard.svelte | 7 +- .../src/lib/components/ui/dialog.svelte | 5 +- .../src/lib/components/ui/input.svelte | 5 + bot/app/web/frontend/src/styles.css | 790 +- bot/app/web/subscription_webapp.py | 57 +- bot/app/web/templates/subscription_webapp.css | 1175 -- .../web/templates/subscription_webapp.html | 4 +- bot/app/web/templates/subscription_webapp.js | 14138 ---------------- .../subscription_webapp.tailwind.css | 916 - locales/en.json | 122 +- locales/ru.json | 122 +- 15 files changed, 2092 insertions(+), 16875 deletions(-) delete mode 100644 bot/app/web/templates/subscription_webapp.css delete mode 100644 bot/app/web/templates/subscription_webapp.js delete mode 100644 bot/app/web/templates/subscription_webapp.tailwind.css diff --git a/.dockerignore b/.dockerignore index c8a6475..4ce4d8e 100644 --- a/.dockerignore +++ b/.dockerignore @@ -28,6 +28,7 @@ tmp/ # WebApp build artifacts (regenerated inside Docker) bot/app/web/templates/subscription_webapp.css +bot/app/web/templates/subscription_webapp.js bot/app/web/templates/subscription_webapp.min.*.js # Byte-compiled / optimized / DLL files diff --git a/.gitignore b/.gitignore index fbbc6d4..3dca910 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ node_modules/ # WebApp build artifacts (regenerated by `npm run build:webapp` / Docker build) bot/app/web/templates/subscription_webapp.css +bot/app/web/templates/subscription_webapp.js bot/app/web/templates/subscription_webapp.min.*.js tmp .claude diff --git a/Dockerfile b/Dockerfile index c664076..dd1f6db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,9 +37,12 @@ COPY . . # Replace template assets with freshly built ones RUN rm -f bot/app/web/templates/subscription_webapp.css \ + bot/app/web/templates/subscription_webapp.js \ bot/app/web/templates/subscription_webapp.min.*.js COPY --from=webapp-builder /webapp/bot/app/web/templates/subscription_webapp.css \ bot/app/web/templates/subscription_webapp.css +COPY --from=webapp-builder /webapp/bot/app/web/templates/subscription_webapp.js \ + bot/app/web/templates/subscription_webapp.js COPY --from=webapp-builder /webapp/bot/app/web/templates/subscription_webapp.min.*.js \ bot/app/web/templates/ diff --git a/bot/app/web/frontend/src/App.svelte b/bot/app/web/frontend/src/App.svelte index de703a2..5df0bc5 100644 --- a/bot/app/web/frontend/src/App.svelte +++ b/bot/app/web/frontend/src/App.svelte @@ -1,29 +1,30 @@ - {brandTitle} -{#if isPreviewBoard} - -{:else} -
- {#if mode === "loading"} -
-
- {#if CFG.logoUrl} - - {:else} - {brandEmoji} - {/if} + + {#key currentLang} + {#if isPreviewBoard} + + {:else} +
+ {#if mode === "loading"} +
+
+ {#if CFG.logoUrl} + + {:else} + {brandEmoji} + {/if} +
+
{t("wa_loading")}
-
Загрузка...
-
- {:else if mode === "login"} + {:else if mode === "login"}
{#if screen === "code"}
-
-

Подтверждение по email

-

Мы отправили код на {pendingEmail}

+

{t("wa_email_verification_title")}

+

{t("wa_email_sent_to", { email: pendingEmail })}

@@ -841,7 +1383,7 @@ inputmode="numeric" autocomplete="one-time-code" maxlength="6" - aria-label="Код подтверждения" + aria-label={t("wa_email_code_aria")} /> {#if authStatus}
{authStatus}
{/if} -
{:else}
- {/if}
@@ -947,269 +1535,125 @@
- -
- -
-

{subscription.active ? "Подписка активна" : "Подписка не активна"}

-

{subscription.end_date_text ? `до ${subscription.end_date_text}` : subscription.remaining_text}

+ + {#if subscription.active} +
+ +
+

{t("wa_home_subscription_active")} | {activeSubscriptionTermLabel(subscription)}

+

{subscription.end_date_text ? t("wa_until_date", { date: subscription.end_date_text }) : subscription.remaining_text}

+
-
+ {:else} +
+ +

{t("wa_home_subscription_inactive")}

+
+ {/if} - -
- Использовано трафика - {trafficLabel(subscription)} -
-
- -
-
{trafficPercent(subscription)}%
-
+ {#if subscription.active} + +
+ {t("wa_home_traffic_used")} + {trafficLabel(subscription)} +
+
+ +
+
+ {trafficResetLabel(subscription)} + {trafficPercent(subscription)}% +
+
+ {/if}
- - -
- {:else if screen === "tariff-select"} -
-
- -
-

Выбор тарифа

-

Экраны тарифов пока сверстаны без подключения

-
- -
-
- {#each demoTariffs as tariff} - - {/each} -
- -
- {:else if screen === "payment"} -
-
- -
-

Подписка

-

Выберите срок подписки

-
- -
-
- {#each plans as plan} - - {/each} -
- - Итого
К оплате
- {selectedPlan ? formatMoney(selectedPlan.price, selectedPlan.currency) : "..."} -
-
- {#if methods.length} - {#each methods as method} - {@const meta = methodMeta(method)} - - {/each} - {:else} - Способы оплаты пока не настроены - {/if} -
- -
- {:else if screen === "traffic-payment"} -
-
- -
-

Трафик

-

Выберите пакет трафика

-
- -
-
- {#each trafficPackages as pack} - - {/each} -
- - Итого
К оплате
- {formatMoney(selectedTrafficPackage.price)} -
-
- {#each DEV_MOCK.data.payment_methods as method} - {@const meta = methodMeta(method)} - - {/each} -
- -
- {:else if screen === "change-tariff"} -
-
- -
-

Смена тарифа

-

Остаток 12 дней будет пересчитан

-
- -
-
- {#each changeTariffs as tariff} - - {/each} -
- -
{:else if screen === "invite"}
- -
Ваша реферальная ссылка
-
- {referral.webapp_link || referral.bot_link || "Ссылка пока недоступна"} - -
-
- -
- Ваш бонус - +7 дней за каждого друга -

Друг получит +3 дня к подписке после регистрации.

+
+ +
+ {t("wa_referral_bonus_overview_title")} + {#if referralOneBonusPerReferee} +

{t("wa_referral_bonus_once_note")}

+ {/if} +
+
+

{t("wa_referral_link_title")}

+
+ {referral.webapp_link || referral.bot_link || t("wa_link_unavailable")} + +
+
+ {#if referralBonusDetails.length || referralWelcomeBonusDays > 0} +
+ {#if referralWelcomeBonusDays > 0} +
+ {t("wa_referral_bonus_registration_title")} + {t("wa_referral_bonus_friend_days", { days: referralWelcomeBonusDays })} +
+ {/if} + {#if referralBonusDetails.length} +

{t("wa_referral_bonus_paid_intro")}

+ {/if} + {#each referralBonusDetails as bonus, index (bonus.months || index)} +
+ {bonus.title || `${bonus.months || "?"}`} + {t("wa_referral_bonus_you_days", { days: Number(bonus.inviter_days || 0) })} + {t("wa_referral_bonus_friend_days", { days: Number(bonus.friend_days || 0) })} +
+ {/each} +
+ {:else} +

{t("wa_referral_bonus_not_configured")}

+ {/if} -
Промокод
+

+ + {t("wa_activate_promo_title")} +

- +
+ + (promoFieldError = "")} + /> + {#if promoFieldError} + + + + {/if} + {#if promoFieldError} + + {promoFieldError} + + {/if} + +
- {#if promoStatus} + {#if promoStatus && !(promoIsError && promoFieldError)}

{promoStatus}

{/if}
@@ -1219,7 +1663,7 @@
{#if profileAvatarUrl} - Аватар пользователя + {t("wa_settings_avatar_alt")} {:else} {/if} @@ -1230,25 +1674,108 @@ {profileTelegramId}
+
- - - + + + + {t("wa_settings_language")} + + + {currentLanguageOption?.label || userLanguage} + + + + + + + {#each languageOptions as option (option.value)} + + + + {option.label} + + + + {/each} + + + +
+ {#if supportUrl} + + {/if} + {#if userAgreementUrl} + + {/if} + {#if privacyPolicyUrl} + + {/if}
@@ -1256,45 +1783,165 @@ {/if} {#if screen === "home" || screen === "invite" || screen === "settings"} -
- {/if} - (confirmTariffOpen = false)} - > -
- - -
-
+ +
+
+ {#each plans as plan} + + {/each} +
+ +
+ {#if methods.length} + {#each methods as method} + {@const meta = methodMeta(method)} + + {/each} + {:else} + {t("wa_payment_methods_not_configured")} + {/if} +
+ +
+
+ + +
+ {#if !linkEmailPending} +
+ + (linkEmailFieldError = "")} + /> + {#if linkEmailFieldError} + + + + {/if} + {#if linkEmailFieldError} + + {linkEmailFieldError} + + {/if} + +
+ + {:else} + + {/if} + {#if linkEmailStatus} +

{linkEmailStatus}

+ {/if} +
+
+ {/if} {#if toastText}
{toastText}
+ {/if} +
{/if} -
-{/if} + {/key} + + diff --git a/bot/app/web/frontend/src/PreviewBoard.svelte b/bot/app/web/frontend/src/PreviewBoard.svelte index 09cfabf..feb94e0 100644 --- a/bot/app/web/frontend/src/PreviewBoard.svelte +++ b/bot/app/web/frontend/src/PreviewBoard.svelte @@ -197,11 +197,12 @@
Вход по email
- +
Email
или
- +
-
Нет аккаунта? Создать
diff --git a/bot/app/web/frontend/src/lib/components/ui/dialog.svelte b/bot/app/web/frontend/src/lib/components/ui/dialog.svelte index 9b34e81..c05d31a 100644 --- a/bot/app/web/frontend/src/lib/components/ui/dialog.svelte +++ b/bot/app/web/frontend/src/lib/components/ui/dialog.svelte @@ -6,6 +6,7 @@ export let open = false; export let title = ""; export let description = ""; + export let closeLabel = "Close"; export let onclose = () => {}; let className = ""; export { className as class }; @@ -13,14 +14,14 @@ {#if open}