mirror of
https://github.com/smolgrrr/TAO.git
synced 2024-09-20 01:11:25 +00:00
tag fixs and thread format
This commit is contained in:
parent
40615c799e
commit
a63bd7b233
@ -42,18 +42,26 @@ const NewNoteCard = ({
|
||||
}
|
||||
|
||||
if (refEvent && tagType) {
|
||||
unsigned.tags = Array.from(new Set(unsigned.tags.concat(refEvent.tags.filter(tag => tag[0] === 'e' || tag[0] === 'p'))));
|
||||
unsigned.tags.push(['p', refEvent.pubkey]);
|
||||
|
||||
if (tagType === 'Reply') {
|
||||
const addEventTags = () => {
|
||||
unsigned.tags = Array.from(new Set([
|
||||
...unsigned.tags,
|
||||
...refEvent.tags.filter(tag => tag[0] === 'e' || tag[0] === 'p')
|
||||
]));
|
||||
unsigned.tags.push(['e', refEvent.id]);
|
||||
} else {
|
||||
if (tagType === 'Quote') {
|
||||
};
|
||||
|
||||
switch (tagType) {
|
||||
case 'Reply':
|
||||
addEventTags();
|
||||
break;
|
||||
case 'Quote':
|
||||
setComment(comment + '\nnostr:' + nip19.noteEncode(refEvent.id));
|
||||
unsigned.tags.push(['q', refEvent.id]);
|
||||
} else {
|
||||
unsigned.tags.push(['e', refEvent.id]);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
addEventTags();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,8 @@ const Thread = () => {
|
||||
const allEvents = [...noteEvents, ...threadCache];
|
||||
|
||||
const repliedList = (event: Event): Event[] => {
|
||||
return allEvents.filter(e => event.tags.some(tag => tag[0] === 'p' && tag[1] === e.pubkey));
|
||||
return allEvents
|
||||
.filter(e => event.tags.some(tag => tag[0] === 'p' && tag[1] === e.pubkey))
|
||||
}
|
||||
|
||||
// Define your callback function for subGlobalFeed
|
||||
@ -64,16 +65,18 @@ const Thread = () => {
|
||||
<PostCard event={OPEvent} metadata={metadataEvents.find((e) => e.pubkey === OPEvent.pubkey && e.kind === 0) || null} replies={replyEvents} type={'OP'}/>
|
||||
</div>
|
||||
<ThreadPostModal OPEvent={OPEvent} />
|
||||
<div className="col-span-full h-0.5 bg-neutral-900"/> {/* This is the white line separator */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 p-4">
|
||||
{replyEvents.map((event, index) => (
|
||||
<div className="col-span-full h-0.5 bg-neutral-900 mb-2"/> {/* This is the white line separator */}
|
||||
<div className="grid grid-cols-1 max-w-xl mx-auto gap-1 px-4">
|
||||
{replyEvents.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={index}
|
||||
key={event.id}
|
||||
event={event}
|
||||
metadata={metadataEvents.find((e) => e.pubkey === event.pubkey && e.kind === 0) || null}
|
||||
replies={replyEvents.filter((e: Event) => e.tags.some((tag) => tag[0] === "e" && tag[1] === event.id))}
|
||||
repliedTo={repliedList(event)}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</main>
|
||||
|
Loading…
Reference in New Issue
Block a user