Changed around line 1
+ document.addEventListener('DOMContentLoaded', () => {
+ // Mobile menu toggle
+ const menuToggle = document.querySelector('.menu-toggle');
+ const navLinks = document.querySelector('.nav-links');
+
+ menuToggle.addEventListener('click', () => {
+ navLinks.classList.toggle('active');
+ });
+
+ // Sample data
+ const transactions = [
+ { id: 1, description: 'Grocery Shopping', amount: -120.50, date: '2023-06-15' },
+ { id: 2, description: 'Salary Deposit', amount: 3000.00, date: '2023-06-14' },
+ { id: 3, description: 'Utilities', amount: -200.00, date: '2023-06-13' }
+ ];
+
+ const households = [
+ { id: 1, name: 'Smith Family', members: 4, balance: 5430.20 },
+ { id: 2, name: 'Apartment 5B', members: 2, balance: 1200.00 }
+ ];
+
+ // Render transactions
+ const transactionList = document.getElementById('transactionList');
+
+ if (transactionList) {
+ transactions.forEach(transaction => {
+ const div = document.createElement('div');
+ div.className = 'transaction-item';
+ div.innerHTML = `
+
+
${transaction.description}
+
+ ${transaction.amount >= 0 ? '+' : ''}${transaction.amount.toFixed(2)}
+
+ `;
+ transactionList.appendChild(div);
+ });
+ }
+
+ // Handle navigation
+ const navItems = document.querySelectorAll('.nav-links a');
+ const sections = document.querySelectorAll('main > section');
+
+ navItems.forEach(item => {
+ item.addEventListener('click', (e) => {
+ e.preventDefault();
+ const targetId = item.getAttribute('href').substring(1);
+
+ sections.forEach(section => {
+ section.classList.remove('active');
+ if (section.id === targetId) {
+ section.classList.add('active');
+ }
+ });
+
+ navItems.forEach(navItem => navItem.classList.remove('active'));
+ item.classList.add('active');
+
+ if (window.innerWidth <= 768) {
+ navLinks.classList.remove('active');
+ }
+ });
+ });
+ });