aboutsummaryrefslogtreecommitdiffstats
path: root/frontend-vanilla/src/main.ts
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-15 20:47:26 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-15 20:47:26 -0800
commit27bd895a5ff0b95045ea6a26b9440874b1c6bf0e (patch)
treec579405e33a77628f11de9429f2a19455d93c2c7 /frontend-vanilla/src/main.ts
parentd98873787ec40938a4fafdb9bee562b494428f71 (diff)
downloadneko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.tar.gz
neko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.tar.bz2
neko-27bd895a5ff0b95045ea6a26b9440874b1c6bf0e.zip
Vanilla JS (v3): Reduce font size and implement collapsible sidebar sections for Tags and Feeds
Diffstat (limited to 'frontend-vanilla/src/main.ts')
-rw-r--r--frontend-vanilla/src/main.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/frontend-vanilla/src/main.ts b/frontend-vanilla/src/main.ts
index 400bf7b..3553ea7 100644
--- a/frontend-vanilla/src/main.ts
+++ b/frontend-vanilla/src/main.ts
@@ -44,12 +44,12 @@ export function renderLayout() {
<li class="filter-item" data-filter="starred"><a href="/v3/?filter=starred" data-nav="filter" data-value="starred">Starred</a></li>
</ul>
</section>
- <section class="sidebar-section">
- <h3>Tags</h3>
+ <section class="sidebar-section collapsible collapsed" id="section-tags">
+ <h3>Tags <span class="caret">▶</span></h3>
<ul id="tag-list"></ul>
</section>
- <section class="sidebar-section">
- <h3>Feeds</h3>
+ <section class="sidebar-section collapsible collapsed" id="section-feeds">
+ <h3>Feeds <span class="caret">▶</span></h3>
<ul id="feed-list"></ul>
</section>
</div>
@@ -96,6 +96,13 @@ export function attachLayoutListeners() {
}
});
+ // Collapsible sections
+ document.querySelectorAll('.sidebar-section.collapsible h3').forEach(header => {
+ header.addEventListener('click', () => {
+ header.parentElement?.classList.toggle('collapsed');
+ });
+ });
+
// Event delegation for filters, tags, and feeds in sidebar
const sidebar = document.getElementById('sidebar');
sidebar?.addEventListener('click', (e) => {
@@ -420,9 +427,11 @@ function handleRoute() {
const id = parseInt(route.params.feedId);
store.setActiveFeed(id);
fetchItems(route.params.feedId);
+ document.getElementById('section-feeds')?.classList.remove('collapsed');
} else if (route.path === '/tag' && route.params.tagName) {
store.setActiveTag(route.params.tagName);
fetchItems(undefined, route.params.tagName);
+ document.getElementById('section-tags')?.classList.remove('collapsed');
} else {
store.setActiveFeed(null);
store.setActiveTag(null);