Nav: add Activity link for users with activity_access

This commit is contained in:
Davide Scaini
2026-05-15 18:41:30 +02:00
parent def561da19
commit 384af7d5cd
+13
View File
@@ -8,6 +8,7 @@ interface Props {
public?: boolean; public?: boolean;
} }
const { title = 'BincioWiki', description = 'La memoria collettiva del gruppo Bincio.', public: isPublic = false } = Astro.props; const { title = 'BincioWiki', description = 'La memoria collettiva del gruppo Bincio.', public: isPublic = false } = Astro.props;
const activityUrl = import.meta.env.PUBLIC_ACTIVITY_URL ?? 'https://activity.bincio.org';
--- ---
<!doctype html> <!doctype html>
<html lang="en" data-theme="dark"> <html lang="en" data-theme="dark">
@@ -146,6 +147,9 @@ const { title = 'BincioWiki', description = 'La memoria collettiva del gruppo Bi
<a id="nav-wikilog" href="/log/" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">WikiLog</a> <a id="nav-wikilog" href="/log/" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">WikiLog</a>
<a id="nav-invites" href="/invites/" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">Inviti</a> <a id="nav-invites" href="/invites/" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">Inviti</a>
<button id="nav-logout" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">Log out</button> <button id="nav-logout" class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">Log out</button>
{activityUrl && (
<a id="nav-activity" href={activityUrl} class="hidden sm:inline text-xs text-zinc-500 hover:text-white transition-colors px-1" style="display:none">Activity</a>
)}
<button <button
id="theme-toggle" id="theme-toggle"
class="text-zinc-400 hover:text-white transition-colors w-8 h-8 flex items-center justify-center rounded-md hover:bg-zinc-800 text-base" class="text-zinc-400 hover:text-white transition-colors w-8 h-8 flex items-center justify-center rounded-md hover:bg-zinc-800 text-base"
@@ -162,6 +166,9 @@ const { title = 'BincioWiki', description = 'La memoria collettiva del gruppo Bi
<a href="/log/" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors" style="color: var(--text-4)">WikiLog</a> <a href="/log/" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors" style="color: var(--text-4)">WikiLog</a>
<a href="/invites/" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors" style="color: var(--text-4)">Inviti</a> <a href="/invites/" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors" style="color: var(--text-4)">Inviti</a>
<button id="nav-logout-m" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors text-left" style="color: var(--text-4)">Log out</button> <button id="nav-logout-m" class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors text-left" style="color: var(--text-4)">Log out</button>
{activityUrl && (
<a id="nav-activity-m" href={activityUrl} class="text-sm px-2 py-1.5 rounded hover:bg-zinc-800 transition-colors" style="display:none; color: var(--text-4)">Activity</a>
)}
</div> </div>
</div> </div>
</nav> </nav>
@@ -199,6 +206,12 @@ const { title = 'BincioWiki', description = 'La memoria collettiva del gruppo Bi
if (invitesEl) invitesEl.style.display = ''; if (invitesEl) invitesEl.style.display = '';
if (logoutEl) logoutEl.style.display = ''; if (logoutEl) logoutEl.style.display = '';
if (hamburgerEl) hamburgerEl.style.display = ''; if (hamburgerEl) hamburgerEl.style.display = '';
if (user.activity_access) {
const activityEl = document.getElementById('nav-activity');
const activityElM = document.getElementById('nav-activity-m');
if (activityEl) activityEl.style.display = '';
if (activityElM) activityElM.style.display = '';
}
} }
}) })
.catch(() => { document.body.removeAttribute('data-auth-pending'); }); .catch(() => { document.body.removeAttribute('data-auth-pending'); });