// Packages — matches old site: Boost / Signature (featured) / Komplettpaket / Custom
// Animated: staggered card reveal + magnetic hover tilt + gold sheen sweep
const { useState: useSt, useRef: useR, useEffect: useEf } = React;
function Packages({ lang }) {
const t = (de, pl) => lang === 'de' ? de : pl;
const [visible, setVisible] = useSt(false);
const sectionRef = useR(null);
useEf(() => {
const obs = new IntersectionObserver(([e]) => {
if (e.isIntersecting) { setVisible(true); obs.disconnect(); }
}, { threshold: 0.2 });
if (sectionRef.current) obs.observe(sectionRef.current);
return () => obs.disconnect();
}, []);
const tiers = [
{ name: 'Boost', price: t('Auf Anfrage','Na zapytanie'),
f: [t('2x Social-Media-Videos','2x filmy na media społecznościowe'),
t('Videoproduzent bei Bedarf','Producent wideo w razie potrzeby'),
t('Thumbnails inklusive','Thumbnails w cenie'),
t('Skript & Musik','Skrypt i muzyka')],
cta: t('Anfragen','Zapytaj') },
{ name: 'Signature', price: t('Auf Anfrage','Na zapytanie'),
f: [t('4x Social Media Videos','4x filmy Social Media'),
t('N8N Einrichtung + Datenbank','Konfiguracja N8N + baza danych'),
t('1x KI-Automatisierung','1x Automatyzacja AI'),
t('WhatsApp Priority-Support < 24h','WhatsApp Priority-Support < 24h')],
cta: t('Anfragen','Zapytaj'), popular: true },
{ name: t('Komplettpaket','Pełny pakiet'), price: t('Auf Anfrage','Na zapytanie'),
f: [t('Alles aus Signature inklusive','Wszystko z Signature w cenie'),
t('8 Videos pro Monat','8 filmów miesięcznie'),
t('Content-Plan & Strategie','Plan treści i strategia'),
t('Kanalverwaltung & Werbeanzeigen','Zarządzanie kanałami i reklamy')],
cta: t('Anfragen','Zapytaj') },
{ name: 'Custom', price: t('Individuell','Indywidualnie'),
f: [t('Einzelvideos & N8N-Einrichtung','Pojedyncze filmy i konfiguracja N8N'),
t('Individuelle KI-Automatisierungen','Indywidualne automatyzacje AI'),
t('Monatlicher Automations-Support','Miesięczny support automatyzacji'),
t('Kostenlose Prozessanalyse vorab','Bezpłatna analiza procesu')],
cta: t('Gespräch vereinbaren','Umów rozmowę') }
];
const isMobile = window.useIsMobile ? window.useIsMobile() : false;
const pkgScrollerRef = useR(null);
const [pkgActive, setPkgActive] = useSt(1); // start on Signature (popular)
const didInitScroll = useR(false);
// Initial scroll to popular tier — runs ONCE
useEf(() => {
if (!isMobile) return;
if (didInitScroll.current) return;
const el = pkgScrollerRef.current;
if (!el) return;
didInitScroll.current = true;
requestAnimationFrame(() => {
el.scrollLeft = el.clientWidth;
});
}, [isMobile]);
// Scroll listener — attached once, no pkgActive dep
useEf(() => {
if (!isMobile) return;
const el = pkgScrollerRef.current;
if (!el) return;
let raf;
const onScroll = () => {
if (raf) return;
raf = requestAnimationFrame(() => {
raf = null;
const idx = Math.round(el.scrollLeft / el.clientWidth);
setPkgActive(prev => (prev !== idx && idx >= 0 && idx < tiers.length) ? idx : prev);
});
};
el.addEventListener('scroll', onScroll, { passive: true });
return () => { el.removeEventListener('scroll', onScroll); if (raf) cancelAnimationFrame(raf); };
}, [isMobile, tiers.length]);
const scrollToPkg = (i) => {
const el = pkgScrollerRef.current;
if (!el) return;
el.scrollTo({ left: i * el.clientWidth, behavior: 'smooth' });
};
return (
{t('Jedes Paket bringt dein Unternehmen messbar nach vorne.','Każdy pakiet mierzalnie rozwija Twój biznes.')}
{t('Wähle dein Paket','Wybierz swój pakiet')}