disable media and line breaks in trending notes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Martti Malmi 2023-11-30 13:03:22 +02:00
parent 468dc3bae6
commit a4f691d260

View File

@ -5,6 +5,8 @@ import { Link } from "react-router-dom";
import NoteTime from "@/Element/Event/NoteTime"; import NoteTime from "@/Element/Event/NoteTime";
export default function ShortNote({ event }: { event: TaggedNostrEvent }) { export default function ShortNote({ event }: { event: TaggedNostrEvent }) {
// replace newlines with spaces, replace double spaces with single spaces
const content = event.content.slice(0, 80).replace(/\n/g, " ").replace(/ +/g, " ");
return ( return (
<Link to={`/${NostrLink.fromEvent(event).encode(CONFIG.eventLinkPrefix)}`} className="flex flex-col"> <Link to={`/${NostrLink.fromEvent(event).encode(CONFIG.eventLinkPrefix)}`} className="flex flex-col">
<div className="flex flex-row justify-between"> <div className="flex flex-row justify-between">
@ -12,7 +14,7 @@ export default function ShortNote({ event }: { event: TaggedNostrEvent }) {
<NoteTime from={event.created_at * 1000} /> <NoteTime from={event.created_at * 1000} />
</div> </div>
<div className="ml-10"> <div className="ml-10">
<Text {...event} truncate={75} /> <Text {...event} content={content} truncate={75} disableMedia={true} />
</div> </div>
</Link> </Link>
); );