fix stream top zappers amount

This commit is contained in:
hzrd149 2024-11-25 11:59:44 -06:00
parent a5fbfc274a
commit 30a3849ef3
4 changed files with 7 additions and 7 deletions

View File

@ -18,7 +18,7 @@ export default function GoalTopZappers({
const totals = zaps?.reduce<Record<string, number>>((dir, z) => {
const sender = getZapSender(z);
dir[sender] = dir[sender] + (getZapPayment(z)?.amount ?? 0);
dir[sender] = (dir[sender] ?? 0) + (getZapPayment(z)?.amount ?? 0);
return dir;
}, {});

View File

@ -9,13 +9,13 @@ import useStreamChatTimeline from "../stream/stream-chat/use-stream-chat-timelin
import { ParsedStream } from "../../../helpers/nostr/stream";
import UserAvatarLink from "../../../components/user/user-avatar-link";
export default function TopZappers({ stream, ...props }: FlexProps & { stream: ParsedStream }) {
export default function StreamTopZappers({ stream, ...props }: FlexProps & { stream: ParsedStream }) {
const { timeline } = useStreamChatTimeline(stream);
const zaps = timeline.filter((e) => e.kind === kinds.Zap);
const totals = zaps?.reduce<Record<string, number>>((dir, z) => {
const sender = getZapSender(z);
dir[sender] = dir[sender] + (getZapPayment(z)?.amount ?? 0);
dir[sender] = (dir[sender] ?? 0) + (getZapPayment(z)?.amount ?? 0);
return dir;
}, {});

View File

@ -35,7 +35,7 @@ import { UserEmojiProvider } from "../../../providers/global/emoji-provider";
import StreamStatusBadge from "../components/status-badge";
import ChatMessageForm from "./stream-chat/stream-chat-form";
import StreamChatLog from "./stream-chat/chat-log";
import TopZappers from "../components/top-zappers";
import StreamTopZappers from "../components/stream-top-zappers";
import StreamHashtags from "../components/stream-hashtags";
import StreamZapButton from "../components/stream-zap-button";
import StreamGoal from "../components/stream-goal";
@ -185,7 +185,7 @@ function MobileStreamPage({ stream }: { stream: ParsedStream }) {
Stream Chat
</DrawerHeader>
<DrawerBody p={0} overflow="hidden" display="flex" gap="2" flexDirection="column">
<TopZappers stream={stream} px="2" />
<StreamTopZappers stream={stream} px="2" />
<StreamChatLog stream={stream} flex={1} px="2" />
<ChatMessageForm stream={stream} />
</DrawerBody>

View File

@ -5,7 +5,7 @@ import { ParsedStream } from "../../../../helpers/nostr/stream";
import { LightboxProvider } from "../../../../components/lightbox-provider";
import IntersectionObserverProvider from "../../../../providers/local/intersection-observer";
import { useTimelineCurserIntersectionCallback } from "../../../../hooks/use-timeline-cursor-intersection-callback";
import TopZappers from "../../components/top-zappers";
import StreamTopZappers from "../../components/stream-top-zappers";
import ChatMessageForm from "./stream-chat-form";
import useStreamChatTimeline from "./use-stream-chat-timeline";
import StreamChatLog from "./chat-log";
@ -37,7 +37,7 @@ export default function StreamChat({
</CardHeader>
)}
<CardBody display="flex" flexDirection="column" overflow="hidden" p={0}>
<TopZappers stream={stream} py="2" px="4" pt={!isPopup ? 0 : undefined} />
<StreamTopZappers stream={stream} py="2" px="4" pt={!isPopup ? 0 : undefined} />
<StreamChatLog ref={scrollBox} stream={stream} flex={1} px="4" py="2" mb="2" />
{!isChatLog && <ChatMessageForm stream={stream} />}
</CardBody>