diff --git a/packages/api/routes/line.ts b/packages/api/routes/line.ts index dd81cf5..bbfd089 100644 --- a/packages/api/routes/line.ts +++ b/packages/api/routes/line.ts @@ -128,7 +128,11 @@ async function getUserLines(req: Request, res: Response) { ); if (!userLineMembers?.length) { - res.status(400).json(); + const resObj = new GetUserLinesResponse([]); + + res.json( + new NirvanaResponse(resObj, undefined, "this user is not in any lines") + ); return; } @@ -139,13 +143,14 @@ async function getUserLines(req: Request, res: Response) { // this will include the current user lineMember association to the line const allLineMembers = await LineService.getLineMembersInLines(lineIds); - const allLinesUsers: ObjectId[] = []; + const allLinesUsersIds: ObjectId[] = []; allLineMembers?.map((currentLineMember) => { - if (currentLineMember?._id) allLinesUsers.push(currentLineMember.userId); + if (currentLineMember?.userId) + allLinesUsersIds.push(currentLineMember.userId); }) ?? []; // get all users relevant here - const allRelevantUsers = await UserService.getUsersByIds(allLinesUsers); + const allRelevantUsers = await UserService.getUsersByIds(allLinesUsersIds); // get all lines from the list of relevant lines const lines = (await LineService.getLinesByIds(lineIds)) ?? []; @@ -183,8 +188,8 @@ async function getUserLines(req: Request, res: Response) { // get the user objects for all of the other members const otherUsers: User[] = []; associatedLineMembersForLine.forEach((currentLineMember) => { - const foundUserObject = allRelevantUsers?.find( - (currentUser) => currentUser._id === currentLineMember.userId + const foundUserObject = allRelevantUsers?.find((currentUser) => + currentUser._id?.equals(currentLineMember.userId) ); if (foundUserObject) otherUsers.push(foundUserObject); diff --git a/packages/core/responses/nirvanaResponse.ts b/packages/core/responses/nirvanaResponse.ts index a610d09..7317d42 100644 --- a/packages/core/responses/nirvanaResponse.ts +++ b/packages/core/responses/nirvanaResponse.ts @@ -9,9 +9,12 @@ export default class NirvanaResponse { data?: T; error?: Error; + message?: string; - constructor(_data: T, _error?: Error) { + constructor(_data: T, _error?: Error, _message?: string) { this.data = _data; this.error = _error; + + this.message = _message; } } diff --git a/packages/desktop/src/components/lines/lineRow.tsx/index.tsx b/packages/desktop/src/components/lines/lineRow.tsx/index.tsx index 01d9e17..3b5d1e6 100644 --- a/packages/desktop/src/components/lines/lineRow.tsx/index.tsx +++ b/packages/desktop/src/components/lines/lineRow.tsx/index.tsx @@ -33,8 +33,8 @@ export default function LineRow({ * */ const renderActivityIcon = useMemo(() => { // if there is someone or me broadcasting here - if (masterLineData.currentUserMember.lastVisitDate) - return ; + // if (masterLineData.currentUserMember.lastVisitDate) + return ; // if there is new activity blocks for me if (masterLineData.currentUserMember.lastVisitDate) @@ -95,7 +95,8 @@ export default function LineRow({ const profilePictures = useMemo(() => { const pictureSources: string[] = []; - if (userData?.user?.picture) pictureSources.push(userData.user.picture); + // ?don't add in my image as that's useless contextually? + // if (userData?.user?.picture) pictureSources.push(userData.user.picture); masterLineData.otherUserObjects?.forEach((otherUser) => { if (otherUser.picture) pictureSources.push(otherUser.picture); diff --git a/packages/desktop/src/pages/nirvanaApp.tsx b/packages/desktop/src/pages/nirvanaApp.tsx index 86561e2..eb565a7 100644 --- a/packages/desktop/src/pages/nirvanaApp.tsx +++ b/packages/desktop/src/pages/nirvanaApp.tsx @@ -46,10 +46,7 @@ function NirvanaApp() { - {/* */} + diff --git a/packages/desktop/src/pages/terminal/index.tsx b/packages/desktop/src/pages/terminal/index.tsx index ca23353..68f2c71 100644 --- a/packages/desktop/src/pages/terminal/index.tsx +++ b/packages/desktop/src/pages/terminal/index.tsx @@ -16,7 +16,7 @@ export default function NirvanaTerminal({ }: { allLines: ILineDetails[]; }) { - const [isModalVisible, setIsModalVisible] = useState(true); + const [isModalVisible, setIsModalVisible] = useState(false); const setSelectedLineId = useSetRecoilState($selectedLineId); const setDesktopMode = useSetRecoilState($desktopMode); @@ -92,6 +92,13 @@ export default function NirvanaTerminal({ ) : ( <> + {" "} + {!userLinesRes?.data?.masterLines.length && ( + + You have no lines!
Create one to connect to your team + instantly. +
+ )} {userLinesRes?.data?.masterLines?.map((masterLineData) => (