nice action icons now and changing the state of the user convo assoc

This commit is contained in:
Arjun Patel
2022-02-05 21:31:17 -08:00
parent bb5a14fff9
commit 903a303f06
3 changed files with 122 additions and 28 deletions
+15 -1
View File
@@ -23,6 +23,8 @@ export enum RecoilActions {
ALL_COMPLETE_CONVERSATIONS = "ALL_COMPLETE_CONVERSATIONS",
ALL_USERS_CONVERSATION_RELATIONSHIPS = "ALL_USERS_CONVERSATION_RELATIONSHIPS",
USER_CONVO_ASSOCIATION_SELECTOR = "USER_CONVO_ASSOCIATION_SELECTOR",
ALL_RELEVANT_CONVERSATIONS = "ALL_RELEVANT_CONVERSATIONS",
SORTED_CONVERSATIONS = "SORTED_CONVERSATIONS",
@@ -66,11 +68,23 @@ import { earlierThisMonth } from "@nirvana/common/helpers/dateTime";
// approach: fill in all "bottom" level atoms, and then build the tree later with selectors
// convo id -> userMember object
export const allUsersConversationsAtom = atom({
export const allUsersConversationsAtom = atom<Map<string, ConversationMember>>({
key: RecoilActions.ALL_USERS_CONVERSATION_RELATIONSHIPS,
default: new Map<string, ConversationMember>(),
});
export const userConvoAssociationSelector = selectorFamily({
key: RecoilActions.USER_CONVO_ASSOCIATION_SELECTOR,
get:
(convoId: string) =>
({ get }) => {
const userConvoMap = get(allUsersConversationsAtom);
const userConvoAssoc = userConvoMap.get(convoId);
return userConvoAssoc;
},
});
export const allRelevantConversationsAtom = atom({
key: RecoilActions.ALL_RELEVANT_CONVERSATIONS,
default: new Map<string, Conversation>(),