add members to channel and update note

This commit is contained in:
Ren Amamiya
2023-04-29 08:32:07 +07:00
parent cb3dbdd4dc
commit a1385f87dc
11 changed files with 182 additions and 67 deletions

View File

@@ -11,5 +11,12 @@ export const sortedChannelMessagesAtom = atom((get) => {
return messages.sort((x: { created_at: number }, y: { created_at: number }) => x.created_at - y.created_at);
});
// channel user list
export const channelMembersAtom = atom((get) => {
const messages = get(channelMessagesAtom);
const uniqueMembers = new Set(messages.map((m: { pubkey: string }) => m.pubkey));
return uniqueMembers;
});
// channel message content
export const channelContentAtom = atomWithReset('');