remove reaction (kind 7) and fix onclick event
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import NoteLike from "@app/note/components/metadata/like";
|
|
||||||
import NoteReply from "@app/note/components/metadata/reply";
|
import NoteReply from "@app/note/components/metadata/reply";
|
||||||
import NoteRepost from "@app/note/components/metadata/repost";
|
import NoteRepost from "@app/note/components/metadata/repost";
|
||||||
|
|
||||||
@@ -19,7 +18,6 @@ export default function NoteMetadata({
|
|||||||
|
|
||||||
const [replies, setReplies] = useState(0);
|
const [replies, setReplies] = useState(0);
|
||||||
const [reposts, setReposts] = useState(0);
|
const [reposts, setReposts] = useState(0);
|
||||||
const [likes, setLikes] = useState(0);
|
|
||||||
|
|
||||||
useSWRSubscription(id ? ["note-metadata", id] : null, ([, key]) => {
|
useSWRSubscription(id ? ["note-metadata", id] : null, ([, key]) => {
|
||||||
const unsubscribe = pool.subscribe(
|
const unsubscribe = pool.subscribe(
|
||||||
@@ -27,7 +25,7 @@ export default function NoteMetadata({
|
|||||||
{
|
{
|
||||||
"#e": [key],
|
"#e": [key],
|
||||||
since: 0,
|
since: 0,
|
||||||
kinds: [1, 6, 7],
|
kinds: [1, 6],
|
||||||
limit: 20,
|
limit: 20,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -40,11 +38,6 @@ export default function NoteMetadata({
|
|||||||
case 6:
|
case 6:
|
||||||
setReposts((reposts) => reposts + 1);
|
setReposts((reposts) => reposts + 1);
|
||||||
break;
|
break;
|
||||||
case 7:
|
|
||||||
if (event.content === "🤙" || event.content === "+") {
|
|
||||||
setLikes((likes) => likes + 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -59,7 +52,6 @@ export default function NoteMetadata({
|
|||||||
return (
|
return (
|
||||||
<div className="mt-4 flex h-12 items-center gap-16 border-t border-zinc-800/50">
|
<div className="mt-4 flex h-12 items-center gap-16 border-t border-zinc-800/50">
|
||||||
<NoteReply id={id} replies={replies} />
|
<NoteReply id={id} replies={replies} />
|
||||||
<NoteLike id={id} pubkey={eventPubkey} likes={likes} />
|
|
||||||
<NoteRepost id={id} pubkey={eventPubkey} reposts={reposts} />
|
<NoteRepost id={id} pubkey={eventPubkey} reposts={reposts} />
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { MediaOutlet, MediaPlayer } from "@vidstack/react";
|
|||||||
export default function VideoPreview({ urls }: { urls: string[] }) {
|
export default function VideoPreview({ urls }: { urls: string[] }) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
onKeyDown={(e) => e.stopPropagation()}
|
onKeyDown={(e) => e.stopPropagation()}
|
||||||
className="relative mt-2 flex w-full flex-col overflow-hidden rounded-lg bg-zinc-950"
|
className="relative mt-2 flex w-full flex-col overflow-hidden rounded-lg bg-zinc-950"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -72,7 +72,11 @@ export const RootNote = memo(function RootNote({
|
|||||||
const contentFallback = noteParser(parseFallback);
|
const contentFallback = noteParser(parseFallback);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onKeyDown={(e) => openNote(e)} className="flex flex-col px-3">
|
<div
|
||||||
|
onClick={(e) => openNote(e)}
|
||||||
|
onKeyDown={(e) => openNote(e)}
|
||||||
|
className="flex flex-col px-3"
|
||||||
|
>
|
||||||
<NoteDefaultUser
|
<NoteDefaultUser
|
||||||
pubkey={parseFallback.pubkey}
|
pubkey={parseFallback.pubkey}
|
||||||
time={parseFallback.created_at}
|
time={parseFallback.created_at}
|
||||||
@@ -89,7 +93,11 @@ export const RootNote = memo(function RootNote({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onKeyDown={(e) => openNote(e)} className="flex flex-col px-3">
|
<div
|
||||||
|
onClick={(e) => openNote(e)}
|
||||||
|
onKeyDown={(e) => openNote(e)}
|
||||||
|
className="flex flex-col px-3"
|
||||||
|
>
|
||||||
{data ? (
|
{data ? (
|
||||||
<>
|
<>
|
||||||
<NoteDefaultUser pubkey={data.pubkey} time={data.created_at} />
|
<NoteDefaultUser pubkey={data.pubkey} time={data.created_at} />
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ export function NoteDefaultUser({
|
|||||||
>
|
>
|
||||||
<Popover.Panel className="absolute left-0 top-8 z-10 mt-3 w-screen max-w-sm px-4 sm:px-0 lg:max-w-3xl">
|
<Popover.Panel className="absolute left-0 top-8 z-10 mt-3 w-screen max-w-sm px-4 sm:px-0 lg:max-w-3xl">
|
||||||
<div
|
<div
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
onKeyDown={(e) => e.stopPropagation()}
|
onKeyDown={(e) => e.stopPropagation()}
|
||||||
className="w-full max-w-xs overflow-hidden rounded-lg border border-zinc-700 bg-zinc-900 shadow-input ring-1 ring-black ring-opacity-5"
|
className="w-full max-w-xs overflow-hidden rounded-lg border border-zinc-700 bg-zinc-900 shadow-input ring-1 ring-black ring-opacity-5"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export function NoteRepostUser({
|
|||||||
>
|
>
|
||||||
<Popover.Panel className="absolute left-0 top-8 z-10 mt-3 w-screen max-w-sm px-4 sm:px-0 lg:max-w-3xl">
|
<Popover.Panel className="absolute left-0 top-8 z-10 mt-3 w-screen max-w-sm px-4 sm:px-0 lg:max-w-3xl">
|
||||||
<div
|
<div
|
||||||
|
onClick={(e) => e.stopPropagation()}
|
||||||
onKeyDown={(e) => e.stopPropagation()}
|
onKeyDown={(e) => e.stopPropagation()}
|
||||||
className="w-full max-w-xs overflow-hidden rounded-lg border border-zinc-700 bg-zinc-900 shadow-input ring-1 ring-black ring-opacity-5"
|
className="w-full max-w-xs overflow-hidden rounded-lg border border-zinc-700 bg-zinc-900 shadow-input ring-1 ring-black ring-opacity-5"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -19,7 +19,11 @@ export function NoteWrapper({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div onKeyDown={(event) => openThread(event, href)} className={className}>
|
<div
|
||||||
|
onClick={(event) => openThread(event, href)}
|
||||||
|
onKeyDown={(event) => openThread(event, href)}
|
||||||
|
className={className}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ export function ComposerModal() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
onClick={closeModal}
|
||||||
onKeyDown={closeModal}
|
onKeyDown={closeModal}
|
||||||
className="inline-flex h-5 w-5 items-center justify-center rounded hover:bg-zinc-800"
|
className="inline-flex h-5 w-5 items-center justify-center rounded hover:bg-zinc-800"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user