import React from 'react';
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
import { Rss, Globe, ToggleLeft, ToggleRight, ExternalLink } from 'lucide-react';
import { apiClient, Feed } from '../lib/api';
const Feeds: React.FC = () => {
const queryClient = useQueryClient();
const { data: feeds, isLoading, error } = useQuery({
queryKey: ['feeds'],
queryFn: () => apiClient.getFeeds(),
});
const toggleMutation = useMutation({
mutationFn: (feedId: number) => apiClient.toggleFeed(feedId),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['feeds'] });
},
});
const handleToggle = (feedId: number) => {
toggleMutation.mutate(feedId);
};
const getTypeIcon = (type: string) => {
switch (type) {
case 'rss':
return
Failed to load feeds
Manage your RSS feeds and website sources
{feed.description || 'No description provided'}
Get started by adding your first feed.