// app.jsx — главный сборщик
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"mood": "earth",
"logoVariant": "loop",
"heroTitle": "Кухонные отходы\nстановятся\nживой землёй",
"heroSub": "Компактная вермиферма для квартиры. \nСилами дождевых червей превращает очистки в премиум-удобрение — биогумус. \nБез запаха. Без хлопот. Без химии.",
"fontDisplay": "Lora",
"fontBody": "Manrope",
"showAbout": true,
"showAnatomy": true,
"showProcess": true,
"showResult": true,
"showBenefits": true,
"showNumbers": true,
"showQuotes": true,
"showProducts": true,
"showRoadmap": true,
"showSurvey": true,
"showResults": true,
"showFAQ": true,
"showContact": true
}/*EDITMODE-END*/;
const FONT_DISPLAY_OPTIONS = ["Lora", "Cormorant Garamond", "Playfair Display", "Spectral"];
const FONT_BODY_OPTIONS = ["Manrope", "Inter", "Geist", "PT Sans"];
function initTelegramMiniApp() {
const tg = window.Telegram?.WebApp;
const localSmoke = ["127.0.0.1", "localhost"].includes(window.location.hostname)
? new URLSearchParams(window.location.search).get("tg_init_data_smoke")
: "";
const initData = tg?.initData || localSmoke;
if (!initData || window.__TG_INIT_DATA) return;
const params = new URLSearchParams(window.location.search);
const targetId = params.get("section") || window.location.hash.replace(/^#/, "") || "survey";
window.__TG_WEB_APP = tg || { close: () => document.documentElement.setAttribute("data-tg-closed", "1") };
window.__TG_INIT_DATA = initData;
document.documentElement.setAttribute("data-tg", "1");
try { tg.ready(); } catch (e) {}
try { tg.expand(); } catch (e) {}
requestAnimationFrame(() => {
requestAnimationFrame(() => {
const target = document.getElementById(targetId);
if (target) target.scrollIntoView({ block: "start", behavior: "auto" });
});
});
}
function App() {
initTelegramMiniApp();
const [t, setTweak] = useTweaks(TWEAK_DEFAULTS);
// apply mood to
React.useEffect(() => {
document.documentElement.setAttribute("data-mood", t.mood);
}, [t.mood]);
// apply font choice
React.useEffect(() => {
document.documentElement.style.setProperty(
"--f-display",
`"${t.fontDisplay}", "Source Serif Pro", Georgia, serif`
);
document.documentElement.style.setProperty(
"--f-body",
`"${t.fontBody}", ui-sans-serif, system-ui, -apple-system, sans-serif`
);
}, [t.fontDisplay, t.fontBody]);
React.useEffect(() => {
const scrollToHash = () => {
const id = window.location.hash.replace(/^#/, "");
if (!id) return;
window.requestAnimationFrame(() => {
const target = document.getElementById(id);
if (target) target.scrollIntoView({ block: "start" });
});
};
scrollToHash();
window.addEventListener("hashchange", scrollToHash);
return () => window.removeEventListener("hashchange", scrollToHash);
}, []);
return (
<>
{/* Sticky nav */}