if (!data) {
return
}
const { notifications: { notifications, cursor, lastChecked } } = data
const [fresh, old] =
notifications.reduce((result, n) => {
result[new Date(n.sortTime).getTime() > lastChecked ? 0 : 1].push(n)
return result
},
[[], []])
return (
<>
{/* XXX we shouldn't use the index but we don't have a unique id in this union yet */}
{fresh.map((n, i) => (
))}
{old.map((n, i) => (
))}
>
)
}
function CommentsFlatSkeleton () {
const comments = new Array(21).fill(null)
return (
{comments.map((_, i) => (
))}
)
}
function MoreFooter ({ cursor, fetchMore }) {
const [loading, setLoading] = useState(false)
if (loading) {
return
}
let Footer
if (cursor) {
Footer = () => (
)
} else {
Footer = () => (