From c35be05416a7e4c11374a00e94de000adb1c0d51 Mon Sep 17 00:00:00 2001 From: Mohamed Marrouchi Date: Fri, 3 Jan 2025 18:36:30 +0100 Subject: [PATCH] feat: update frontend to use id instead of foreign_id --- .../tables/columns/renderPicture.tsx | 11 +++------ .../src/components/inbox/components/Chat.tsx | 14 ++++------- .../inbox/components/ConversationsList.tsx | 23 ++++++++----------- 3 files changed, 18 insertions(+), 30 deletions(-) diff --git a/frontend/src/app-components/tables/columns/renderPicture.tsx b/frontend/src/app-components/tables/columns/renderPicture.tsx index 3730ded2..d723a31e 100644 --- a/frontend/src/app-components/tables/columns/renderPicture.tsx +++ b/frontend/src/app-components/tables/columns/renderPicture.tsx @@ -1,11 +1,12 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ + import { Grid } from "@mui/material"; import { GridRenderCellParams } from "@mui/x-data-grid"; @@ -29,13 +30,7 @@ export const buildRenderPicture = ( }} > diff --git a/frontend/src/components/inbox/components/Chat.tsx b/frontend/src/components/inbox/components/Chat.tsx index 5e5ff1d6..bcb47a51 100644 --- a/frontend/src/components/inbox/components/Chat.tsx +++ b/frontend/src/components/inbox/components/Chat.tsx @@ -1,11 +1,12 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ + import { Avatar, ChatContainer, @@ -70,11 +71,7 @@ export function Chat() { @@ -127,9 +124,8 @@ export function Chat() { message.sender ? EntityType.SUBSCRIBER : EntityType.USER, - (message.sender - ? subscriber.foreign_id - : message.sentBy) || "", + (message.sender ? subscriber.id : message.sentBy) || + "", )} />, ] diff --git a/frontend/src/components/inbox/components/ConversationsList.tsx b/frontend/src/components/inbox/components/ConversationsList.tsx index b0c25d0a..88ef4c5f 100644 --- a/frontend/src/components/inbox/components/ConversationsList.tsx +++ b/frontend/src/components/inbox/components/ConversationsList.tsx @@ -1,11 +1,12 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. * 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file). */ + import { Avatar, Conversation, @@ -50,30 +51,26 @@ export const SubscribersList = (props: { loadingMore={isFetching} onYReachEnd={handleLoadMore} > - {subscribers.map((conversation) => ( + {subscribers.map((subscriber) => ( chat.setSubscriberId(conversation.id)} + onClick={() => chat.setSubscriberId(subscriber.id)} className="changeColor" - key={conversation.id} - active={chat.subscriber?.id === conversation.id} + key={subscriber.id} + active={chat.subscriber?.id === subscriber.id} >
- {conversation.first_name} {conversation.last_name} + {subscriber.first_name} {subscriber.last_name}
- {conversation.lastvisit?.toLocaleString(i18n.language)} + {subscriber.lastvisit?.toLocaleString(i18n.language)}
- +
))}