import { Fragment, useMemo } from "react"; import { t } from "@lingui/core/macro"; import { Trans } from "@lingui/react/macro"; import { ErrorCard } from "../../components/ui/ErrorCard.tsx"; import { JournalCard } from "../../components/dump/JournalCard.tsx"; import { composeJournal } from "../../utils/journalLayout.ts"; import type { MainFeedProps } from "./types.ts"; export function JournalFeed( { dumps, loading, error, hasMore, loadingMore, sentinelRef, voteCounts, myVotes, user, castVote, removeVote, }: MainFeedProps, ) { const blocks = useMemo(() => composeJournal(dumps), [dumps]); if (loading) { return (

Loading…

); } if (error) return ; if (blocks.length === 0) { return (

No dumps yet. Be the first!

); } return ( <> { /* Each sub-block is its own grid, with a themable
between them. A break sits between two grids rather than inside one because a grid item would be stretched to the 9rem row track — out here its height is its own, down to nothing for a theme that wants no separation. */ }
{blocks.map((block, index) => ( {index > 0 &&
}
    {block.entries.map(({ dump, shape }) => ( ))}
))}
{loadingMore && (

Loading more…

)} {!hasMore && blocks.length > 0 && (

You've reached the end.

)} ); }