fix: update cost estimate on domain toggle, switch to English, fix toggle overflow

- Cost calculation now reads custom domain price from PlatformSetting
  as fallback when no CUSTOM_DOMAIN_ADDON pricing rule exists
- Convert all custom domain UI text from Persian to English
- Fix toggle switch overflow by adding shrink-0, min-w-0, and proper
  absolute positioning

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-14 00:49:20 +03:30
parent 435cf92817
commit 30ccfa4ee2
4 changed files with 77 additions and 60 deletions
+7 -7
View File
@@ -145,15 +145,15 @@ export class DomainService {
const fullPlatformUrl = `${app.subdomain}.${platformDomain}`;
const instructions = [
`1. وارد پنل مدیریت دامنه خود شوید (مانند Cloudflare، Namecheap، GoDaddy و غیره)`,
`2. به بخش مدیریت DNS بروید`,
`3. یک رکورد CNAME اضافه کنید:`,
` - Name/Host: @ یا www (بسته به دامنه‌تان)`,
`1. Log in to your domain registrar (e.g. Cloudflare, Namecheap, GoDaddy)`,
`2. Go to DNS management for your domain`,
`3. Add a CNAME record:`,
` - Name/Host: @ or www (depending on your domain)`,
` - Type: CNAME`,
` - Value/Target: ${fullPlatformUrl}`,
`4. اگر از دامنه اصلی (root domain) بدون www استفاده می‌کنید، برخی ثبت‌کنندگان از CNAME flattening پشتیبانی می‌کنند (مانند Cloudflare). در غیر این صورت از www استفاده کنید.`,
`5. بین ۵ تا ۳۰ دقیقه صبر کنید تا DNS منتشر شود (تا ۴۸ ساعت ممکن است طول بکشد)`,
`6. دکمه "تأیید DNS" را بزنید`,
`4. If using a root domain (without www), some registrars support CNAME flattening (e.g. Cloudflare). Otherwise use www.`,
`5. Wait 5-30 minutes for DNS propagation (may take up to 48 hours)`,
`6. Click the "Verify DNS" button`,
];
return {
+12
View File
@@ -203,6 +203,18 @@ export class BillingService {
}
}
// If custom domain is enabled but no CUSTOM_DOMAIN_ADDON rule exists, use PlatformSetting price
if (hasCustomDomain && !breakdown.some((b) => b.label === 'Custom domain + SSL')) {
const setting = await this.settingsRepo.findOne({ where: { key: 'custom_domain_monthly_price_toman' } });
const monthlyPrice = setting ? Number(setting.value) : 0;
if (monthlyPrice > 0) {
const hourly = Math.round(monthlyPrice / 720);
const yearly = monthlyPrice * 12;
breakdown.push({ label: 'Custom domain + SSL', hourly, monthly: monthlyPrice, yearly });
totalBase += baseCycle === 'monthly' ? monthlyPrice : baseCycle === 'hourly' ? hourly : yearly;
}
}
const hourlyTotal = baseCycle === 'hourly' ? totalBase : baseCycle === 'monthly' ? totalBase / 720 : totalBase / 8640;
const monthlyTotal = baseCycle === 'monthly' ? totalBase : baseCycle === 'hourly' ? totalBase * 720 : totalBase / 12;
const yearlyTotal = baseCycle === 'yearly' ? totalBase : baseCycle === 'monthly' ? totalBase * 12 : totalBase * 8640;