diff --git a/web/app.js b/web/app.js
index 1a5dd23..151a03e 100644
--- a/web/app.js
+++ b/web/app.js
@@ -1378,7 +1378,16 @@ function updateTabButtons() {
});
}
+function isPostsViewActive() {
+ const postsView = document.querySelector('[data-view="posts"]');
+ return Boolean(postsView && postsView.classList.contains('app-view--active'));
+}
+
function updateTabInUrl() {
+ if (!isPostsViewActive()) {
+ return;
+ }
+
const url = new URL(window.location.href);
if (currentTab === 'pending') {
url.searchParams.set('tab', 'pending');
@@ -1387,7 +1396,8 @@ function updateTabInUrl() {
} else {
url.searchParams.set('tab', 'all');
}
- window.history.replaceState({}, document.title, `${url.pathname}?${url.searchParams.toString()}${url.hash}`);
+ const nextState = { ...(window.history.state || {}), view: 'posts' };
+ window.history.replaceState(nextState, document.title, `${url.pathname}?${url.searchParams.toString()}${url.hash}`);
}
function getTabKey(tab = currentTab) {
@@ -2770,6 +2780,12 @@ document.querySelectorAll('.tab-btn').forEach(btn => {
});
});
+window.addEventListener('app:view-change', (event) => {
+ if (event && event.detail && event.detail.view === 'posts') {
+ updateTabInUrl();
+ }
+});
+
if (manualPostForm) {
manualPostForm.addEventListener('submit', handleManualPostSubmit);
}
diff --git a/web/index.html b/web/index.html
index 0a7d224..358c563 100644
--- a/web/index.html
+++ b/web/index.html
@@ -20,8 +20,8 @@
đź“‹ Post Tracker
-
-
+
+
@@ -645,6 +645,11 @@
const params = new URLSearchParams(window.location.search);
const initialParam = params.get('view');
const defaultView = viewMap[initialParam] ? initialParam : 'posts';
+ const VIEW_CHANGE_EVENT = 'app:view-change';
+
+ function dispatchViewChange(view) {
+ window.dispatchEvent(new CustomEvent(VIEW_CHANGE_EVENT, { detail: { view } }));
+ }
function setView(view, options = { updateHistory: true }) {
if (!viewMap[view]) {
@@ -667,11 +672,14 @@
nextParams.delete('view');
} else {
nextParams.set('view', view);
+ nextParams.delete('tab');
}
const query = nextParams.toString();
const newUrl = query ? `${window.location.pathname}?${query}` : window.location.pathname;
window.history.pushState({ view }, '', newUrl);
}
+
+ dispatchViewChange(view);
}
buttons.forEach((button) => {
@@ -691,6 +699,7 @@
initParams.delete('view');
} else {
initParams.set('view', defaultView);
+ initParams.delete('tab');
}
const initQuery = initParams.toString();
window.history.replaceState({ view: defaultView }, '', initQuery ? `${window.location.pathname}?${initQuery}` : window.location.pathname);
diff --git a/web/style.css b/web/style.css
index d59f1d1..e88a65b 100644
--- a/web/style.css
+++ b/web/style.css
@@ -83,37 +83,64 @@ header {
}
.site-nav {
- display: inline-flex;
+ display: flex;
align-items: center;
- gap: 8px;
- background: rgba(255, 255, 255, 0.6);
- border-radius: 999px;
- padding: 6px;
- backdrop-filter: blur(8px);
- border: 1px solid rgba(148, 163, 184, 0.25);
+ gap: 6px;
+ padding: 4px 0;
+ border-bottom: 1px solid rgba(15, 23, 42, 0.08);
+ position: relative;
+}
+
+.site-nav::after {
+ content: "";
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: -1px;
+ height: 1px;
+ background: linear-gradient(90deg, rgba(79, 70, 229, 0.7), rgba(14, 165, 233, 0.7));
+ opacity: 0.35;
}
.site-nav__btn {
- border-radius: 999px;
- padding: 10px 18px;
border: none;
background: transparent;
font-weight: 600;
- color: #0f172a;
+ color: #475569;
cursor: pointer;
- transition: all 0.2s ease;
- box-shadow: none;
+ transition: color 0.2s ease, transform 0.2s ease;
+ font-size: 15px;
+ letter-spacing: 0.01em;
+ padding: 10px 16px;
+ position: relative;
+}
+
+.site-nav__btn::after {
+ content: "";
+ position: absolute;
+ left: 12px;
+ right: 12px;
+ bottom: -8px;
+ height: 3px;
+ border-radius: 999px;
+ background: linear-gradient(135deg, #4338ca, #0ea5e9);
+ transform: translateY(6px);
+ opacity: 0;
+ transition: opacity 0.15s ease, transform 0.2s ease;
}
.site-nav__btn:hover {
- background: rgba(15, 23, 42, 0.05);
+ color: #0f172a;
transform: translateY(-1px);
}
.site-nav__btn.nav-active {
- background: linear-gradient(135deg, #2563eb, #7c3aed);
- color: white;
- box-shadow: 0 12px 30px rgba(37, 99, 235, 0.35);
+ color: #0f172a;
+}
+
+.site-nav__btn.nav-active::after {
+ opacity: 1;
+ transform: translateY(0);
}
.header-controls {