import { useMemo } from "react"; import { t } from "@lingui/core/macro" import { Trans } from "@lingui/react/macro"; import { ErrorCard } from "../../components/ErrorCard.tsx"; import { JournalCard, type JournalTier, } from "../../components/JournalCard.tsx"; import { hotScore } from "../../utils/hotScore.ts"; import type { MainFeedProps } from "./types.ts"; export function JournalFeed( { dumps, loading, error, hasMore, loadingMore, sentinelRef, voteCounts, myVotes, user, castVote, removeVote, }: MainFeedProps, ) { const tiered = useMemo(() => { const sorted = [...dumps].sort((a, b) => hotScore(b) - hotScore(a)); const n = sorted.length; return sorted.map((dump, i) => { const rank = i / n; const tier: JournalTier = rank < 0.2 ? "large" : rank < 0.5 ? "medium" : "small"; return { dump, tier }; }); }, [dumps]); if (loading) return