import "./Note.css"; import { useState } from "react"; import { useSelector } from "react-redux"; import moment from "moment"; import { Link, useNavigate } from "react-router-dom"; import { faHeart, faReply, faInfo } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import Event from "../nostr/Event"; import ProfileImage from "./ProfileImage"; import useEventPublisher from "../feed/EventPublisher"; import { NoteCreator } from "./NoteCreator"; const UrlRegex = /((?:http|ftp|https):\/\/(?:[\w+?\.\w+])+(?:[a-zA-Z0-9\~\!\@\#\$\%\^\&\*\(\)_\-\=\+\\\/\?\.\:\;\'\,]*)?)/i; const FileExtensionRegex = /\.([\w]+)$/i; const MentionRegex = /(#\[\d+\])/gi; export default function Note(props) { const navigate = useNavigate(); const data = props.data; const dataEvent = props["data-ev"]; const reactions = props.reactions; const publisher = useEventPublisher(); const [showReply, setShowReply] = useState(false); const users = useSelector(s => s.users?.users); const ev = dataEvent ?? Event.FromObject(data); function goToEvent(e, id) { if (!window.location.pathname.startsWith("/e/")) { e.stopPropagation(); navigate(`/e/${id}`); } } function replyTag() { let thread = ev.GetThread(); if (thread === null) { return null; } let replyId = thread?.ReplyTo?.Event; let mentions = thread?.PubKeys?.map(a => [a, users[a]])?.map(a => a[1]?.name ?? a[0].substring(0, 8)); return (
{ev.Id}
Kind: {ev.Kind}
Content: {ev.Content}> ); } return (