diff --git a/packages/web/components/Conversations/PriorityConvoRow.tsx b/packages/web/components/Conversations/PriorityConvoRow.tsx index cfde0e5..4bd8608 100644 --- a/packages/web/components/Conversations/PriorityConvoRow.tsx +++ b/packages/web/components/Conversations/PriorityConvoRow.tsx @@ -1,4 +1,4 @@ -import { Avatar } from "antd"; +import { Avatar, Tooltip } from "antd"; import { useRecoilValue } from "recoil"; import { checkIncomingMessageSelector, @@ -7,6 +7,7 @@ import { import Conversation from "../../../common/models/conversation"; import { MasterAvatarGroupWithUserFetch } from "../UserDetails/MasterAvatarGroup"; import moment from "moment"; +import { FaMicrophoneAlt, FaPlay } from "react-icons/fa"; export default function PriorityConvoRow(props: { conversation: Conversation; @@ -51,6 +52,24 @@ justify-center rounded-lg text-slate-400 font-bold hover:cursor-pointer text-xs" {moment(props.conversation.lastActivityDate.toDate()).fromNow()} + + {isSelected && ( + <> + + + + + + + + + + + + + )} ); } diff --git a/packages/web/components/MainTabsOrPages/Priority.tsx b/packages/web/components/MainTabsOrPages/Priority.tsx index 8e1de0c..c752d59 100644 --- a/packages/web/components/MainTabsOrPages/Priority.tsx +++ b/packages/web/components/MainTabsOrPages/Priority.tsx @@ -47,8 +47,6 @@ export default function Priority() { const selectingPriorityConvoHandler = (event) => { const key = event.key; - console.log(mapShortcutsToConvoId); - console.log(key); // select the convo based on the right convo diff --git a/packages/web/components/MainTabsOrPages/Sidebar.tsx b/packages/web/components/MainTabsOrPages/Sidebar.tsx index 9cd498e..6af2692 100644 --- a/packages/web/components/MainTabsOrPages/Sidebar.tsx +++ b/packages/web/components/MainTabsOrPages/Sidebar.tsx @@ -16,6 +16,11 @@ import { } from "react-icons/fa"; import { HiSpeakerphone } from "react-icons/hi"; import Priority from "./Priority"; +import { useRecoilValue } from "recoil"; +import { + countNavigationContentSelector, + NavigationContentCount, +} from "../../recoil/main"; function Sidebar() { const router = useRouter(); @@ -28,6 +33,10 @@ function Sidebar() { }); }; + const navCountObject: NavigationContentCount = useRecoilValue( + countNavigationContentSelector + ); + return (
{/* new button */} @@ -73,7 +82,11 @@ function Sidebar() { - 4 + {navCountObject.defaultCount > 0 && ( + + {navCountObject.defaultCount} + + )} - 1 + {navCountObject.laterCount > 0 && ( + + {navCountObject.laterCount} + + )} Done + + {navCountObject.doneCount > 0 && ( + + {navCountObject.doneCount} + + )} @@ -145,10 +168,16 @@ function Sidebar() { Drawer - + new + + {navCountObject.drawerCount > 0 && ( + + {navCountObject.drawerCount} + + )} diff --git a/packages/web/recoil/main.tsx b/packages/web/recoil/main.tsx index 1a54e97..f0ce3e1 100644 --- a/packages/web/recoil/main.tsx +++ b/packages/web/recoil/main.tsx @@ -40,6 +40,9 @@ export enum RecoilActions { USER_DATA = "USER_DATA", SELECTED_CONVERSATION_ATOM = "SELECTED_CONVERSATION_ATOM", + + COUNT_DEFAULT_CONVOS_SELECTOR = "COUNT_DEFAULT_CONVOS_SELECTOR", + COUNT_NAVIGATION_ITEMS = "COUNT_NAVIGATION_ITEMS", } export const nirvanaUserDataAtom = atom({ @@ -198,6 +201,48 @@ export const doneConvosSelector = selector({ }, }); +export const countDefaultConvosSelector = selector({ + key: RecoilActions.COUNT_DEFAULT_CONVOS_SELECTOR, + get: ({ get }) => { + const sortedConvos = get(sortedRoomSelector); + + const userMemberMap = get(allUsersConversationsAtom); + const defaultConvos = sortedConvos.filter((convo) => { + return ( + userMemberMap.get(convo.id)?.state == ConversationMemberState.default && + !convo.membersInLiveRoom?.length + ); + }); + + return defaultConvos.length; + }, +}); + +export interface NavigationContentCount { + doneCount: number; + defaultCount: number; + laterCount: number; + drawerCount: number; +} + +export const countNavigationContentSelector = selector({ + key: RecoilActions.COUNT_NAVIGATION_ITEMS, + get: ({ get }) => { + const laterConvos = get(laterConvosSelector); + const doneConvos = get(doneConvosSelector); + const defaultCount = get(countDefaultConvosSelector); + + const navCountObject: NavigationContentCount = { + defaultCount, + laterCount: laterConvos.length, + doneCount: doneConvos.length, + drawerCount: 0, + }; + + return navCountObject; + }, +}); + export enum RelativeTimeConvosSections { today = "TODAY",