Skip to content

Commit ad36173

Browse files
committed
Add dashboard link visibility toggle for desktop and mobile navigation
1 parent e4df837 commit ad36173

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

public/js/components/pf-header.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ class PfHeader extends HTMLElement {
458458
// Get the static login and register links
459459
const loginLink = navLinks.querySelector('.login-link');
460460
const registerLink = navLinks.querySelector('.register-link');
461+
const dashboardLink = navLinks.querySelector('#dashboard-link');
461462

462463
// Only remove existing dropdown if we're going to add a new one
463464
// (when user is logged in) or if we're switching from logged in to logged out
@@ -470,6 +471,7 @@ class PfHeader extends HTMLElement {
470471
const mobileMenu = this.shadowRoot.querySelector('.mobile-menu');
471472
const mobileLoginLink = mobileMenu?.querySelector('#mobile-login-link');
472473
const mobileRegisterLink = mobileMenu?.querySelector('#mobile-register-link');
474+
const mobileDashboardLink = mobileMenu?.querySelector('#mobile-dashboard-link');
473475

474476
if (isLoggedIn) {
475477
// User is logged in
@@ -478,10 +480,16 @@ class PfHeader extends HTMLElement {
478480
if (loginLink) loginLink.style.display = 'none';
479481
if (registerLink) registerLink.style.display = 'none';
480482

483+
// Show the dashboard link in desktop nav
484+
if (dashboardLink) dashboardLink.style.display = '';
485+
481486
// Hide the login and register links in mobile nav
482487
if (mobileLoginLink) mobileLoginLink.style.display = 'none';
483488
if (mobileRegisterLink) mobileRegisterLink.style.display = 'none';
484489

490+
// Show the dashboard link in mobile nav
491+
if (mobileDashboardLink) mobileDashboardLink.style.display = '';
492+
485493
// Add the user dropdown to desktop nav
486494
const dropdownHtml = `
487495
<div class="user-dropdown">
@@ -620,10 +628,16 @@ class PfHeader extends HTMLElement {
620628
if (loginLink) loginLink.style.display = '';
621629
if (registerLink) registerLink.style.display = '';
622630

631+
// Hide the dashboard link in desktop nav
632+
if (dashboardLink) dashboardLink.style.display = 'none';
633+
623634
// Show the login and register links in mobile nav
624635
if (mobileLoginLink) mobileLoginLink.style.display = '';
625636
if (mobileRegisterLink) mobileRegisterLink.style.display = '';
626637

638+
// Hide the dashboard link in mobile nav
639+
if (mobileDashboardLink) mobileDashboardLink.style.display = 'none';
640+
627641
// Remove any user-specific links from mobile menu
628642
const mobileSettingsLink = mobileMenu?.querySelector('.mobile-settings-link');
629643
const mobileLogoutLink = mobileMenu?.querySelector('.mobile-logout-link');

0 commit comments

Comments
 (0)