Spaces:
Sleeping
Sleeping
| /** | |
| * Main Mini App Logic | |
| * Handles tab switching and initialization of sub-components. | |
| */ | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Initialize Tabs | |
| const tabs = document.querySelectorAll('.nav-item'); | |
| const contents = document.querySelectorAll('.tab-content'); | |
| tabs.forEach(tab => { | |
| tab.addEventListener('click', () => { | |
| // Remove active class from all | |
| tabs.forEach(t => t.classList.remove('active')); | |
| contents.forEach(c => c.classList.remove('active')); | |
| // Add active class to clicked | |
| tab.classList.add('active'); | |
| // Show corresponding content | |
| const targetId = tab.dataset.tab; | |
| document.getElementById(targetId).classList.add('active'); | |
| }); | |
| }); | |
| // Initialize individual tab logic | |
| if (window.settingsTab) window.settingsTab.init(); | |
| if (window.storageTab) window.storageTab.init(); | |
| // Telegram WebApp expansion | |
| if (window.Telegram && window.Telegram.WebApp) { | |
| window.Telegram.WebApp.ready(); | |
| window.Telegram.WebApp.expand(); | |
| } | |
| }); | |