add focus button to note actionbar

This commit is contained in:
Ren Amamiya
2023-08-29 12:14:45 +07:00
parent d4eb237e40
commit d1701eff20
8 changed files with 98 additions and 39 deletions

View File

@@ -23,6 +23,27 @@ export function useEvent(id: string, embed?: string) {
// get event from relay if event in db not present
const event = await ndk.fetchEvent(id);
if (!event) throw new Error(`Event not found: ${id}`);
let root: string;
let reply: string;
if (event.tags?.[0]?.[0] === 'e' && !event.tags?.[0]?.[3]) {
root = event.tags[0][1];
} else {
root = event.tags.find((el) => el[3] === 'root')?.[1];
reply = event.tags.find((el) => el[3] === 'reply')?.[1];
}
await db.createEvent(
event.id,
JSON.stringify(event),
event.pubkey,
event.kind,
root,
reply,
event.created_at
);
return event;
}
},