use nextjs Link component instead of javascript for the ViewNoteButton component

This commit is contained in:
mr0x50
2025-01-19 17:59:24 +01:00
parent 226da74232
commit 75febc1285

View File

@@ -1,10 +1,13 @@
import { Button } from "@/components/ui/button";
import { SizeIcon } from "@radix-ui/react-icons";
import Link from "next/link";
import { nip19 } from "nostr-tools";
export default function ViewNoteButton({ event }: { event: any }) {
const encodedNoteId = nip19.noteEncode(event.id);
return (
<Button variant="secondary" onClick={() => window.location.href = '/note/'+encodedNoteId}><SizeIcon /></Button>
<Link href={'/note/' + encodedNoteId} passHref>
<Button variant="secondary"><SizeIcon /></Button>
</Link>
);
}