From 451f3321968847bf069d2407d4fa9f3a15a98b1a Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Sat, 5 Feb 2022 20:30:47 -0800 Subject: [PATCH] tldr clean up --- packages/common/models/conversation.ts | 3 ++- .../Conversations/ConversationFullRow.tsx | 7 +------ .../components/MainTabsOrPages/Priority.tsx | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/packages/common/models/conversation.ts b/packages/common/models/conversation.ts index a7c79b3..2c38612 100644 --- a/packages/common/models/conversation.ts +++ b/packages/common/models/conversation.ts @@ -13,7 +13,8 @@ export default class Conversation { cachedAudioClip?: AudioClip; // last message pretty much cachedDrawerItem?: Link; // last link pretty much - cachedTldrClip?: string; + + tldr?: string; // description almost that people keep up to day in the convo createdDate: Timestamp = Timestamp.now(); createdByUserId: string; diff --git a/packages/web/components/Conversations/ConversationFullRow.tsx b/packages/web/components/Conversations/ConversationFullRow.tsx index 3445055..06c38aa 100644 --- a/packages/web/components/Conversations/ConversationFullRow.tsx +++ b/packages/web/components/Conversations/ConversationFullRow.tsx @@ -27,11 +27,6 @@ export default function ConversationFullRow(props: { }) { const { currUser } = useAuth(); const usersConvosMap = useRecoilValue(allUsersConversationsAtom); - let quickUpdateText = ""; - - if (props.conversation.cachedAudioClips?.length > 0) { - quickUpdateText = `${props.conversation.cachedAudioClips[0].senderUserId} spoke just now...`; - } // check if I am outdate on a certain conversation const isNewIncoming = useRecoilValue( @@ -79,7 +74,7 @@ export default function ConversationFullRow(props: { - {quickUpdateText} + {props.conversation.tldr} diff --git a/packages/web/components/MainTabsOrPages/Priority.tsx b/packages/web/components/MainTabsOrPages/Priority.tsx index 2cc698d..8dd8e53 100644 --- a/packages/web/components/MainTabsOrPages/Priority.tsx +++ b/packages/web/components/MainTabsOrPages/Priority.tsx @@ -194,6 +194,25 @@ export default function Priority() { }); }; + const playLastClip = () => { + if (!selectedConvoId) { + toast.error("select a conversation before playing"); + return; + } + + const currConvo = priorityConvos.find( + (convo) => convo.id == selectedConvoId + ); + + if (!currConvo?.cachedAudioClip) { + toast.error("nothing to play"); + return; + } + + const audio = new Audio(currConvo?.cachedAudioClip.audioDataUrl); + audio.play(); + }; + const keyMap: KeyMap = { SELECT_PRIORITY_CONVO: ["1", "2", "3", "4", "5", "6", "7", "8"], START_RECORDING: { @@ -206,12 +225,14 @@ export default function Priority() { sequence: "r", action: "keyup", }, + PLAY_LAST_CLIP: "space", }; const handlers = { SELECT_PRIORITY_CONVO: selectingPriorityConvoHandler, START_RECORDING: startRecording, STOP_RECORDING: stopRecording, + PLAY_LAST_CLIP: playLastClip, }; return (