diff --git a/index.html b/index.html index 26f3ad3..b1b31b7 100644 --- a/index.html +++ b/index.html @@ -1,90 +1,76 @@ - - - - - - - - - - - Venturalink - Investor & Business Platform - - - - - - - - - - - - - - - + - @media (max-width: 480px) { - #backToTopBtn { - right: 16px; - bottom: 88px; - /* a bit closer but still above on phones */ - } - } - - - - - -
- Venturalink Logo + Venturalink Logo -
- - - -
-
-
-
-
-
-
-
-
-
- - -
+ loader.style.display = "none"; + }, 600); + }, 2000); // Show loader for 2 seconds + } + }); + + + +
+
+
+
+
+
+
+
+
+
- -
-
+ \ No newline at end of file diff --git a/scripts/main.js b/scripts/main.js index 6b0e4b9..632cb0b 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -46,6 +46,44 @@ document.addEventListener('DOMContentLoaded', function () { }); }, 1500); }); + // Navbar Toggle Logic + const menuToggle = document.getElementById('menu-toggle'); + const navLinks = document.getElementById('nav-links'); + + if (menuToggle && navLinks) { + menuToggle.addEventListener('click', function () { + navLinks.classList.toggle('open'); + menuToggle.classList.toggle('active'); + + // Animate hamburger lines if they exist + const spans = menuToggle.querySelectorAll('span'); + if (spans.length === 3) { + if (navLinks.classList.contains('open')) { + spans[0].style.transform = 'rotate(45deg) translate(5px, 5px)'; + spans[1].style.opacity = '0'; + spans[2].style.transform = 'rotate(-45deg) translate(5px, -5px)'; + } else { + spans[0].style.transform = 'none'; + spans[1].style.opacity = '1'; + spans[2].style.transform = 'none'; + } + } + }); + + // Close menu when clicking outside + document.addEventListener('click', function (e) { + if (navLinks.classList.contains('open') && !navLinks.contains(e.target) && !menuToggle.contains(e.target)) { + navLinks.classList.remove('open'); + menuToggle.classList.remove('active'); + const spans = menuToggle.querySelectorAll('span'); + if (spans.length === 3) { + spans[0].style.transform = 'none'; + spans[1].style.opacity = '1'; + spans[2].style.transform = 'none'; + } + } + }); + } }); const firebaseConfig = { @@ -205,13 +243,13 @@ class PremiumUIController { }; document.addEventListener('mousemove', (e) => { - targetX = e.clientX; - targetY = e.clientY; - if (this.cursorFollower && this.cursorFollower.style.opacity !== '1') { - this.cursorFollower.style.opacity = '1'; - cursorTrail.style.opacity = '1'; - cursorGlow.style.opacity = '1'; - } + targetX = e.clientX; + targetY = e.clientY; + if (this.cursorFollower && this.cursorFollower.style.opacity !== '1') { + this.cursorFollower.style.opacity = '1'; + cursorTrail.style.opacity = '1'; + cursorGlow.style.opacity = '1'; + } }); // Create scroll progress indicator @@ -1458,45 +1496,45 @@ auth.onAuthStateChanged(async (user) => { }); async function updateNavigationForLoggedInUser(user) { - let userType = null; - try { - const userDoc = await db.collection('users').doc(user.uid).get(); - if (userDoc && userDoc.exists) { - userType = userDoc.data().userType || null; - try { localStorage.setItem('userType', userType || ''); } catch (e) {} + let userType = null; + try { + const userDoc = await db.collection('users').doc(user.uid).get(); + if (userDoc && userDoc.exists) { + userType = userDoc.data().userType || null; + try { localStorage.setItem('userType', userType || ''); } catch (e) { } + } + } catch (err) { + console.error('Failed to fetch userType for navigation:', err); + userType = localStorage.getItem('userType'); } - } catch (err) { - console.error('Failed to fetch userType for navigation:', err); - userType = localStorage.getItem('userType'); - } - const nav = document.querySelector('.nav-links'); - if (!nav) return userType; + const nav = document.querySelector('.nav-links'); + if (!nav) return userType; - nav.innerHTML = ` + nav.innerHTML = ` Home Dashboard `; - if (userType === 'investor') { - nav.innerHTML += `View Proposals`; - } else if (userType === 'business') { - nav.innerHTML += ` + if (userType === 'investor') { + nav.innerHTML += `View Proposals`; + } else if (userType === 'business') { + nav.innerHTML += ` My Proposals Create Proposal `; - } + } - nav.innerHTML += `Logout`; - document.getElementById('logout-link')?.addEventListener('click', handleLogout); + nav.innerHTML += `Logout`; + document.getElementById('logout-link')?.addEventListener('click', handleLogout); - return userType; + return userType; } function updateNavigationForLoggedOutUser() { - const nav = document.querySelector('.nav-links'); - if (!nav) return; - nav.innerHTML = ` + const nav = document.querySelector('.nav-links'); + if (!nav) return; + nav.innerHTML = ` Home About Login @@ -1506,23 +1544,23 @@ function updateNavigationForLoggedOutUser() { async function handleLogout(e) { e.preventDefault(); - + // Show confirmation modal const modal = document.getElementById('logoutModal'); if (modal) { modal.style.display = 'flex'; - + // Wait for user decision return new Promise((resolve) => { const confirmLogout = document.getElementById('confirmLogout'); const cancelLogout = document.getElementById('cancelLogout'); - + const cleanup = () => { confirmLogout.removeEventListener('click', onConfirm); cancelLogout.removeEventListener('click', onCancel); modal.style.display = 'none'; }; - + const onConfirm = async () => { cleanup(); try { @@ -1535,12 +1573,12 @@ async function handleLogout(e) { } resolve(true); }; - + const onCancel = () => { cleanup(); resolve(false); }; - + confirmLogout.addEventListener('click', onConfirm); cancelLogout.addEventListener('click', onCancel); }); @@ -1815,32 +1853,32 @@ function init() { console.log('Application initialized with enhanced UI features.'); } document.addEventListener('DOMContentLoaded', () => { - window.premiumUI = new PremiumUIController(); + window.premiumUI = new PremiumUIController(); }); document.addEventListener('DOMContentLoaded', () => { - auth.onAuthStateChanged(async (user) => { - if (user) { - const userType = await updateNavigationForLoggedInUser(user); - - const ctaInvestor = document.querySelector('.cta-buttons .btn-primary'); - const ctaEntrepreneur = document.querySelector('.cta-buttons .btn-secondary'); - if (ctaInvestor && ctaEntrepreneur) { - if (userType === 'investor') { - ctaInvestor.href = '/proposals.html'; - ctaEntrepreneur.href = '/proposals.html'; - } else if (userType === 'business') { - ctaInvestor.href = '/create-proposal.html'; - ctaEntrepreneur.href = '/create-proposal.html'; + auth.onAuthStateChanged(async (user) => { + if (user) { + const userType = await updateNavigationForLoggedInUser(user); + + const ctaInvestor = document.querySelector('.cta-buttons .btn-primary'); + const ctaEntrepreneur = document.querySelector('.cta-buttons .btn-secondary'); + if (ctaInvestor && ctaEntrepreneur) { + if (userType === 'investor') { + ctaInvestor.href = '/proposals.html'; + ctaEntrepreneur.href = '/proposals.html'; + } else if (userType === 'business') { + ctaInvestor.href = '/create-proposal.html'; + ctaEntrepreneur.href = '/create-proposal.html'; + } else { + ctaInvestor.href = '/profile.html'; + ctaEntrepreneur.href = '/profile.html'; + } + } } else { - ctaInvestor.href = '/profile.html'; - ctaEntrepreneur.href = '/profile.html'; + updateNavigationForLoggedOutUser(); } - } - } else { - updateNavigationForLoggedOutUser(); - } - }); + }); }); document.addEventListener('DOMContentLoaded', init); @@ -1850,31 +1888,31 @@ const statNumbers = document.querySelectorAll(".stat-number"); let statsAnimated = false; function animateStats() { - if (statsAnimated) return; - - const sectionTop = statsSection.getBoundingClientRect().top; - const triggerPoint = window.innerHeight - 100; - - if (sectionTop < triggerPoint) { - statNumbers.forEach((num) => { - const target = +num.getAttribute("data-target"); - const duration = 2000; // 2 seconds - let start = 0; - const increment = target / (duration / 16); - - function updateNumber() { - start += increment; - if (start < target) { - num.textContent = Math.ceil(start); - requestAnimationFrame(updateNumber); - } else { - num.textContent = target; - } - } - updateNumber(); - }); - statsAnimated = true; - } + if (statsAnimated) return; + + const sectionTop = statsSection.getBoundingClientRect().top; + const triggerPoint = window.innerHeight - 100; + + if (sectionTop < triggerPoint) { + statNumbers.forEach((num) => { + const target = +num.getAttribute("data-target"); + const duration = 2000; // 2 seconds + let start = 0; + const increment = target / (duration / 16); + + function updateNumber() { + start += increment; + if (start < target) { + num.textContent = Math.ceil(start); + requestAnimationFrame(updateNumber); + } else { + num.textContent = target; + } + } + updateNumber(); + }); + statsAnimated = true; + } } window.addEventListener("scroll", animateStats); @@ -1886,18 +1924,18 @@ let startX; let scrollLeft; carousel.addEventListener('mousedown', (e) => { - isDown = true; - startX = e.pageX - carousel.offsetLeft; - scrollLeft = carousel.scrollLeft; + isDown = true; + startX = e.pageX - carousel.offsetLeft; + scrollLeft = carousel.scrollLeft; }); carousel.addEventListener('mouseleave', () => isDown = false); carousel.addEventListener('mouseup', () => isDown = false); carousel.addEventListener('mousemove', (e) => { - if(!isDown) return; - e.preventDefault(); - const x = e.pageX - carousel.offsetLeft; - const walk = (x - startX) * 2; - carousel.scrollLeft = scrollLeft - walk; + if (!isDown) return; + e.preventDefault(); + const x = e.pageX - carousel.offsetLeft; + const walk = (x - startX) * 2; + carousel.scrollLeft = scrollLeft - walk; }); diff --git a/scripts/theme.js b/scripts/theme.js index e6c257b..93fbfc7 100644 --- a/scripts/theme.js +++ b/scripts/theme.js @@ -26,28 +26,19 @@ button.type = "button"; button.classList.add("theme-toggle--navbar"); - // Create and append to navbar - const navbar = document.querySelector(".navbar"); - if (navbar) { - navbar.appendChild(button); - } else { - // Fallback: append to body but position at top-right - document.body.appendChild(button); - Object.assign(button.style, { - position: "fixed", - top: "24px", - right: "24px", - zIndex: "9999", - }); - } + // Always append to body to ensure fixed positioning works (avoids backdrop-filter containing block issues) + document.body.appendChild(button); + + // Ensure specific ID for CSS targeting + button.id = "theme-toggle"; + button.classList.add("theme-toggle--floating"); } else { - // Ensure it's in the navbar - button.type = "button"; - const navbar = document.querySelector(".navbar"); - if (navbar && button.parentElement !== navbar) { - navbar.appendChild(button); + // Ensure it is attached to body if it exists but is elsewhere + if (button.parentElement !== document.body) { + document.body.appendChild(button); } - button.classList.add("theme-toggle--navbar"); + button.classList.add("theme-toggle--floating"); + button.classList.remove("theme-toggle--navbar"); } // Style the button for navbar positioning @@ -65,9 +56,7 @@ justifyContent: "center", boxShadow: "0 4px 12px rgba(0,0,0,0.15)", transition: "background 0.3s, color 0.3s, transform 0.2s", - marginLeft: "auto", // Push to the right in flex container - marginRight: "1rem", // Space from the edge - flexShrink: "0", // Prevent shrinking in flex container + zIndex: "9999" // Ensure it stays on top }); // Add hover effect