import { useMemo } from "react"; import { t } from "@lingui/core/macro" import { Trans } from "@lingui/react/macro"; import { DumpCard } from "../../components/DumpCard.tsx"; import { ErrorCard } from "../../components/ErrorCard.tsx"; import { hotScore } from "../../utils/hotScore.ts"; import type { MainFeedProps } from "./types.ts"; export function HotFeed( { dumps, loading, error, hasMore, loadingMore, sentinelRef, voteCounts, myVotes, user, castVote, removeVote, }: MainFeedProps, ) { const sorted = useMemo( () => [...dumps].sort((a, b) => hotScore(b) - hotScore(a)), [dumps], ); if (loading) return

Loading…

; if (error) return ; if (sorted.length === 0) { return

No dumps yet. Be the first!

; } return ( <>
{loadingMore &&

Loading more…

} {!hasMore && sorted.length > 0 && (

You've reached the end.

)} ); }