From 1cee76e5ebfcf1035cd8231110c49d7a7a6cead7 Mon Sep 17 00:00:00 2001 From: talksik Date: Sun, 29 May 2022 13:12:46 -0500 Subject: [PATCH] adding todos and making sure that we update last active date for the timeline history playback things --- packages/desktop/src/components/Terminal.tsx | 36 ++++++++++++++++++++ packages/desktop/src/firebase/firestore.ts | 11 ++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/packages/desktop/src/components/Terminal.tsx b/packages/desktop/src/components/Terminal.tsx index d989d4a..f73156d 100644 --- a/packages/desktop/src/components/Terminal.tsx +++ b/packages/desktop/src/components/Terminal.tsx @@ -139,6 +139,42 @@ const handleOnStartRecording = (e: BlobEvent) => { // if no conversations, show stale state + create one with nirvana +// 1. create group conversation page +// you know what to do...simple row of selected users...dropdown options should show searched user list +// use material selects for this dropdown to avoid all the work...and hide select-like things +// 2. auto select that conversation and have it show up +// 3. allow adding name when creating convo +// 4. +// 5. convo settings: add people (simple add method with firestore), change name | max 8 people + +/** + * Streaming stuff: + * - join a stream room if 2 or more in the list + * - leave on unmount + * - timer to unselect a conversation after 30 minutes...no fancy checking if user is there/active + * - show little control to see if + */ + +/** + * + * media stuff: + * - paste image + view in history + with modal nice and big + * - paste a link + see in a content block + * - paste link of image and have it save as image + */ + +/** + * + * tech debt: now go back and make convo line and side panel name and icons and all legit + */ + +/** + * nice convo history + * - chunk has max of 1 minute + * - put current clip in next chunk if previous clip was more than 4 hours ago + * - put current clip in next chunk if it's after my last active date here + */ + // sort based on the different data sources: conversations, audio clips, etc. // todo: extract each use effect to custom hook and will be clean diff --git a/packages/desktop/src/firebase/firestore.ts b/packages/desktop/src/firebase/firestore.ts index a7f3d12..1d3d92b 100644 --- a/packages/desktop/src/firebase/firestore.ts +++ b/packages/desktop/src/firebase/firestore.ts @@ -20,6 +20,7 @@ import { arrayUnion, updateDoc, arrayRemove, + serverTimestamp, } from 'firebase/firestore'; import { User as FirebaseUser } from 'firebase/auth'; @@ -223,7 +224,10 @@ export const sendContentBlockToConversation = async ( // put the user in membersInroom export const joinConversation = async (conversationId: string, userId: string) => { try { - await updateDoc(db.conversation(conversationId), { membersInRoom: arrayUnion(userId) }); + await updateDoc(db.conversation(conversationId), { + [`membersInRoom`]: arrayUnion(userId), + [`members.${userId}.lastActiveDate`]: serverTimestamp(), + }); } catch (e) { console.error('Error ', e); @@ -234,7 +238,10 @@ export const joinConversation = async (conversationId: string, userId: string) = // leave membersInroom export const leaveConversation = async (conversationId: string, userId: string) => { try { - await updateDoc(db.conversation(conversationId), { membersInRoom: arrayRemove(userId) }); + await updateDoc(db.conversation(conversationId), { + [`membersInRoom`]: arrayRemove(userId), + [`members.${userId}.lastActiveDate`]: serverTimestamp(), + }); } catch (e) { console.error('Error ', e);