İndi al
Bildiriş
`; } function AboutPage(){ return `

Haqqımızda

TechLux — texnoloji & lüks aksesuar mağazası. Missiyamız qlobal alış-veriş təcrübəsini sürətli çatdırılma, təhlükəsiz ödəniş və keyfiyyət zəmanəti ilə təqdim etməkdir.

`; } function NotFound(){ return `

Səhifə tapılmadı

Ana səhifəyə qayıt
` } async function placeOrder(id, qty){ try{ const res = await api('api/order.php', {method:'POST', body: JSON.stringify({items:[{id,qty}], name:'Test User', email:'test@example.com'})}); showToast('Sifariş yaradıldı: '+res.order_id+' • $'+res.total); }catch(e){ showToast('Sifariş alınmadı: serverə qoşulma mümkün olmadı'); } } async function render(){ const app = document.getElementById('app'); let html = ''; try{ const data = await api('api/products.php'); const items = data.items || []; if(route.path==='/'){ html = HomePage(items.slice(0,6)); } else if(route.path==='/shop'){ html = ShopPage(items); } else if(route.path==='/product'){ const item = await api('api/products.php?id='+encodeURIComponent(route.params?.id)); html = ProductPage(item); } else if(route.path==='/faq'){ html = FAQPage(); } else if(route.path==='/contact'){ html = ContactPage(); } else if(route.path==='/about'){ html = AboutPage(); } else { html = NotFound(); } }catch(err){ // Fallback: API fails → show static home with note html = `

Server tapılmadı

API işləmirsə, faylları eyni domenə yüklədiyinizə əmin olun: /api/*.php

`; } app.innerHTML = html; // hero animation const h = document.querySelector('.title-hero'); if(h){ requestAnimationFrame(()=>{ h.style.transition='opacity .5s cubic-bezier(.22,1,.36,1), transform .5s cubic-bezier(.22,1,.36,1)'; h.style.opacity='1'; h.style.transform='translateY(0)'; });} // features intersection const feats = document.querySelectorAll('.features .card'); if(feats.length){ const io = new IntersectionObserver(es=> es.forEach(e=>{ if(e.isIntersecting){ e.target.style.opacity='1'; e.target.style.transform='translateY(0)'; } }),{threshold:.2}); feats.forEach(el=> io.observe(el)); } } if(!location.hash) location.hash = '#/'; setActiveNav(); render();