Skip to main content

max / makenotwork

Remove Profile from header, hide Cart when empty - Profile link removed (accessible from dashboard) - Cart link hidden by default, shown via JS fetch of /api/cart/count - Badge shows item count when cart has items Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author: Max J. <87768334+MaxJMath@users.noreply.github.com> · 2026-05-11 01:29 UTC
Commit: 6e398ea62650a62c2b1af4c2bd1b7f88488db519
Parent: ed75ccf
2 files changed, +16 insertions, -2 deletions
@@ -232,6 +232,21 @@ document.addEventListener('DOMContentLoaded', function() {
232 232 b.setAttribute('aria-expanded', 'false');
233 233 });
234 234 });
235 +
236 + // Show cart link only if cart has items
237 + var cartLink = document.getElementById('nav-cart-link');
238 + if (cartLink) {
239 + fetch('/api/cart/count', { credentials: 'same-origin' })
240 + .then(function(r) { return r.ok ? r.json() : null; })
241 + .then(function(data) {
242 + if (data && data.count > 0) {
243 + cartLink.style.display = '';
244 + var badge = document.getElementById('cart-badge');
245 + if (badge) badge.textContent = ' (' + data.count + ')';
246 + }
247 + })
248 + .catch(function() {});
249 + }
235 250 });
236 251
237 252 /* ===========================================
@@ -16,9 +16,8 @@
16 16 <a href="/discover">Discover</a>
17 17 {% if let Some(user) = session_user %}
18 18 <a href="/library">Library</a>
19 - <a href="/u/{{ user.username }}">Profile</a>
20 - <a href="/cart">Cart<span id="cart-badge" style="font-size: 0.8em;"></span></a>
21 19 <a href="/dashboard">Dashboard</a>
20 + <a href="/cart" id="nav-cart-link" style="display: none;">Cart<span id="cart-badge" style="font-size: 0.8em;"></span></a>
22 21 {% if user.is_admin %}<a href="/admin/waitlist">Admin</a>{% endif %}
23 22 <form action="/logout" method="post" class="nav-form">
24 23 {% if let Some(token) = csrf_token %}<input type="hidden" name="_csrf" value="{{ token }}">{% endif %}