hide nonpow replies and fix quotes

This commit is contained in:
smolgrrr 2024-09-06 17:55:59 +10:00
parent 1b7f904711
commit 99337afedd
2 changed files with 20 additions and 11 deletions

View File

@ -91,6 +91,7 @@ const NewNoteCard = ({
break;
case 'Quote':
unsigned.tags.push(['q', refEvent.id]);
setComment(comment + '\nnostr:' + nip19.noteEncode(refEvent.id));
break;
default:
addEventTags();

View File

@ -51,6 +51,7 @@ const Thread = () => {
return () => window.removeEventListener("scroll", handleScroll);
}, []);
const [showAllReplies, setShowAllReplies] = useState(false);
if (OPEvent) {
const uniqEvents = uniqBy(prevMentions, "id");
const earlierEvents = uniqEvents
@ -79,8 +80,15 @@ const Thread = () => {
</div>
<ThreadPostModal OPEvent={OPEvent} />
<div className="col-span-full h-0.5 bg-neutral-900 mb-2"/> {/* This is the white line separator */}
<div className="flex justify-center">
<button onClick={() => setShowAllReplies(!showAllReplies)} className="text-neutral-600 text-xs border border-neutral-700 rounded-md px-4 py-2">
{showAllReplies ? 'Hide 0 PoW Replies' : 'Show All Replies'}
</button>
</div>
<div className="grid grid-cols-1 max-w-xl mx-auto gap-1">
{replyEvents.slice(0, visibleReplyEvents).map((event: Event) => (
{replyEvents.slice(0, visibleReplyEvents)
.filter((event: Event) => (showAllReplies || event.id.startsWith('0')) && event.tags.some(tag => tag[0] === 'e' && tag[1] === OPEvent.id))
.map((event: Event) => (
<div className={`w-11/12 ${event.tags.find(tag => tag[0] === 'e' && tag[1] !== OPEvent.id) ? 'ml-auto' : 'mr-auto'}`}>
<PostCard
key={event.id}