/* global React */
const { useState, useEffect, useRef, useLayoutEffect } = React;
function useReveal() {
useEffect(() => {
const els = document.querySelectorAll(".reveal");
const io = new IntersectionObserver(
(entries) => {
entries.forEach((e) => {
if (e.isIntersecting) {
e.target.classList.add("in");
io.unobserve(e.target);
}
});
},
{ rootMargin: "-10% 0px -10% 0px", threshold: 0.1 }
);
els.forEach((el) => io.observe(el));
return () => io.disconnect();
}, []);
}
function Nav({ lang, setLang, t, appearance }) {
const [stuck, setStuck] = useState(false);
const [menuOpen, setMenuOpen] = useState(false); // MOBİL MENÜ KONTROLÜ
useEffect(() => {
const onScroll = () => setStuck(window.scrollY > 40);
window.addEventListener("scroll", onScroll, { passive: true });
return () => window.removeEventListener("scroll", onScroll);
}, []);
const langs = [
{ code: "tr", label: "TR" },
{ code: "en", label: "EN" },
{ code: "de", label: "DE" }];
return (
);
}
function Hero({ t, siteData }) {
const videoRef = useRef(null);
const heroRef = useRef(null);
useEffect(() => {
let raf;
const onScroll = () => {
if (raf) return;
raf = requestAnimationFrame(() => {
raf = null;
if (!videoRef.current || !heroRef.current) return;
const rect = heroRef.current.getBoundingClientRect();
const h = window.innerHeight;
const progress = Math.max(0, Math.min(1, -rect.top / h));
const scale = 1 + progress * 0.12;
const y = progress * 60;
videoRef.current.style.transform = `scale(${scale}) translateY(${y}px)`;
});
};
window.addEventListener("scroll", onScroll, { passive: true });
onScroll();
return () => window.removeEventListener("scroll", onScroll);
}, []);
return (
{siteData?.heroEyebrow || t.hero.eyebrow}
{siteData?.heroTitleA || t.hero.titleA}
{siteData?.heroTitleB || t.hero.titleB}
{siteData?.heroTitleC || t.hero.titleC}
{siteData?.heroLede || t.hero.lede}
{t.hero.scroll}
41°02′Nİstanbul
28°59′EBeyoğlu
2023Est.
);
}
function Marquee({ items }) {
const content = {items.map((it, i) => {it}).reduce((acc, el, i, arr) => { acc.push(el); if (i < arr.length - 1) acc.push(null); return acc; }, [])};
return (
{[...items, ...items, ...items, ...items].map((it, i) => {it})}
);
}
function Manifesto({ t, siteData }) {
return (
{t.manifesto.label}
{siteData?.maniLine1 || t.manifesto.line1} {siteData?.maniLine2 || t.manifesto.line2}
{siteData?.maniLine3 || t.manifesto.line3} {siteData?.maniLine4 || t.manifesto.line4}
{siteData?.maniBody || t.manifesto.body}
);
}
function About({ t, siteData }) {
return (
{t.about.label}
{siteData?.aboutName || t.about.name}
{t.about.title}
{siteData?.aboutBio1 || t.about.bio1}
{siteData?.aboutBio2 || t.about.bio2}
{t.about.stats.map((s, i) => - {s.k}
- {s.v}
)}
);
}
function Practice({ t }) {
return (
{t.practice.label}
{t.practice.heading}
{t.practice.heading2}
{t.practice.items.map((it) =>
{it.n}
{it.title}
{it.body}
{it.tags.map((tag, i) => {tag})}
→
)}
);
}
function Film({ t, siteData }) {
const wrapRef = useRef(null);
const videoRef = useRef(null);
const fillRef = useRef(null);
useEffect(() => {
const v = videoRef.current;
if (!v) return;
v.pause();
let raf;
const onScroll = () => {
if (raf) return;
raf = requestAnimationFrame(() => {
raf = null;
if (!wrapRef.current || !v) return;
const rect = wrapRef.current.getBoundingClientRect();
const total = rect.height - window.innerHeight;
const scrolled = Math.max(0, -rect.top);
const p = Math.max(0, Math.min(1, scrolled / total));
if (v.duration && !isNaN(v.duration)) { v.currentTime = p * v.duration; }
if (fillRef.current) { fillRef.current.style.transform = `scaleX(${p})`; }
});
};
window.addEventListener("scroll", onScroll, { passive: true });
v.addEventListener("loadedmetadata", onScroll);
onScroll();
return () => { window.removeEventListener("scroll", onScroll); };
}, []);
useEffect(() => {
const v = videoRef.current;
if (!v) return;
const handler = () => { if (v.readyState >= 2 && v.duration > 0) return; v.play().catch(() => {}); };
const timeout = setTimeout(handler, 800);
return () => clearTimeout(timeout);
}, []);
return (
{siteData?.maniLine1 || t.manifesto.line1} {siteData?.maniLine2 || t.manifesto.line2}
{siteData?.maniLine3 || t.manifesto.line3} {siteData?.maniLine4 || t.manifesto.line4}
{t.manifesto.label} · Sözeri Law
);
}
function Approach({ t }) {
return (
{t.approach.label}
{t.approach.heading}
{t.approach.heading2}
{t.approach.steps.map((s, i) =>
)}
);
}
function CTA({ t }) {
return (
{t.cta.label}
{t.cta.heading}
{t.cta.heading2}
{t.cta.body}
);
}
function Contact({ t, siteData }) {
return (
);
}
function App() {
const [lang, setLang] = useState(() => { return localStorage.getItem("sozeri_lang") || "tr"; });
const [siteData, setSiteData] = useState({});
const [appearance, setAppearance] = useState({});
useEffect(() => {
localStorage.setItem("sozeri_lang", lang);
document.documentElement.lang = lang;
if (window.SozeriApi && window.SozeriApi.getSettings) {
window.SozeriApi.getSettings().then(res => {
if (res) {
setSiteData(res[`site_${lang}`] || {});
setAppearance(res.appearance || {});
}
}).catch(err => console.error(err));
}
}, [lang]);
const t = window.I18N[lang];
useReveal();
useEffect(() => {
const els = document.querySelectorAll(".reveal");
els.forEach((el) => el.classList.add("in"));
}, [lang, siteData]);
useEffect(() => {
if (window.location.hash) {
setTimeout(() => {
const element = document.querySelector(window.location.hash);
if (element) {
element.scrollIntoView({ behavior: 'smooth' });
}
}, 150);
}
}, []);
return (
{/* SİHİRLİ MOBİL DÜZELTME VE ÖZEL TASARIM KODU */}