Spaces:
Sleeping
Sleeping
| // PHP Component - Can be called by Flask or run standalone | |
| require_once __DIR__ . '/src/Bootstrap.php'; | |
| \SoftEdge\Env::load(__DIR__); | |
| \SoftEdge\Bootstrap::init(); | |
| // If called directly (not by Flask), redirect to Flask server | |
| if (!isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !isset($_GET['direct'])) { | |
| header('Location: http://localhost:7860/'); | |
| exit; | |
| } | |
| // Track page visit | |
| try { | |
| \SoftEdge\Database::execute( | |
| "INSERT INTO page_visits (page_url, page_title, ip_address, user_agent, device_type, referrer_url) VALUES (?, ?, ?, ?, ?, ?)", | |
| [ | |
| '/', | |
| 'SoftEdge Corporation - Soluções em Tecnologia', | |
| $_SERVER['REMOTE_ADDR'] ?? '', | |
| $_SERVER['HTTP_USER_AGENT'] ?? '', | |
| 'desktop', // Simplified detection | |
| $_SERVER['HTTP_REFERER'] ?? '' | |
| ] | |
| ); | |
| } catch (Exception $e) { | |
| // Log error but don't break page | |
| error_log("Page visit tracking failed: " . $e->getMessage()); | |
| } | |
| // Get dynamic stats | |
| $stats = ['projects' => 0, 'contacts' => 0, 'satisfaction' => 4.9]; | |
| try { | |
| $statsData = \SoftEdge\Database::queryOne("SELECT COUNT(*) as projects FROM projects"); | |
| $contactsData = \SoftEdge\Database::queryOne("SELECT COUNT(*) as contacts FROM contact_submissions"); | |
| $stats['projects'] = $statsData['projects'] ?? 0; | |
| $stats['contacts'] = $contactsData['contacts'] ?? 0; | |
| } catch (Exception $e) { | |
| // Use defaults if DB fails | |
| } | |
| // If called with JSON request, return data for Flask | |
| if (isset($_GET['json'])) { | |
| header('Content-Type: application/json'); | |
| echo json_encode($stats); | |
| exit; | |
| } | |
| // Otherwise, render the component HTML | |
| <!-- PHP Component: Homepage Stats --> | |
| <div class="grid grid-cols-1 sm:grid-cols-3 gap-8 max-w-2xl mx-auto mt-12"> | |
| <div class="text-center"> | |
| <div class="text-4xl font-bold text-cyan-400"><?php echo number_format($stats['projects']); ?>+</div> | |
| <div class="text-slate-400">Projetos Entregues</div> | |
| </div> | |
| <div class="text-center"> | |
| <div class="text-4xl font-bold text-blue-400"><?php echo number_format($stats['contacts']); ?>+</div> | |
| <div class="text-slate-400">Clientes Satisfeitos</div> | |
| </div> | |
| <div class="text-center"> | |
| <div class="text-4xl font-bold text-purple-400"><?php echo $stats['satisfaction']; ?>★</div> | |
| <div class="text-slate-400">Avaliação Média</div> | |
| </div> | |
| </div> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mt-16"> | |
| <!-- Desenvolvimento Web --> | |
| <div class="glass-card p-8 rounded-2xl hover:scale-105 transition-transform"> | |
| <div class="w-16 h-16 bg-cyan-500/20 rounded-2xl flex items-center justify-center mb-6"> | |
| <i data-lucide="code" class="w-8 h-8 text-cyan-400"></i> | |
| </div> | |
| <h3 class="text-2xl font-bold text-white mb-4">Desenvolvimento Web</h3> | |
| <p class="text-slate-400 leading-relaxed"> | |
| Aplicações web modernas e responsivas com as melhores tecnologias do mercado. | |
| </p> | |
| </div> | |
| <!-- Mobile Apps --> | |
| <div class="glass-card p-8 rounded-2xl hover:scale-105 transition-transform"> | |
| <div class="w-16 h-16 bg-blue-500/20 rounded-2xl flex items-center justify-center mb-6"> | |
| <i data-lucide="smartphone" class="w-8 h-8 text-blue-400"></i> | |
| </div> | |
| <h3 class="text-2xl font-bold text-white mb-4">Aplicativos Mobile</h3> | |
| <p class="text-slate-400 leading-relaxed"> | |
| Apps nativos e multiplataforma para iOS e Android com experiência excepcional. | |
| </p> | |
| </div> | |
| <!-- IA & Automação --> | |
| <div class="glass-card p-8 rounded-2xl hover:scale-105 transition-transform"> | |
| <div class="w-16 h-16 bg-purple-500/20 rounded-2xl flex items-center justify-center mb-6"> | |
| <i data-lucide="brain" class="w-8 h-8 text-purple-400"></i> | |
| </div> | |
| <h3 class="text-2xl font-bold text-white mb-4">IA & Automação</h3> | |
| <p class="text-slate-400 leading-relaxed"> | |
| Soluções de inteligência artificial e automação para otimizar processos. | |
| </p> | |
| </div> | |
| </div> | |