// Landing.jsx — Компонент Studio (purple glass)
const { useState, useEffect, useRef } = React;
// ───── Cursor ─────
function Cursor() {
const dotRef = useRef(null);
const ringRef = useRef(null);
const [hover, setHover] = useState(false);
useEffect(() => {
let rx = innerWidth/2, ry = innerHeight/2, dx = rx, dy = ry, raf;
const onMove = (e) => { rx = e.clientX; ry = e.clientY; if (dotRef.current) dotRef.current.style.transform = `translate(${rx}px, ${ry}px) translate(-50%,-50%)`; };
const tick = () => { dx += (rx-dx)*0.18; dy += (ry-dy)*0.18; if (ringRef.current) ringRef.current.style.transform = `translate(${dx}px, ${dy}px) translate(-50%,-50%)`; raf = requestAnimationFrame(tick); };
const onOver = (e) => setHover(!!e.target.closest('a, button, .kmp-magnetic, .kmp-project-card, .kmp-faq-q, .kmp-service'));
addEventListener('mousemove', onMove); addEventListener('mouseover', onOver);
raf = requestAnimationFrame(tick);
return () => { removeEventListener('mousemove', onMove); removeEventListener('mouseover', onOver); cancelAnimationFrame(raf); };
}, []);
return (<>
>);
}
// ───── Magnetic ─────
function Magnetic({ children, strength = 0.3, className = '' }) {
const ref = useRef(null);
useEffect(() => {
const el = ref.current; if (!el) return;
const onMove = (e) => {
const r = el.getBoundingClientRect();
const x = e.clientX - r.left - r.width/2, y = e.clientY - r.top - r.height/2;
el.style.transform = `translate(${x*strength}px, ${y*strength}px)`;
};
const onLeave = () => { el.style.transform = ''; };
el.addEventListener('mousemove', onMove); el.addEventListener('mouseleave', onLeave);
return () => { el.removeEventListener('mousemove', onMove); el.removeEventListener('mouseleave', onLeave); };
}, [strength]);
return {children} ;
}
// ───── Floating glass shapes with parallax (icons inside) ─────
const SHAPES = [
{ x: '4%', y: '8%', w: 240, h: 240, r: 36, depth: 0.04, rot: -12, op: 0.9, icon: 'spark' },
{ x: '12%', y: '40%', w: 180, h: 180, r: 28, depth: 0.06, rot: 8, op: 0.8, icon: 'grid' },
{ x: '78%', y: '10%', w: 280, h: 280, r: 40, depth: 0.05, rot: 14, op: 0.7, icon: 'arrow' },
{ x: '83%', y: '52%', w: 200, h: 200, r: 32, depth: 0.08, rot: -6, op: 0.85, icon: 'orbit' },
{ x: '34%', y: '78%', w: 160, h: 160, r: 24, depth: 0.1, rot: 22, op: 0.7, icon: 'plus' },
{ x: '62%', y: '82%', w: 220, h: 220, r: 36, depth: 0.07, rot: -16, op: 0.75, icon: 'serif' },
{ x: '46%', y: '12%', w: 140, h: 140, r: 22, depth: 0.12, rot: 6, op: 0.6, icon: 'wave' },
];
// ───── Icons rendered inside hero shapes ─────
function ShapeIcon({ kind, size }) {
const s = Math.round(size * 0.46);
const stroke = 'rgba(255,255,255,0.85)';
const sw = Math.max(1.5, size * 0.012);
if (kind === 'spark') return (
);
if (kind === 'grid') return (
);
if (kind === 'arrow') return (
);
if (kind === 'orbit') return (
);
if (kind === 'plus') return (
);
if (kind === 'serif') return (
К
);
if (kind === 'wave') return (
);
return null;
}
function Shapes() {
const refs = useRef([]);
useEffect(() => {
let mx = 0, my = 0, raf;
const onMove = (e) => { mx = (e.clientX / innerWidth - 0.5) * 2; my = (e.clientY / innerHeight - 0.5) * 2; };
const tick = () => {
refs.current.forEach((el, i) => {
if (!el) return;
const s = SHAPES[i];
const tx = mx * 30 * s.depth * 8;
const ty = my * 20 * s.depth * 8;
el.style.transform = `translate(${tx}px, ${ty}px) rotate(${s.rot}deg)`;
});
raf = requestAnimationFrame(tick);
};
addEventListener('mousemove', onMove);
raf = requestAnimationFrame(tick);
return () => { removeEventListener('mousemove', onMove); cancelAnimationFrame(raf); };
}, []);
return (
{SHAPES.map((s, i) => (
refs.current[i] = el}
className="kmp-shape"
style={{
left: s.x, top: s.y,
width: s.w, height: s.h,
borderRadius: s.r,
opacity: s.op,
transform: `rotate(${s.rot}deg)`,
transition: 'transform .35s cubic-bezier(.2,.8,.25,1)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
}}>
))}
);
}
// ───── Logo mark ─────
function LogoMark() {
return (
);
}
// ───── Lang switcher ─────
function FlagSVG({ code }) {
// Small rounded flag pills, viewBox 18x12
if (code === 'ru') return (
);
if (code === 'en') return (
);
if (code === 'es') return (
);
return null;
}
function LangSwitch() {
const { lang, setLang } = window.useT();
const [open, setOpen] = useState(false);
const wrapRef = useRef(null);
const current = window.LANGS.find(l => l.id === lang) || window.LANGS[0];
useEffect(() => {
if (!open) return;
const onDoc = (e) => {
if (wrapRef.current && !wrapRef.current.contains(e.target)) setOpen(false);
};
const onKey = (e) => { if (e.key === 'Escape') setOpen(false); };
document.addEventListener('mousedown', onDoc);
document.addEventListener('keydown', onKey);
return () => {
document.removeEventListener('mousedown', onDoc);
document.removeEventListener('keydown', onKey);
};
}, [open]);
return (
setOpen(o => !o)}
aria-haspopup="listbox"
aria-expanded={open}
aria-label="Change language"
>
{current.label}
{window.LANGS.map(l => (
{ setLang(l.id); setOpen(false); }}
>
{l.label}
{lang === l.id && (
)}
))}
);
}
// ───── Nav ─────
function Nav() {
const { t } = window.useT();
return (
);
}
// ───── Hero ─────
function Hero() {
const { t, dict } = window.useT();
return (
{t('hero.titleL1')}
{t('hero.titleL2')}
{t('hero.sub')}
);
}
// ───── Marquee ─────
function Marquee() {
const { dict } = window.useT();
const items = dict.marquee.map((label, i) => ({ t: label, o: i % 2 === 1 }));
const repeat = [...items, ...items, ...items];
return (
{repeat.map((it, i) => {it.t} )}
);
}
// ───── Projects (featured) ─────
// Data lives in projects-data.js (window.PROJECTS). The landing shows only the
// first FEATURED_COUNT of the active filter; "Все проекты" links to Projects.html.
function Projects({ density }) {
const { t, dict } = window.useT();
const all = window.PROJECTS;
const N = window.FEATURED_COUNT || 4;
const featured = all.slice(0, N);
const moreHref = 'Projects.html';
return (
);
}
// ───── Services ─────
const SERVICE_META = [
{ num: '01', glyph: 'asterisk', preview: 'identity' },
{ num: '02', glyph: 'square', preview: 'web' },
{ num: '03', glyph: 'ui', preview: 'uxui' },
{ num: '04', glyph: 'code', preview: 'dev' },
{ num: '05', glyph: 'chat', preview: 'smm' },
{ num: '06', glyph: 'link', preview: 'outsource' },
{ num: '07', glyph: 'sparkle', preview: 'ai' },
];
function Glyph({ kind }) {
const stroke = 'currentColor';
if (kind === 'asterisk') return ;
if (kind === 'square') return ;
if (kind === 'ui') return ;
if (kind === 'code') return ;
if (kind === 'chat') return ;
if (kind === 'link') return ;
if (kind === 'sparkle') return ;
}
// Stylized preview "photos" — small mockups demonstrating each discipline
function ServicePreview({ kind }) {
if (kind === 'identity') return (
{/* faint grid */}
{/* back business card */}
{/* front business card */}
Компонент
IDENTITY · LOGOMARK · STATIONERY
);
if (kind === 'web') return (
{/* browser chrome */}
{/* page content */}
{/* hero panel */}
WEB · UI · PRODUCT DESIGN
);
if (kind === 'type') return (
{/* baseline guides */}
{/* big Aa */}
Aa
{/* tick marks */}
{/* specimen lines */}
Komponent Serif
Display · 12 styles
Quick brown
fox jumps over
the lazy dog —
a b c d e f g h i j
0 1 2 3 4 5 6 7 8 9
TYPE · LETTERING · TYPESETTING
);
if (kind === 'motion') return (
{/* timeline at bottom */}
00:00 00:12
{/* concentric pulses */}
{/* motion trail dots */}
{/* easing curve */}
MOTION · KINETIC · MICRO-INTERACTIONS
);
if (kind === 'uxui') return (
{/* wireframe phones */}
{/* annotations panel */}
FLOW · 03/12
UX/UI · FLOWS · PROTOTYPES
);
if (kind === 'dev') return (
{/* editor */}
app.tsx
{/* gutter */}
1 2 3
4 5 6
7 8 9
{/* code lines */}
{/* terminal */}
$ npm run build
✓ compiled in 1.24s
CODE · BUILD · SHIP
);
if (kind === 'smm') return (
{/* phone with feed */}
{/* story bar */}
{/* post */}
♥ 2.4k 💬 184 ↗ 56
{/* analytics card */}
REACH · 7 DAYS
+248K
▲ 32% vs last
{/* bar chart */}
SMM · CONTENT · GROWTH
);
if (kind === 'outsource') return (
{/* team avatars + connection lines */}
{/* central node = client */}
YOU
{/* role cards */}
{[
{ x: 50, y: 36, role: 'Designer', dot: '#b39bff' },
{ x: 222, y: 36, role: 'Developer', dot: '#7cdc8f' },
{ x: 36, y: 140, role: 'Producer', dot: '#ffcc66' },
{ x: 236, y: 140, role: 'Strategist', dot: '#7da7ff' },
{ x: 136, y: 174, role: 'Motion', dot: '#ff7dcc' },
].map((p, i) => (
{p.role}
))}
OUTSOURCING · SPRINTS · INTEGRATION
);
if (kind === 'ai') return (
{/* generative noise dots */}
{Array.from({ length: 30 }).map((_, i) => {
const x = (i * 47) % 320;
const y = (i * 31) % 220;
const r = (i % 3) * 0.5 + 0.4;
return ;
})}
{/* video frame mock */}
{/* generative avatar silhouette */}
{/* scan lines */}
{/* play */}
{/* REC dot */}
REC · GEN
{/* prompt strip */}
PROMPT
a luminous brand spot, dusk light, slow dolly…
{/* sparkle */}
AI · GENERATIVE VIDEO · ADS
);
return null;
}
const SERVICE_PHOTOS = {
identity: 'assets/svc-identity.png',
web: 'assets/svc-web.png',
uxui: 'assets/svc-uxui.png',
dev: 'assets/svc-dev.png',
smm: 'assets/svc-smm.png',
outsource: 'assets/svc-outsource.png',
ai: 'assets/svc-ai.png',
};
function Services() {
const { dict } = window.useT();
const wrapRef = useRef(null);
const previewRef = useRef(null);
const [active, setActive] = useState(null);
const targetRef = useRef({ x: 0, y: 0 });
const posRef = useRef({ x: 0, y: 0 });
useEffect(() => {
let raf;
const tick = () => {
posRef.current.x += (targetRef.current.x - posRef.current.x) * 0.15;
posRef.current.y += (targetRef.current.y - posRef.current.y) * 0.15;
if (previewRef.current) {
previewRef.current.style.setProperty('--px', posRef.current.x + 'px');
previewRef.current.style.setProperty('--py', posRef.current.y + 'px');
}
raf = requestAnimationFrame(tick);
};
raf = requestAnimationFrame(tick);
return () => cancelAnimationFrame(raf);
}, []);
const handleMove = (e, i) => {
const rect = wrapRef.current.getBoundingClientRect();
targetRef.current = { x: e.clientX - rect.left, y: e.clientY - rect.top };
if (active !== i) {
posRef.current = { ...targetRef.current };
setActive(i);
}
};
return (
{dict.services.titleA} {dict.services.titleB}
setActive(null)}
>
{SERVICE_META.map((s, i) => {
const item = dict.services.items[i];
return (
handleMove(e, i)}
>
{s.num}
→
);
})}
{SERVICE_META.map((s, i) => {
const photo = SERVICE_PHOTOS[s.preview];
const hasScene = window.ServiceScene && ['web', 'dev', 'smm', 'outsource', 'ai'].includes(s.preview);
return (
{photo
?
: hasScene
?
:
}
);
})}
);
}
// ───── About ─────
function About() {
const { dict } = window.useT();
return (
{dict.about.titleA} {dict.about.titleB}
{dict.about.meta.map((m, i) => (
))}
{dict.about.stats.map((s, i) => (
{s.num}
{s.lbl}
))}
);
}
// ───── Process ─────
const STEP_NUMS = ['01','02','03','04','05','06','07'];
// Color progression: bar nodes/fill go white → green; cards go red-orange → green.
const STEP_START = '#ffffff';
const CARD_START = '#ff5c1a';
const STEP_END = '#22c55e';
function _hex(h) { const n = parseInt(h.slice(1), 16); return [n >> 16 & 255, n >> 8 & 255, n & 255]; }
function _toHex(rgb) { return '#' + rgb.map(v => Math.round(v).toString(16).padStart(2, '0')).join(''); }
function mixHex(a, b, t) {
const A = _hex(a), B = _hex(b);
return _toHex([A[0] + (B[0]-A[0])*t, A[1] + (B[1]-A[1])*t, A[2] + (B[2]-A[2])*t]);
}
function stepProgress(i, n) { return n > 1 ? i / (n - 1) : 0; }
function Process() {
const { dict } = window.useT();
const steps = dict.process.steps;
const [active, setActive] = useState(0);
const scrollerRef = useRef(null);
// Mobile carousel: advance active when the active card's midpoint
// scrolls past the viewport's left edge.
useEffect(() => {
const el = scrollerRef.current;
if (!el) return;
const mql = window.matchMedia('(max-width: 720px)');
let rafId = 0;
const onScroll = () => {
if (!mql.matches) return;
if (rafId) cancelAnimationFrame(rafId);
rafId = requestAnimationFrame(() => {
const cards = el.querySelectorAll('.kmp-process-step');
const scrollLeft = el.scrollLeft;
for (let i = 0; i < cards.length; i++) {
const cardLeft = cards[i].offsetLeft;
const cardWidth = cards[i].offsetWidth;
// active while card midpoint is still right of the viewport's left edge
if (cardLeft + cardWidth / 2 > scrollLeft) {
setActive(i);
return;
}
}
setActive(cards.length - 1);
});
};
el.addEventListener('scroll', onScroll, { passive: true });
return () => {
el.removeEventListener('scroll', onScroll);
if (rafId) cancelAnimationFrame(rafId);
};
}, []);
const fillPct = ((active + 1) / steps.length) * 100;
return (
{dict.process.titleA} {dict.process.titleB}
{steps.map((s, i) => {
const stepCol = mixHex(STEP_START, STEP_END, stepProgress(i, steps.length));
return (
{STEP_NUMS[i]}
);
})}
{dict.process.stepLabel} {String(active + 1).padStart(2,'0')} / {String(steps.length).padStart(2,'0')}
{Math.round(fillPct)}%
{steps.map((s, i) => {
const cardCol = mixHex(CARD_START, STEP_END, stepProgress(i, steps.length));
return (
setActive(i)}
>
{STEP_NUMS[i]}
{i === steps.length - 1 &&
{s.dur}
}
{s.t}
);
})}
);
}
// ───── FAQ ─────
function FAQ() {
const { dict } = window.useT();
const items = dict.faq.items;
const [open, setOpen] = useState(0);
return (
{dict.faq.titleA} {dict.faq.titleB}
{items.map((f, i) => (
setOpen(open === i ? -1 : i)}>
{String(i+1).padStart(2,'0')}
))}
);
}
// ───── Contacts block (below FAQ) ─────
function ContactsBlock() {
const { dict } = window.useT();
const c = dict.contactsBlock;
const socials = dict.footer.social.links;
return (
);
}
// ───── Contact ─────
function Contact() {
const { dict } = window.useT();
const c = dict.contact;
const [email, setEmail] = React.useState('');
const [name, setName] = React.useState('');
const [promo, setPromo] = React.useState('');
const [descr, setDescr] = React.useState('');
const [status, setStatus] = React.useState('idle'); // idle | sending | sent | error
const valid = email.trim() !== '' && name.trim() !== '';
async function handleSubmit(e) {
e.preventDefault();
if (!valid || status === 'sending') return;
setStatus('sending');
// Заявка уходит на почту через formsubmit.co.
// Поменяйте адрес ниже на нужный e-mail получателя.
const TO_EMAIL = 'cheremisinilya@yandex.ru';
try {
const res = await fetch('https://formsubmit.co/ajax/' + TO_EMAIL, {
method: 'POST',
headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' },
body: JSON.stringify({
_subject: 'Новая заявка с сайта Component Studio',
'Почта / telegram': email,
'ФИО': name,
'Промокод': promo || '—',
'Описание проекта': descr || '—',
}),
});
if (!res.ok) throw new Error('bad status');
setStatus('sent');
setEmail(''); setName(''); setPromo(''); setDescr('');
} catch (err) {
setStatus('error');
}
}
return (
);
}
// ───── Footer ─────
function Footer() {
const { t, dict } = window.useT();
return (
{dict.footer.contact.title}
{dict.footer.contact.rows.map((row, i) => (
))}
{dict.footer.studio.title}
{dict.footer.studio.lines.map((line, i) => (
{line}
))}
{dict.footer.social.title}
{dict.footer.social.links.map((link, i) => (
{link.label}
))}
);
}
// ───── Mobile menu (floating button, bottom-left) ─────
const MOBILE_NAV_LINKS = [
{ href: '#works', key: 'nav.projects' },
{ href: '#services', key: 'nav.services' },
{ href: '#process', key: 'nav.process' },
{ href: '#faq', key: 'nav.faq' },
];
function MobileMenu() {
const { t } = window.useT();
const [open, setOpen] = useState(false);
useEffect(() => {
if (!open) return;
const onKey = (e) => { if (e.key === 'Escape') setOpen(false); };
document.addEventListener('keydown', onKey);
return () => document.removeEventListener('keydown', onKey);
}, [open]);
return (
);
}
// ───── Cookie Banner ─────
function CookieBanner() {
const { dict } = window.useT();
const [visible, setVisible] = useState(false);
useEffect(() => {
try {
if (!localStorage.getItem('kmp-cookie-consent')) setVisible(true);
} catch (e) { setVisible(true); }
}, []);
const dismiss = (choice) => {
try { localStorage.setItem('kmp-cookie-consent', choice); } catch (e) {}
setVisible(false);
};
if (!visible) return null;
return (
dismiss('declined')}>
{dict.cookies.decline}
dismiss('accepted')}>
{dict.cookies.accept}
);
}
// ───── App ─────
const ACCENTS = [
{ id: 'violet', val: { bg1: '#1a0d4a', bg2: '#4a1ea8', bg3: '#7a3dd6', glow: '#a87dff' } },
{ id: 'indigo', val: { bg1: '#0d1340', bg2: '#1e3da8', bg3: '#3d7ad6', glow: '#7da7ff' } },
{ id: 'magenta', val: { bg1: '#3d0d4a', bg2: '#a01e8c', bg3: '#d63d9c', glow: '#ff7dcc' } },
{ id: 'teal', val: { bg1: '#0d3a4a', bg2: '#1e8a8a', bg3: '#3dc6b8', glow: '#7df0d8' } },
{ id: 'midnight', val: { bg1: '#0a0a2a', bg2: '#2a2a5a', bg3: '#4a4a8a', glow: '#7d8dff' } },
];
const DEFAULTS = /*EDITMODE-BEGIN*/{
"accent": "violet",
"density": "spacious"
}/*EDITMODE-END*/;
function App() {
const { dict, lang, setLang } = window.useT();
const [tweaks, setTweak] = window.useTweaks ? window.useTweaks(DEFAULTS) : [DEFAULTS, () => {}];
const accent = ACCENTS.find(a => a.id === tweaks.accent) || ACCENTS[0];
useEffect(() => {
const root = document.documentElement;
root.style.setProperty('--bg-1', accent.val.bg1);
root.style.setProperty('--bg-2', accent.val.bg2);
root.style.setProperty('--bg-3', accent.val.bg3);
root.style.setProperty('--bg-glow', accent.val.glow);
document.querySelector('.kmp-root').style.background = `
radial-gradient(ellipse 80% 60% at 70% 30%, ${accent.val.glow}88, transparent 60%),
radial-gradient(ellipse 70% 50% at 20% 80%, ${accent.val.bg3}80, transparent 60%),
linear-gradient(180deg, ${accent.val.bg2} 0%, ${accent.val.bg1} 50%, #0d0530 100%)
`;
}, [accent]);
const TP = window.TweaksPanel;
const TS = window.TweakSection;
const TR = window.TweakRadio;
return (
{TP && (
{window.LANGS.map(l => (
setLang(l.id)} style={{
flex: 1, height: 32, borderRadius: 6, cursor: 'pointer',
border: lang === l.id ? '1.5px solid #fff' : '1px solid rgba(255,255,255,0.15)',
background: lang === l.id ? 'rgba(255,255,255,0.18)' : 'rgba(255,255,255,0.04)',
color: '#fff', fontSize: 12, fontWeight: 600, letterSpacing: '0.06em',
}}>{l.label}
))}
{ACCENTS.map(a => (
setTweak('accent', a.id)} title={dict.tweaks.colors[a.id]} style={{
height: 36, borderRadius: 8,
border: tweaks.accent === a.id ? '2px solid #fff' : '1px solid rgba(255,255,255,0.2)',
background: `linear-gradient(135deg, ${a.val.bg2}, ${a.val.glow})`,
cursor: 'pointer'
}} />
))}
{dict.tweaks.colors[accent.id]}
{TR && (
setTweak('density', v)} options={[
{ value: 'spacious', label: dict.tweaks.spacious },
{ value: 'compact', label: dict.tweaks.compact },
]} />
)}
)}
);
}
ReactDOM.createRoot(document.getElementById('root')).render( );