Skip to content

Commit cf0d052

Browse files
author
Basu Jindal
committed
show stats tab swhen logged in
1 parent 60d2647 commit cf0d052

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

js/components.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@
4343
const header = document.querySelector('header');
4444
if (header && !header.innerHTML.trim()) {
4545
header.innerHTML = headerHTML;
46+
47+
// Add Stats link if logged in as owner
48+
if (localStorage.getItem('thoughts_is_owner') === 'true') {
49+
const nav = header.querySelector('nav');
50+
if (nav) {
51+
const statsLink = document.createElement('a');
52+
statsLink.href = '/stats/';
53+
statsLink.textContent = 'Stats';
54+
nav.appendChild(statsLink);
55+
}
56+
}
4657
}
4758

4859
// Hamburger menu functionality
@@ -98,6 +109,7 @@
98109
(pagePath.startsWith('diffchecker') && href.includes('diffchecker')) ||
99110
(pagePath.startsWith('job_search') && href.includes('job_search')) ||
100111
(pagePath.startsWith('thoughts') && href.includes('thoughts')) ||
112+
(pagePath.startsWith('stats') && href.includes('stats')) ||
101113
(pagePath.startsWith('post') && href.includes('/blogs/'))) {
102114
link.classList.add('active');
103115
}

thoughts-api

0 commit comments

Comments
 (0)