mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-03-28 18:53:47 +01:00
hide zaps from muted users in stream
This commit is contained in:
parent
1191d99cd4
commit
00e605214a
@ -47,6 +47,7 @@ import useCurrentAccount from "../../hooks/use-current-account";
|
|||||||
import useCacheForm from "../../hooks/use-cache-form";
|
import useCacheForm from "../../hooks/use-cache-form";
|
||||||
import { useAdditionalRelayContext } from "../../providers/additional-relay-context";
|
import { useAdditionalRelayContext } from "../../providers/additional-relay-context";
|
||||||
import { useTextAreaUploadFileWithForm } from "../../hooks/use-textarea-upload-file";
|
import { useTextAreaUploadFileWithForm } from "../../hooks/use-textarea-upload-file";
|
||||||
|
import { useThrottle } from "react-use";
|
||||||
|
|
||||||
type FormValues = {
|
type FormValues = {
|
||||||
subject: string;
|
subject: string;
|
||||||
@ -147,6 +148,8 @@ export default function PostModal({
|
|||||||
const canSubmit = getValues().content.length > 0;
|
const canSubmit = getValues().content.length > 0;
|
||||||
const mentions = getContentMentions(correctContentMentions(getValues().content));
|
const mentions = getContentMentions(correctContentMentions(getValues().content));
|
||||||
|
|
||||||
|
const previewDraft = useThrottle(getDraft(), 500);
|
||||||
|
|
||||||
const renderContent = () => {
|
const renderContent = () => {
|
||||||
if (publishAction) {
|
if (publishAction) {
|
||||||
return (
|
return (
|
||||||
@ -176,12 +179,12 @@ export default function PostModal({
|
|||||||
if (e.ctrlKey && e.key === "Enter") submit();
|
if (e.ctrlKey && e.key === "Enter") submit();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
{getValues().content.length > 0 && (
|
{previewDraft.content.length > 0 && (
|
||||||
<Box>
|
<Box>
|
||||||
<Heading size="sm">Preview:</Heading>
|
<Heading size="sm">Preview:</Heading>
|
||||||
<Box borderWidth={1} borderRadius="md" p="2">
|
<Box borderWidth={1} borderRadius="md" p="2">
|
||||||
<TrustProvider trust>
|
<TrustProvider trust>
|
||||||
<NoteContents event={getDraft()} />
|
<NoteContents event={previewDraft} />
|
||||||
</TrustProvider>
|
</TrustProvider>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -11,6 +11,7 @@ import { parseZapEvent } from "../../../../helpers/nostr/zaps";
|
|||||||
import { readablizeSats } from "../../../../helpers/bolt11";
|
import { readablizeSats } from "../../../../helpers/bolt11";
|
||||||
import { TrustProvider } from "../../../../providers/trust";
|
import { TrustProvider } from "../../../../providers/trust";
|
||||||
import ChatMessageContent from "./chat-message-content";
|
import ChatMessageContent from "./chat-message-content";
|
||||||
|
import useClientSideMuteFilter from "../../../../hooks/use-client-side-mute-filter";
|
||||||
|
|
||||||
function ZapMessage({ zap, stream }: { zap: NostrEvent; stream: ParsedStream }) {
|
function ZapMessage({ zap, stream }: { zap: NostrEvent; stream: ParsedStream }) {
|
||||||
const ref = useRef<HTMLDivElement | null>(null);
|
const ref = useRef<HTMLDivElement | null>(null);
|
||||||
@ -21,8 +22,10 @@ function ZapMessage({ zap, stream }: { zap: NostrEvent; stream: ParsedStream })
|
|||||||
return parseZapEvent(zap);
|
return parseZapEvent(zap);
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}, [zap]);
|
}, [zap]);
|
||||||
|
const clientMuteFilter = useClientSideMuteFilter();
|
||||||
|
|
||||||
if (!parsed || !parsed.payment.amount) return null;
|
if (!parsed || !parsed.payment.amount) return null;
|
||||||
|
if (clientMuteFilter(parsed.event)) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TrustProvider event={parsed.request}>
|
<TrustProvider event={parsed.request}>
|
||||||
|
@ -25,6 +25,7 @@ import { useContextEmojis } from "../../../providers/emoji-provider";
|
|||||||
import { TrustProvider } from "../../../providers/trust";
|
import { TrustProvider } from "../../../providers/trust";
|
||||||
import { nostrBuildUploadImage } from "../../../helpers/nostr-build";
|
import { nostrBuildUploadImage } from "../../../helpers/nostr-build";
|
||||||
import { UploadImageIcon } from "../../../components/icons";
|
import { UploadImageIcon } from "../../../components/icons";
|
||||||
|
import { useThrottle } from "react-use";
|
||||||
|
|
||||||
export type ReplyFormProps = {
|
export type ReplyFormProps = {
|
||||||
item: ThreadItem;
|
item: ThreadItem;
|
||||||
@ -96,6 +97,7 @@ export default function ReplyForm({ item, onCancel, onSubmitted, replyKind = Kin
|
|||||||
});
|
});
|
||||||
|
|
||||||
const formRef = useRef<HTMLFormElement | null>(null);
|
const formRef = useRef<HTMLFormElement | null>(null);
|
||||||
|
const previewDraft = useThrottle(draft, 500);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex as="form" direction="column" gap="2" pb="4" onSubmit={submit} ref={formRef}>
|
<Flex as="form" direction="column" gap="2" pb="4" onSubmit={submit} ref={formRef}>
|
||||||
@ -142,10 +144,10 @@ export default function ReplyForm({ item, onCancel, onSubmitted, replyKind = Kin
|
|||||||
</Button>
|
</Button>
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</Flex>
|
</Flex>
|
||||||
{getValues().content.length > 0 && (
|
{previewDraft.content.length > 0 && (
|
||||||
<Box p="2" borderWidth={1} borderRadius="md" mb="2">
|
<Box p="2" borderWidth={1} borderRadius="md" mb="2">
|
||||||
<TrustProvider trust>
|
<TrustProvider trust>
|
||||||
<NoteContents event={draft} />
|
<NoteContents event={previewDraft} />
|
||||||
</TrustProvider>
|
</TrustProvider>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user