Merge pull request #111 from BEDOLAGA-DEV/dev

Dev
This commit is contained in:
Egor
2026-01-28 20:40:12 +03:00
committed by GitHub
6 changed files with 43 additions and 7 deletions

View File

@@ -86,6 +86,8 @@ export const subscriptionApi = {
total_price_kopeks?: number;
total_price_label?: string;
current_device_limit?: number;
max_device_limit?: number;
can_add?: number;
days_left?: number;
base_device_price_kopeks?: number;
}> => {

View File

@@ -320,6 +320,7 @@
"title": "Additional options",
"buyDevices": "Buy more devices",
"currentDeviceLimit": "Current limit: {{count}} devices",
"maxDevices": "max {{count}}",
"devicesUnavailable": "Device purchase is not available",
"devicesUnit": "devices",
"buy": "Buy",
@@ -484,7 +485,7 @@
"copyLink": "Copy Link",
"copied": "Copied!",
"shareButton": "Share",
"shareMessage": "Join me on and earn up to {{percent}}% cashback!",
"shareMessage": "Join me on {{botName}} and earn up to {{percent}}% cashback!",
"shareHint": "Share this link with friends. When they sign up and make a purchase, you'll earn {{percent}}% commission!",
"stats": {
"totalReferrals": "Total Referrals",

View File

@@ -229,6 +229,7 @@
"title": "گزینه‌های اضافی",
"buyDevices": "خرید دستگاه بیشتر",
"currentDeviceLimit": "محدودیت فعلی: {{count}} دستگاه",
"maxDevices": "حداکثر {{count}}",
"devicesUnavailable": "خرید دستگاه در دسترس نیست",
"devicesUnit": "دستگاه",
"buy": "خرید",
@@ -410,7 +411,7 @@
"copyLink": "کپی لینک",
"copied": "کپی شد!",
"shareButton": "اشتراک‌گذاری",
"shareMessage": "از طریق لینک من به Cabinet بپیوند و تا {{percent}}٪ پاداش بگیر!",
"shareMessage": "از طریق لینک من به {{botName}} بپیوند و تا {{percent}}٪ پاداش بگیر!",
"shareHint": "این لینک را با دوستان به اشتراک بگذارید. وقتی ثبت نام کنند و خرید کنند، {{percent}}% کمیسیون دریافت می‌کنید!",
"stats": {
"totalReferrals": "کل معرفی‌ها",

View File

@@ -342,6 +342,7 @@
"title": "Дополнительные опции",
"buyDevices": "Докупить устройства",
"currentDeviceLimit": "Текущий лимит: {{count}} устройств",
"maxDevices": "максимум {{count}}",
"devicesUnavailable": "Докупка устройств недоступна",
"devicesUnit": "устройств",
"buy": "Купить",
@@ -506,7 +507,7 @@
"copyLink": "Копировать ссылку",
"copied": "Скопировано!",
"shareButton": "Поделиться",
"shareMessage": "Заходи в Cabinet по моей ссылке и получай до {{percent}}% кешбэка!",
"shareMessage": "Заходи в {{botName}} по моей ссылке и получай до {{percent}}% кешбэка!",
"shareHint": "Поделитесь ссылкой с друзьями. Когда они зарегистрируются и оплатят, вы получите {{percent}}% комиссии!",
"stats": {
"totalReferrals": "Всего рефералов",

View File

@@ -229,6 +229,7 @@
"title": "附加选项",
"buyDevices": "购买更多设备",
"currentDeviceLimit": "当前限制:{{count}} 台设备",
"maxDevices": "最多 {{count}} 台",
"devicesUnavailable": "设备购买不可用",
"devicesUnit": "台设备",
"buy": "购买",
@@ -410,7 +411,7 @@
"copyLink": "复制链接",
"copied": "已复制!",
"shareButton": "分享",
"shareMessage": "通过我的链接加入 Cabinet,获取高达 {{percent}}% 返现!",
"shareMessage": "通过我的链接加入 {{botName}},获取高达 {{percent}}% 返现!",
"shareHint": "分享链接给朋友。当他们注册并付款后,您将获得 {{percent}}% 佣金!",
"stats": {
"totalReferrals": "总推荐数",

View File

@@ -1014,12 +1014,14 @@ export default function Subscription() {
</button>
</div>
{devicePriceData?.available === false ? (
{/* Check if completely unavailable (no subscription, price not set, etc.) */}
{devicePriceData?.available === false && !devicePriceData?.max_device_limit ? (
<div className="py-4 text-center text-sm text-dark-400">
{devicePriceData.reason || t('subscription.additionalOptions.devicesUnavailable')}
</div>
) : (
<div className="space-y-4">
{/* Device selector - show even at max limit */}
<div className="flex items-center justify-center gap-6">
<button
onClick={() => setDevicesToAdd(Math.max(1, devicesToAdd - 1))}
@@ -1036,13 +1038,40 @@ export default function Subscription() {
</div>
<button
onClick={() => setDevicesToAdd(devicesToAdd + 1)}
disabled={
devicePriceData?.max_device_limit
? (devicePriceData.current_device_limit || 0) + devicesToAdd >=
devicePriceData.max_device_limit
: false
}
className="btn-secondary flex h-12 w-12 items-center justify-center !p-0 text-2xl"
>
+
</button>
</div>
{devicePriceData && (
{/* Show limit info when at or near max */}
{devicePriceData?.max_device_limit && (
<div className="text-center text-sm text-dark-400">
{t('subscription.additionalOptions.currentDeviceLimit', {
count: devicePriceData.current_device_limit || subscription.device_limit,
})}{' '}
/{' '}
{t('subscription.additionalOptions.maxDevices', {
count: devicePriceData.max_device_limit,
})}
</div>
)}
{/* Show reason if can't add requested amount */}
{devicePriceData?.available === false && devicePriceData?.reason && (
<div className="rounded-lg bg-warning-500/10 p-3 text-center text-sm text-warning-400">
{devicePriceData.reason}
</div>
)}
{/* Price info - only when available */}
{devicePriceData?.available && devicePriceData.price_per_device_label && (
<div className="text-center">
<div className="mb-2 text-sm text-dark-400">
{devicePriceData.price_per_device_label}/
@@ -1055,7 +1084,7 @@ export default function Subscription() {
</div>
)}
{devicePriceData &&
{devicePriceData?.available &&
purchaseOptions &&
devicePriceData.total_price_kopeks &&
devicePriceData.total_price_kopeks > purchaseOptions.balance_kopeks && (
@@ -1071,6 +1100,7 @@ export default function Subscription() {
onClick={() => devicePurchaseMutation.mutate()}
disabled={
devicePurchaseMutation.isPending ||
!devicePriceData?.available ||
!!(
devicePriceData?.total_price_kopeks &&
purchaseOptions &&