153 lines
8.4 KiB
JavaScript
153 lines
8.4 KiB
JavaScript
import { formatPrice, formatUsd } from "./config.js";
|
||
|
||
const esc = (s) => String(s).replace(/[&<>"]/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[c]);
|
||
|
||
// Тексты лендинга по языкам. Русская версия — как в SP-1, без изменений.
|
||
const TEXT = {
|
||
ru: {
|
||
title: "Универсальная финансовая модель в Excel",
|
||
description: "Финансовая модель на 7 лет в Excel: формулы, пример и пустая версия, инструкция. Для любого предпринимателя.",
|
||
lead: "Посчитайте запуск продукта или бизнеса на 7 лет вперёд: выручка, затраты, налоги, денежный поток, баланс и окупаемость в одном файле.",
|
||
buy: "Купить",
|
||
inside: "Что внутри",
|
||
items: [
|
||
"Excel-файл на русском: 7 лет, первый год помесячно, остальные по годам.",
|
||
"Выручка по трём линейкам, затраты, ФОТ, инвестиции, кредит, ОПиУ, денежный поток, упрощённый баланс.",
|
||
"Окупаемость, NPV, IRR, точка безубыточности и три сценария: базовый, пессимистичный, оптимистичный.",
|
||
"Две версии: с условным примером и пустая. Всё на формулах, без макросов и скрытых листов.",
|
||
"Инструкция на 1 страницу и лицензия на личное или внутреннее использование.",
|
||
],
|
||
forWhom: "Для кого",
|
||
audience: [
|
||
"Предпринимателям, которые считают запуск нового продукта или бизнеса.",
|
||
"Тем, кто готовит расчёты для банка, инвестора или партнёра.",
|
||
"Тем, кому нужна понятная модель без привязки к стране, программе или отрасли: налоги и валюту вы вводите сами.",
|
||
],
|
||
looks: "Как выглядит",
|
||
shots: [
|
||
["/img/dashboard.svg", "Дашборд: выручка по годам"],
|
||
["/img/pnl.svg", "Отчёт о прибылях и убытках"],
|
||
["/img/assumptions.svg", "Лист допущений с ячейками для ввода"],
|
||
],
|
||
howTo: "Как купить",
|
||
footer: "Модель — инструмент расчёта, а не финансовая, налоговая или юридическая консультация.",
|
||
offer: "Публичная оферта",
|
||
refund: "Политика возврата",
|
||
},
|
||
en: {
|
||
title: "Universal Financial Model in Excel",
|
||
description: "A 7-year financial model in Excel: formulas, a sample and an empty version, and a guide. For any entrepreneur.",
|
||
lead: "Plan a product or business launch seven years ahead: revenue, costs, taxes, cash flow, balance sheet and payback in a single file.",
|
||
buy: "Buy",
|
||
inside: "What’s inside",
|
||
items: [
|
||
"An Excel file in English: 7 years, the first year by month, the rest by year.",
|
||
"Revenue for three product lines, costs, payroll, investment, a loan, P&L, cash flow and a simplified balance sheet.",
|
||
"Payback, NPV, IRR, break-even point and three scenarios: base, pessimistic and optimistic.",
|
||
"Two versions: with sample data and empty. Everything runs on formulas, with no macros and no hidden sheets.",
|
||
"A one-page guide and a licence for personal or internal use.",
|
||
],
|
||
forWhom: "Who it’s for",
|
||
audience: [
|
||
"Entrepreneurs planning a new product or business.",
|
||
"Anyone preparing numbers for a bank, an investor or a partner.",
|
||
"Anyone who wants a clear model that isn’t tied to a country, programme or industry: you enter taxes and currency yourself.",
|
||
],
|
||
looks: "What it looks like",
|
||
shots: [
|
||
["/img/dashboard-en.svg", "Dashboard: revenue by year"],
|
||
["/img/pnl-en.svg", "Profit and loss statement"],
|
||
["/img/assumptions-en.svg", "Assumptions sheet with input cells"],
|
||
],
|
||
howTo: "How to buy",
|
||
footer: "The model is a calculation tool, not financial, tax or legal advice.",
|
||
offer: "Public offer",
|
||
refund: "Refund policy",
|
||
},
|
||
};
|
||
|
||
export function renderLanding(config, locale = "ru") {
|
||
const t = TEXT[locale];
|
||
const en = locale === "en";
|
||
const tg = `https://t.me/${encodeURIComponent(config.botUsername)}?start=${en ? "site_en" : "site"}`;
|
||
// EN: покупка ведёт на международную оплату из SP-2; пока она не выбрана — «Coming soon», оплата не принимается.
|
||
const payUrl = en ? config.intlPaymentUrl : "";
|
||
const buyHref = en && payUrl ? tg : en ? "" : tg;
|
||
const buyBtn = buyHref ? `<a class="buy" href="${buyHref}">${t.buy}</a>` : `<span class="buy off" aria-disabled="true">Coming soon</span>`;
|
||
const price = en ? formatUsd(config.priceUsd) : formatPrice(config.priceKzt);
|
||
const legal = config.legalApproved && !en ? `<p class="legal"><a href="/offer">${t.offer}</a> · <a href="/refund">${t.refund}</a></p>` : "";
|
||
const shots = t.shots
|
||
.map(([src, alt]) => `<figure><img src="${src}" alt="${esc(alt)}" loading="lazy"><figcaption>${esc(alt)}</figcaption></figure>`)
|
||
.join("");
|
||
const li = (a) => a.map((x) => `<li>${x}</li>`).join("\n");
|
||
const steps = en
|
||
? [
|
||
"Press “Buy” — the Telegram bot opens.",
|
||
`Pay ${price} using the international payment link in the bot and press “I’ve paid”.`,
|
||
"After the payment is checked, the bot sends you the English files.",
|
||
]
|
||
: [
|
||
"Нажмите «Купить» — откроется Telegram-бот.",
|
||
`Переведите ${price} через Kaspi по реквизитам в боте и нажмите «Я оплатил(а)».`,
|
||
"После проверки платежа (в рабочее время до 15 минут) бот пришлёт файлы.",
|
||
];
|
||
const howTo = en && !payUrl ? `<p>International payment is not open yet. The English version will be on sale soon.</p>` : `<ol>\n${li(steps)}\n</ol>`;
|
||
const switcher = `<nav class="lang" aria-label="Language"><a href="/"${en ? "" : ' aria-current="true"'}>RU</a> · <a href="/en"${en ? ' aria-current="true"' : ""}>EN</a></nav>`;
|
||
return `<!doctype html>
|
||
<html lang="${locale}">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>${t.title}</title>
|
||
<meta name="description" content="${t.description}">
|
||
<style>
|
||
:root{--bg:#fff;--fg:#1d2733;--muted:#5d6b7a;--brand:#1f4e78;--card:#f3f6fa}
|
||
@media (prefers-color-scheme:dark){:root{--bg:#10161d;--fg:#e8edf2;--muted:#9aa8b6;--brand:#6cb0e8;--card:#1a232d}}
|
||
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--fg);font:17px/1.55 system-ui,sans-serif}
|
||
main{max-width:860px;margin:0 auto;padding:32px 16px}
|
||
h1{font-size:2rem;line-height:1.2;margin:0 0 12px}h2{margin:40px 0 12px;color:var(--brand)}
|
||
.lead{color:var(--muted);font-size:1.15rem}
|
||
.lang{text-align:right;font-size:.9rem;color:var(--muted)}.lang a{color:var(--brand)}.lang a[aria-current]{font-weight:700;text-decoration:none;color:var(--fg)}
|
||
.buy{display:inline-block;background:var(--brand);color:#fff;padding:14px 28px;border-radius:8px;text-decoration:none;font-weight:700}
|
||
.buy.off{opacity:.55;cursor:not-allowed}
|
||
@media (prefers-color-scheme:dark){.buy{color:#10161d}}
|
||
.price{font-size:1.8rem;font-weight:700;margin:16px 0}
|
||
ul{padding-left:20px}li{margin:6px 0}
|
||
.shots{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
|
||
figure{margin:0;background:var(--card);border-radius:8px;padding:8px}img{width:100%;height:auto;display:block;border-radius:4px}
|
||
figcaption{color:var(--muted);font-size:.9rem;padding-top:6px}
|
||
.legal,footer{color:var(--muted);font-size:.9rem;margin-top:32px}
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<main>
|
||
${switcher}
|
||
<h1>${t.title}</h1>
|
||
<p class="lead">${t.lead}</p>
|
||
<p class="price">${price}</p>
|
||
${buyBtn}
|
||
|
||
<h2>${t.inside}</h2>
|
||
<ul>
|
||
${li(t.items)}
|
||
</ul>
|
||
|
||
<h2>${t.forWhom}</h2>
|
||
<ul>
|
||
${li(t.audience)}
|
||
</ul>
|
||
|
||
<h2>${t.looks}</h2>
|
||
<div class="shots">${shots}</div>
|
||
|
||
<h2>${t.howTo}</h2>
|
||
${howTo}
|
||
${buyBtn}
|
||
${legal}
|
||
<footer>${t.footer}</footer>
|
||
</main>
|
||
</body>
|
||
</html>
|
||
`;
|
||
}
|