import { faCheck, faCircle, faTrash } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { useMutation, useQuery } from "urql"; import { GetFeedsDocument, MarkFeedReadDocument, MarkFeedUnreadDocument, UnsubscribeFeedDocument, } from "../graphql/generated/graphql"; interface Props { onFeedUnsubscribed?: () => void; } export function FeedList({ onFeedUnsubscribed }: Props) { const [{ data, fetching, error }] = useQuery({ query: GetFeedsDocument, }); const [, markFeedRead] = useMutation(MarkFeedReadDocument); const [, markFeedUnread] = useMutation(MarkFeedUnreadDocument); const [, unsubscribeFeed] = useMutation(UnsubscribeFeedDocument); const handleMarkAllRead = async (feedId: string) => { await markFeedRead({ id: feedId }); }; const handleMarkAllUnread = async (feedId: string) => { await markFeedUnread({ id: feedId }); }; const handleUnsubscribeFeed = async (feedId: string) => { const confirmed = window.confirm( "Are you sure you want to unsubscribe from this feed?", ); if (confirmed) { await unsubscribeFeed({ id: feedId }); onFeedUnsubscribed?.(); } }; if (fetching) return