Sfoglia il codice sorgente

Normalise rss types in hooks

Update useRealArticles.tsx and useFeedArticles.tsx to map feeds.type:
- convert rss-manual and rss-auto to rss
- keep other types as-is
This ensures correct category handling and UI rendering for RSS articles.

X-Lovable-Edit-ID: edt-af7df2fa-cdb1-4808-95cc-1b9b3594988b
gpt-engineer-app[bot] 1 settimana fa
parent
commit
2d62dc2eae
2 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 1 1
      src/hooks/useFeedArticles.tsx
  2. 3 3
      src/hooks/useRealArticles.tsx

+ 1 - 1
src/hooks/useFeedArticles.tsx

@@ -86,7 +86,7 @@ export function useFeedArticles(feedId: string, page: number = 1) {
           description: article.description || '',
           content: article.content || '',
           source: article.feeds.name,
-          category: article.feeds.type as NewsItem['category'],
+          category: (article.feeds.type?.startsWith('rss') ? 'rss' : article.feeds.type) as NewsItem['category'],
           publishedAt: article.published_at,
           readTime: article.read_time || 5,
           isPinned: user ? (article.user_articles[0]?.is_pinned || false) : false,

+ 3 - 3
src/hooks/useRealArticles.tsx

@@ -132,7 +132,7 @@ export function useRealArticles(dateFilter?: 'today' | 'yesterday' | null, showF
             description: article.description || '',
             content: article.content || '',
             source: article.feeds.name,
-            category: article.feeds.type as NewsItem['category'],
+            category: (article.feeds.type?.startsWith('rss') ? 'rss' : article.feeds.type) as NewsItem['category'],
             publishedAt: article.published_at,
             readTime: article.read_time || 5,
             isPinned: article.user_articles?.[0]?.is_pinned || false,
@@ -192,7 +192,7 @@ export function useRealArticles(dateFilter?: 'today' | 'yesterday' | null, showF
           content: article.content || '',
           publishedAt: article.published_at,
           source: article.feeds.name,
-          category: article.feeds.type as 'rss' | 'youtube' | 'steam' | 'actualites',
+          category: (article.feeds.type?.startsWith('rss') ? 'rss' : article.feeds.type) as 'rss' | 'youtube' | 'steam' | 'actualites',
           url: article.url || '',
           imageUrl: article.image_url,
           isPinned: false,
@@ -272,7 +272,7 @@ export function useRealArticles(dateFilter?: 'today' | 'yesterday' | null, showF
             description: article.description || '',
             content: article.content || '',
             source: article.feeds.name,
-            category: article.feeds.type as NewsItem['category'],
+            category: (article.feeds.type?.startsWith('rss') ? 'rss' : article.feeds.type) as NewsItem['category'],
             publishedAt: article.published_at,
             readTime: article.read_time || 5,
             isPinned: user ? (article.user_articles?.[0]?.is_pinned || false) : false,