From ab133d0e4f9909a6b200f78a2d6818e1eb38d3e0 Mon Sep 17 00:00:00 2001 From: vikingowl Date: Sat, 2 Aug 2025 23:53:16 +0200 Subject: [PATCH] implemented infinite scrolling with load more functionality, pagination support, and expanded state handling for articles --- TODO.md | 3 +- frontend/src/components/NewsFilters.vue | 2 +- frontend/src/components/NewsList.vue | 88 ++++++++++++++++++++----- frontend/src/stores/useNews.ts | 52 ++++++++++++++- 4 files changed, 125 insertions(+), 20 deletions(-) diff --git a/TODO.md b/TODO.md index 348b559..aa9f575 100644 --- a/TODO.md +++ b/TODO.md @@ -26,7 +26,8 @@ - [ ] Duplicate article detection - Avoid showing same story from multiple sources ## User Experience -- [ ] Dark/light theme toggle +- [x] Dark/light theme toggle +- [x] Infinite scroll / load more functionality for articles - [ ] Customizable article layout - List view, card view, magazine style - [ ] Keyboard shortcuts - Navigate articles without mouse - [ ] Offline reading support - Cache articles for offline access diff --git a/frontend/src/components/NewsFilters.vue b/frontend/src/components/NewsFilters.vue index 505b83f..7f64861 100644 --- a/frontend/src/components/NewsFilters.vue +++ b/frontend/src/components/NewsFilters.vue @@ -290,7 +290,7 @@ const availableCountries = computed(() => { return Array.from(countries).sort(); }); -const articleCount = computed(() => news.articles.length); +const articleCount = computed(() => news.allArticles.length); // Date presets const datePresets: DatePreset[] = [ diff --git a/frontend/src/components/NewsList.vue b/frontend/src/components/NewsList.vue index beb9f01..a471e9a 100644 --- a/frontend/src/components/NewsList.vue +++ b/frontend/src/components/NewsList.vue @@ -44,16 +44,19 @@

+ class="text-sm sm:text-base text-gray-700 dark:text-gray-300 line-clamp-5 leading-relaxed"> {{ article.summary }}

+ - + +
-
- -
- Read full article + Full article + d="M10 6H6a2 2 0 00-2 2v10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"/>
- -
-

- Showing {{ news.articles.length }} articles + +

+

+ Loading more articles... +

+

+ No more articles to load +

+

+ Showing {{ news.articles.length }} of {{ news.allArticles.length }} articles

@@ -98,11 +104,63 @@