LogicalTrue commited on
Commit
99b426e
·
1 Parent(s): 8d9afa7

Replace separate username text and exit button with a single highlighted user menu pill and dropdown menu

Browse files
Files changed (2) hide show
  1. frontend/app.js +18 -0
  2. frontend/index.html +14 -9
frontend/app.js CHANGED
@@ -2867,6 +2867,24 @@ if (creditsModal) {
2867
  });
2868
  }
2869
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2870
  // Mobile QR Viewer Modal handlers
2871
  if (viewOnMobileBtn) {
2872
  viewOnMobileBtn.addEventListener('click', () => {
 
2867
  });
2868
  }
2869
 
2870
+ // User Profile Menu Dropdown Toggle
2871
+ const userMenuBtn = document.getElementById('userMenuBtn');
2872
+ const userDropdownMenu = document.getElementById('userDropdownMenu');
2873
+
2874
+ if (userMenuBtn && userDropdownMenu) {
2875
+ userMenuBtn.addEventListener('click', (e) => {
2876
+ e.stopPropagation();
2877
+ const isVisible = userDropdownMenu.style.display === 'block';
2878
+ userDropdownMenu.style.display = isVisible ? 'none' : 'block';
2879
+ });
2880
+
2881
+ document.addEventListener('click', (e) => {
2882
+ if (!userMenuBtn.contains(e.target) && !userDropdownMenu.contains(e.target)) {
2883
+ userDropdownMenu.style.display = 'none';
2884
+ }
2885
+ });
2886
+ }
2887
+
2888
  // Mobile QR Viewer Modal handlers
2889
  if (viewOnMobileBtn) {
2890
  viewOnMobileBtn.addEventListener('click', () => {
frontend/index.html CHANGED
@@ -41,17 +41,22 @@
41
  <h1 class="logo-text">23D<span>Factory</span></h1>
42
  </div>
43
  <div class="header-actions" id="userHeaderActions" style="display: none; align-items: center; gap: 0.75rem;">
44
- <button id="headerCreditsBtn" class="btn btn-secondary" style="padding: 0.35rem 0.65rem; font-size: 0.75rem; border-color: rgba(255, 235, 59, 0.3); color: #ffeb3b; background: rgba(255, 235, 59, 0.05); display: flex; align-items: center; gap: 0.35rem; font-weight: 600; cursor: pointer; border-radius: 12px;" title="Tienda de créditos">
45
  <span>🪙 <span id="headerCreditsText">0</span> Créditos</span>
46
  </button>
47
- <span id="headerUsernameText" style="font-size: 0.8rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.35rem;">
48
- <i data-lucide="user" style="width: 14px; height: 14px; color: var(--primary-light);"></i>
49
- <span style="font-weight: 500;">Invitado</span>
50
- </span>
51
- <button class="btn btn-secondary" id="logoutBtn" style="padding: 0.35rem 0.65rem; font-size: 0.75rem; border-color: rgba(244, 67, 54, 0.3); color: #f44336; background: rgba(244, 67, 54, 0.05);" title="Cerrar Sesión">
52
- <i data-lucide="log-out" style="width: 13px; height: 13px;"></i>
53
- <span>Salir</span>
54
- </button>
 
 
 
 
 
55
  </div>
56
  </header>
57
 
 
41
  <h1 class="logo-text">23D<span>Factory</span></h1>
42
  </div>
43
  <div class="header-actions" id="userHeaderActions" style="display: none; align-items: center; gap: 0.75rem;">
44
+ <button id="headerCreditsBtn" class="btn btn-secondary" style="padding: 0.35rem 0.75rem; font-size: 0.8rem; border-color: rgba(255, 235, 59, 0.3); color: #ffeb3b; background: rgba(255, 235, 59, 0.08); display: flex; align-items: center; gap: 0.35rem; font-weight: 700; cursor: pointer; border-radius: 20px; box-shadow: 0 0 10px rgba(255, 235, 59, 0.1);" title="Tienda de créditos">
45
  <span>🪙 <span id="headerCreditsText">0</span> Créditos</span>
46
  </button>
47
+ <div style="position: relative;">
48
+ <button id="userMenuBtn" class="user-menu-btn" style="background: linear-gradient(135deg, rgba(124, 58, 237, 0.25), rgba(167, 139, 250, 0.15)); border: 1px solid rgba(167, 139, 250, 0.5); color: #ffffff; padding: 0.4rem 0.85rem; border-radius: 20px; font-weight: 700; font-size: 0.85rem; display: flex; align-items: center; gap: 0.4rem; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 0 12px rgba(124, 58, 237, 0.3);" title="Menú de usuario">
49
+ <i data-lucide="user" style="width: 15px; height: 15px; color: #a78bfa;"></i>
50
+ <span id="headerUsernameText">Invitado</span>
51
+ <i data-lucide="chevron-down" style="width: 14px; height: 14px; color: rgba(255,255,255,0.7); margin-left: 2px;"></i>
52
+ </button>
53
+ <div id="userDropdownMenu" class="user-dropdown-menu" style="display: none; position: absolute; top: calc(100% + 8px); right: 0; background: #161622; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px; padding: 6px; box-shadow: 0 10px 25px rgba(0,0,0,0.6); z-index: 1000; min-width: 150px;">
54
+ <button id="logoutBtn" style="width: 100%; text-align: left; background: transparent; border: none; color: #ef4444; padding: 8px 12px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.2s;">
55
+ <i data-lucide="log-out" style="width: 15px; height: 15px;"></i>
56
+ <span>Salir</span>
57
+ </button>
58
+ </div>
59
+ </div>
60
  </div>
61
  </header>
62