LogicalTrue commited on
Commit
1ffa897
·
1 Parent(s): 636d22c

Fix mobile creator layout overlap, add mobile logout handler, and redesign user credit capsules

Browse files
Files changed (1) hide show
  1. frontend/viewer.html +37 -5
frontend/viewer.html CHANGED
@@ -154,6 +154,13 @@
154
  box-sizing: border-box;
155
  }
156
 
 
 
 
 
 
 
 
157
  .gallery-title {
158
  font-size: 1.35rem;
159
  font-weight: 700;
@@ -256,6 +263,7 @@
256
  <span class="logo">23DFactory Mobile</span>
257
  <div style="display: flex; gap: 8px; align-items: center;">
258
  <button id="btnOpenCreator" style="background: #7c3aed; color: #fff; border: none; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 0.8rem; cursor: pointer; display: none;">➕ Crear</button>
 
259
  <a href="/" class="btn-close">Ir al inicio</a>
260
  </div>
261
  </header>
@@ -266,10 +274,13 @@
266
  <div id="gallery-container">
267
  <div>
268
  <h2 class="gallery-title">Tu Biblioteca 3D</h2>
269
- <div id="mobUserCredits" style="display: none; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 0.85rem; color: #a1a1aa; font-weight: 500; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); padding: 8px 12px; border-radius: 8px; width: fit-content;">
270
- <span>👤 <strong id="mobUsername" style="color: #fff;">-</strong></span>
271
- <span style="color: rgba(255,255,255,0.15);">|</span>
272
- <span style="color: #ffeb3b;">🪙 <strong id="mobCredits">-</strong> Créditos</span>
 
 
 
273
  </div>
274
  <p class="gallery-desc">Selecciona uno de tus modelos para visualizar en 3D interactivo y proyectar en tu habitación usando AR.</p>
275
  </div>
@@ -282,7 +293,7 @@
282
  </div>
283
 
284
  <!-- 3. Mobile Creator Container (hidden by default) -->
285
- <div id="creator-container" style="display: none; flex-direction: column; padding: 16px; box-sizing: border-box; max-width: 600px; margin: 0 auto; width: 100%;">
286
  <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;">
287
  <div>
288
  <h2 style="font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700; margin: 0;">Crear Modelo 3D</h2>
@@ -838,11 +849,15 @@
838
  const mobUsername = document.getElementById('mobUsername');
839
  const mobCredits = document.getElementById('mobCredits');
840
  const mobCreatorCreditsVal = document.getElementById('mobCreatorCreditsVal');
 
 
841
 
842
  if (mobUsername) mobUsername.textContent = data.username;
843
  if (mobCredits) mobCredits.textContent = data.credits || 0;
844
  if (mobCreatorCreditsVal) mobCreatorCreditsVal.textContent = data.credits || 0;
845
  if (mobUserCredits) mobUserCredits.style.display = 'flex';
 
 
846
  }
847
  }
848
  } catch (err) {
@@ -850,6 +865,23 @@
850
  }
851
  }
852
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
853
  // Routing Logic
854
  if (modelUrl) {
855
  loadModelInViewer(modelUrl);
 
154
  box-sizing: border-box;
155
  }
156
 
157
+ #creator-container {
158
+ flex: 1;
159
+ padding: 70px 20px 20px 20px !important;
160
+ overflow-y: auto;
161
+ box-sizing: border-box;
162
+ }
163
+
164
  .gallery-title {
165
  font-size: 1.35rem;
166
  font-weight: 700;
 
263
  <span class="logo">23DFactory Mobile</span>
264
  <div style="display: flex; gap: 8px; align-items: center;">
265
  <button id="btnOpenCreator" style="background: #7c3aed; color: #fff; border: none; padding: 6px 12px; border-radius: 8px; font-weight: 700; font-size: 0.8rem; cursor: pointer; display: none;">➕ Crear</button>
266
+ <button id="btnMobLogout" style="background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.25); color: #ef4444; padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; cursor: pointer; display: none;">Salir</button>
267
  <a href="/" class="btn-close">Ir al inicio</a>
268
  </div>
269
  </header>
 
274
  <div id="gallery-container">
275
  <div>
276
  <h2 class="gallery-title">Tu Biblioteca 3D</h2>
277
+ <div id="mobUserCredits" style="display: none; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 0.8rem;">
278
+ <span style="background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); padding: 5px 10px; border-radius: 20px; color: #fff; display: inline-flex; align-items: center; gap: 4px; font-weight: 600;">
279
+ 👤 <span id="mobUsername">-</span>
280
+ </span>
281
+ <span style="background: rgba(255, 235, 59, 0.05); border: 1px solid rgba(255, 235, 59, 0.2); padding: 5px 10px; border-radius: 20px; color: #ffeb3b; display: inline-flex; align-items: center; gap: 4px; font-weight: 600;">
282
+ 🪙 <span id="mobCredits">-</span> Créditos
283
+ </span>
284
  </div>
285
  <p class="gallery-desc">Selecciona uno de tus modelos para visualizar en 3D interactivo y proyectar en tu habitación usando AR.</p>
286
  </div>
 
293
  </div>
294
 
295
  <!-- 3. Mobile Creator Container (hidden by default) -->
296
+ <div id="creator-container" style="display: none; flex-direction: column; max-width: 600px; margin: 0 auto; width: 100%;">
297
  <div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;">
298
  <div>
299
  <h2 style="font-family: 'Outfit', sans-serif; font-size: 1.5rem; font-weight: 700; margin: 0;">Crear Modelo 3D</h2>
 
849
  const mobUsername = document.getElementById('mobUsername');
850
  const mobCredits = document.getElementById('mobCredits');
851
  const mobCreatorCreditsVal = document.getElementById('mobCreatorCreditsVal');
852
+ const btnMobLogout = document.getElementById('btnMobLogout');
853
+ const btnOpenCreator = document.getElementById('btnOpenCreator');
854
 
855
  if (mobUsername) mobUsername.textContent = data.username;
856
  if (mobCredits) mobCredits.textContent = data.credits || 0;
857
  if (mobCreatorCreditsVal) mobCreatorCreditsVal.textContent = data.credits || 0;
858
  if (mobUserCredits) mobUserCredits.style.display = 'flex';
859
+ if (btnMobLogout) btnMobLogout.style.display = 'block';
860
+ if (btnOpenCreator) btnOpenCreator.style.display = 'block';
861
  }
862
  }
863
  } catch (err) {
 
865
  }
866
  }
867
 
868
+ // Logout handler
869
+ const btnMobLogout = document.getElementById('btnMobLogout');
870
+ if (btnMobLogout) {
871
+ btnMobLogout.addEventListener('click', async () => {
872
+ if (confirm('¿Estás seguro de que deseas cerrar sesión?')) {
873
+ try {
874
+ const response = await fetch('/api/logout', { method: 'POST' });
875
+ if (response.ok) {
876
+ window.location.reload();
877
+ }
878
+ } catch (e) {
879
+ console.error("Error logging out:", e);
880
+ }
881
+ }
882
+ });
883
+ }
884
+
885
  // Routing Logic
886
  if (modelUrl) {
887
  loadModelInViewer(modelUrl);