mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-07-12 21:32:19 +02:00
small stream chat features
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
import { useRef } from "react";
|
import React, { useRef } from "react";
|
||||||
import { Box, Text } from "@chakra-ui/react";
|
import { Box, Text } from "@chakra-ui/react";
|
||||||
import { ParsedStream } from "../../../../helpers/nostr/stream";
|
import { ParsedStream } from "../../../../helpers/nostr/stream";
|
||||||
import { UserAvatar } from "../../../../components/user-avatar";
|
import { UserAvatar } from "../../../../components/user-avatar";
|
||||||
@ -9,7 +9,7 @@ import { TrustProvider } from "../../../../providers/trust";
|
|||||||
import ChatMessageContent from "./chat-message-content";
|
import ChatMessageContent from "./chat-message-content";
|
||||||
import NoteZapButton from "../../../../components/note/note-zap-button";
|
import NoteZapButton from "../../../../components/note/note-zap-button";
|
||||||
|
|
||||||
export default function ChatMessage({ event, stream }: { event: NostrEvent; stream: ParsedStream }) {
|
function ChatMessage({ event, stream }: { event: NostrEvent; stream: ParsedStream }) {
|
||||||
const ref = useRef<HTMLDivElement | null>(null);
|
const ref = useRef<HTMLDivElement | null>(null);
|
||||||
useRegisterIntersectionEntity(ref, event.id);
|
useRegisterIntersectionEntity(ref, event.id);
|
||||||
|
|
||||||
@ -29,3 +29,6 @@ export default function ChatMessage({ event, stream }: { event: NostrEvent; stre
|
|||||||
</TrustProvider>
|
</TrustProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ChatMessageMemo = React.memo(ChatMessage);
|
||||||
|
export default ChatMessageMemo;
|
||||||
|
@ -19,15 +19,14 @@ export default function TopZappers({ zaps, ...props }: FlexProps & { zaps: Parse
|
|||||||
return (
|
return (
|
||||||
<Flex overflowX="auto" overflowY="hidden" gap="4" py="2" px="4" {...props}>
|
<Flex overflowX="auto" overflowY="hidden" gap="4" py="2" px="4" {...props}>
|
||||||
{sortedTotals.map(([pubkey, total]) => (
|
{sortedTotals.map(([pubkey, total]) => (
|
||||||
<Flex key={pubkey} gap="2" alignItems="center" maxW="sm">
|
<Flex key={pubkey} gap="2" alignItems="center" maxW="2xs">
|
||||||
<UserAvatar pubkey={pubkey} size="sm" noProxy />
|
<UserAvatar pubkey={pubkey} size="sm" noProxy />
|
||||||
<Box>
|
<Text whiteSpace="nowrap" isTruncated>
|
||||||
<UserLink pubkey={pubkey} isTruncated fontWeight="bold" />
|
<UserLink pubkey={pubkey} fontWeight="bold" />
|
||||||
<Text whiteSpace="nowrap">
|
<br />
|
||||||
<LightningIcon />
|
<LightningIcon />
|
||||||
{readablizeSats(total / 1000)}
|
{readablizeSats(total / 1000)}
|
||||||
</Text>
|
</Text>
|
||||||
</Box>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
))}
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
|
Reference in New Issue
Block a user