Keeps a list of the dumps a user upvoted in step with their votes.
Follows the votes of profileUserId into their upvoted list. A dump they
upvote is fetched and put first. One whose vote they withdraw fades out
(useFading), then leaves the list, unless they vote again meanwhile. The
socket's vote events report every browser's votes; on one's own list,
myVotes also reports this tab's at once.
Passed to useUpvotedList by useUserDumpFeed, for an upvoted list.
-
profileUserId: string | null
The list holds this user's upvotes. It is null while their profile loads.
-
setItems: (fn: (prev: Dump[]) => Dump[]) => void
Does nothing until the list is loaded.
-
source: Dump[]
It holds dumps already at hand, which a vote of the signed-in user on their own list puts first at once, before the socket's vote event. The profile passes its first page of the user's dumps.
Returned by useUpvotedList.
-
cardClassName: (dump: Dump) => string | undefined
It goes to
DumpCardList'scardClassName. -
isWithdrawn: (id: string) => boolean
Checks whether the vote on dump
idwas withdrawn since the list loaded. The profile'suseDumpListSynckeeps such a dump from coming back.
Usage
import * as mod from "src/hooks/dump/useUpvotedList.ts";