import { useQuery } from '@apollo/client'
import Button from 'react-bootstrap/Button'
import { useState } from 'react'
import Comment, { CommentSkeleton } from './comment'
import Item from './item'
import { NOTIFICATIONS } from '../fragments/notifications'
import styles from './notifications.module.css'
import { useRouter } from 'next/router'
export default function Notifications ({ variables, ...props }) {
const router = useRouter()
const { loading, error, data, fetchMore } = useQuery(NOTIFICATIONS, {
variables
})
if (error) return
Failed to load!
if (loading) {
return
}
const { notifications: { notifications, cursor } } = data
return (
<>
{/* XXX we shouldn't use the index but we don't have a unique id in this union yet */}
{notifications.map((n, i) => (