Landing: proper category icons, auth state in header, white cat-cards

- Category icons: images/code/web/utils have proper SVG (not empty rect)
- Auth check: if logged in, show user name + Выйти instead of Войти/Регистрация
- Cat-cards: white background (surface-800)
This commit is contained in:
treamz 2026-03-22 11:58:03 +03:00
parent f16a2ac32d
commit d2cd720a5b

View File

@ -426,7 +426,7 @@
gap: 8px;
background: var(--surface-700);
background: var(--surface-800);
border: 1px solid var(--surface-600);
@ -582,7 +582,7 @@
.cat-card {
background: var(--surface-700);
background: var(--surface-800);
border: 1px solid var(--surface-600);
@ -760,7 +760,7 @@
.adv-section {
background: var(--surface-700);
background: var(--surface-800);
border-top: 1px solid var(--surface-600);
@ -1234,7 +1234,7 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="3" width="18" height="18" rx="3"/>
<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0023.25 18.75V5.25A2.25 2.25 0 0021 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"/>
<path d="M3 9h18"/>
@ -1592,6 +1592,29 @@
</script>
<noscript><div><img src="https://mc.yandex.ru/watch/108185982" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
<!-- /Yandex.Metrika counter -->
<script>
// Show user info if authenticated
fetch('/auth/me').then(r => r.ok ? r.json() : null).then(user => {
if (!user) return;
const right = document.querySelector('.top-right');
if (!right) return;
const loginBtn = right.querySelector('[href="/auth/login"]');
const regBtn = right.querySelector('[href="/auth/register"]');
if (loginBtn) loginBtn.remove();
if (regBtn) regBtn.remove();
const userEl = document.createElement('a');
userEl.href = '/dashboard';
userEl.className = 'btn-ghost';
userEl.textContent = user.name || user.email;
userEl.style.color = 'var(--accent)';
right.appendChild(userEl);
const logoutBtn = document.createElement('a');
logoutBtn.href = '/auth/logout';
logoutBtn.className = 'btn-ghost';
logoutBtn.textContent = 'Выйти';
right.appendChild(logoutBtn);
}).catch(() => {});
</script>
</body>
</html>
@ -1630,7 +1653,7 @@
const toolsList = cat.tools.map(t => '<li class="cat-tool-item">' + t.title + '</li>').join('');
return '<div class="cat-card reveal visible reveal-delay-' + (i+1) + '">' +
'<div class="cat-icon-wrap" style="color:' + (cat.color || '#0054e6') + '">' +
'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75"><rect x="3" y="3" width="18" height="18" rx="3"/></svg>' +
'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75">' + ({images:'<path stroke-linecap="round" stroke-linejoin="round" d="M2.25 15.75l5.159-5.159a2.25 2.25 0 013.182 0l5.159 5.159m-1.5-1.5l1.409-1.409a2.25 2.25 0 013.182 0l2.909 2.909M3.75 21h16.5A2.25 2.25 0 0023.25 18.75V5.25A2.25 2.25 0 0021 3H3.75A2.25 2.25 0 001.5 5.25v13.5A2.25 2.25 0 003.75 21z"/>',code:'<path stroke-linecap="round" stroke-linejoin="round" d="M17.25 6.75L22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3l-4.5 16.5"/>',web:'<circle cx="12" cy="12" r="9"/><path d="M3.6 9h16.8M3.6 15h16.8"/><path d="M12 3a14.4 14.4 0 0 1 0 18M12 3a14.4 14.4 0 0 0 0 18"/>',utils:'<path stroke-linecap="round" stroke-linejoin="round" d="M15.75 5.25a3 3 0 013 3m3 0a6 6 0 01-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1121.75 8.25z"/>'}[cat.slug] || '<rect x="3" y="3" width="18" height="18" rx="3"/>') + '</svg>' +
'</div><div><div class="cat-header"><span class="cat-title">' + cat.title + '</span>' +
'<span class="cat-badge">' + cat.tools.length + ' инстр.</span></div></div>' +
'<p class="cat-desc">' + (cat.description || '') + '</p>' +