Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reply functionality for Group Chat and DirectChat #2142

Merged
merged 41 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1ca936b
Initial commit
disha1202 Jun 8, 2024
c42da5e
Updated the UI of chat screen
disha1202 Jun 27, 2024
3742346
feat: added support to create group chat
disha1202 Jun 30, 2024
06f4af4
implemented group chats
disha1202 Jul 2, 2024
c18b97b
Implemented logic to send messages in group chat
disha1202 Jul 7, 2024
cbde8f7
refactor chat functionality
disha1202 Jul 12, 2024
9950269
fix format
disha1202 Jul 12, 2024
77a392c
refactor code
disha1202 Jul 13, 2024
eb54545
fix failing tests
disha1202 Jul 15, 2024
09427e6
Merge branch 'develop' of https://github.com/PalisadoesFoundation/tal…
disha1202 Jul 15, 2024
6fbaaa2
removed unwanted code
disha1202 Jul 15, 2024
8fffdc5
fix: formatting issues and reverted unwanted changes
disha1202 Jul 15, 2024
f76dc3e
removed unwanted code
disha1202 Jul 15, 2024
d4864a8
implemented reply functionality for direct chat
disha1202 Jul 20, 2024
75fa6c3
implemented reply functionality
disha1202 Jul 27, 2024
6d57030
added test cases
disha1202 Jul 28, 2024
19a94a9
fix: test cases
disha1202 Jul 31, 2024
6a628d9
added test cases
disha1202 Jul 31, 2024
caa8670
Merge branch 'develop' of https://github.com/PalisadoesFoundation/tal…
disha1202 Jul 31, 2024
63afab1
Merge branch 'develop' into reply-functionality
disha1202 Aug 6, 2024
3260cce
Merge branch 'develop' into reply-functionality
disha1202 Aug 19, 2024
6eb2567
Merge branch 'develop' into reply-functionality
disha1202 Sep 1, 2024
339d620
Merge branch 'develop' into reply-functionality
disha1202 Sep 1, 2024
3a9ed90
feat: improved code coverage
disha1202 Sep 1, 2024
8382610
Merge branch 'reply-functionality' of https://github.com/disha1202/ta…
disha1202 Sep 1, 2024
ed207f8
fix: failed test cases
disha1202 Sep 1, 2024
40d6679
fix: failed test cases
disha1202 Sep 1, 2024
d1bc0a0
improved code coverage
disha1202 Sep 1, 2024
c8bd6e8
fix: minor issues
disha1202 Sep 7, 2024
d63eb0e
Merge branch 'develop' into reply-functionality
disha1202 Sep 7, 2024
92a8ecd
removed unused imports
disha1202 Sep 7, 2024
fc22a3e
Merge branch 'reply-functionality' of https://github.com/disha1202/ta…
disha1202 Sep 7, 2024
dd6ec8c
Merge branch 'develop' into reply-functionality
disha1202 Sep 21, 2024
9dbc555
Merge branch 'develop' into reply-functionality
disha1202 Oct 21, 2024
7c2cd06
Merge branch 'reply-functionality' of https://github.com/disha1202/ta…
disha1202 Oct 21, 2024
1b83672
fix: variable name
disha1202 Oct 21, 2024
7ff5f05
fix: confilts
disha1202 Oct 21, 2024
43a9229
fix: formatting issues
disha1202 Oct 21, 2024
2d82877
fix: type errors
disha1202 Oct 21, 2024
cd9bf98
fix: failing test cases
disha1202 Oct 21, 2024
3ea3775
fix: failing tests
disha1202 Oct 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1581,4 +1581,4 @@ input VenueInput {
input createUserFamilyInput {
title: String!
userIds: [ID!]!
}
}
51 changes: 47 additions & 4 deletions src/GraphQl/Mutations/OrganizationMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,35 @@ export const CREATE_DIRECT_CHAT = gql`
`;

export const SEND_MESSAGE_TO_DIRECT_CHAT = gql`
mutation sendMessageToDirectChat($chatId: ID!, $messageContent: String!) {
sendMessageToDirectChat(chatId: $chatId, messageContent: $messageContent) {
mutation sendMessageToDirectChat(
$chatId: ID!
$replyTo: ID
$messageContent: String!
) {
sendMessageToDirectChat(
chatId: $chatId
replyTo: $replyTo
messageContent: $messageContent
) {
_id
createdAt
messageContent
replyTo {
_id
createdAt
messageContent
receiver {
_id
firstName
lastName
}
sender {
_id
firstName
lastName
}
updatedAt
}
receiver {
_id
firstName
Expand All @@ -107,11 +131,30 @@ export const SEND_MESSAGE_TO_DIRECT_CHAT = gql`
`;

export const SEND_MESSAGE_TO_GROUP_CHAT = gql`
mutation sendMessageToGroupChat($chatId: ID!, $messageContent: String!) {
sendMessageToGroupChat(chatId: $chatId, messageContent: $messageContent) {
mutation sendMessageToGroupChat(
$chatId: ID!
$replyTo: ID
$messageContent: String!
) {
sendMessageToGroupChat(
chatId: $chatId
replyTo: $replyTo
messageContent: $messageContent
) {
_id
createdAt
messageContent
replyTo {
_id
createdAt
messageContent
sender {
_id
firstName
lastName
}
updatedAt
}
sender {
_id
firstName
Expand Down
55 changes: 31 additions & 24 deletions src/GraphQl/Queries/PlugInQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,25 @@ export const DIRECT_CHAT_BY_ID = gql`
_id
createdAt
messageContent
replyTo {
_id
createdAt
messageContent
receiver {
_id
firstName
lastName
email
image
}
sender {
_id
firstName
lastName
email
image
}
}
receiver {
_id
firstName
Expand Down Expand Up @@ -176,6 +195,18 @@ export const GROUP_CHAT_BY_ID = gql`
_id
createdAt
messageContent
replyTo {
_id
createdAt
messageContent
sender {
_id
firstName
lastName
email
image
}
}
sender {
_id
firstName
Expand All @@ -195,30 +226,6 @@ export const GROUP_CHAT_BY_ID = gql`
}
`;

// directChatByChatId

// export const GROUP_CHAT_MESSAGES_BY_CHAT_ID = gql`
// query directChatsMessagesByChatID($id: ID!) {
// directChatsMessagesByChatID(id: $id) {
// _id
// createdAt
// messageContent
// receiver {
// _id
// firstName
// lastName
// email
// }
// sender {
// _id
// firstName
// lastName
// email
// }
// }
// }
// `;

export const DIRECT_CHATS_LIST = gql`
query DirectChatsByUserID($id: ID!) {
directChatsByUserID(id: $id) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Avatar/Avatar.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.imageContainer {
width: 56px;
height: 56px;
width: fit-content;
height: fit-content;
display: flex;
align-items: center;
justify-content: center;
Expand Down
141 changes: 140 additions & 1 deletion src/components/UserPortal/ChatRoom/ChatRoom.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
width: fit-content;
max-width: 75%;
min-width: 80px;
padding-bottom: 0;
display: flex;
justify-content: space-between;
}

.messageSent {
Expand All @@ -65,6 +68,49 @@
background-color: rgba(196, 255, 211, 0.3);
min-width: 80px;
padding-bottom: 0;
display: flex;
justify-content: space-between;
}

.userDetails {
display: flex;
align-items: center;
font-size: 14px;
gap: 6px;
}

.userDetails .userImage {
height: 20px;
width: 20px;
}

.replyTo {
border-left: 4px solid pink;
display: flex;
justify-content: space-between;
background-color: rgb(249, 249, 250);
padding: 6px 0px 4px 4px;
border-radius: 6px 6px 6px 6px;
}

.replyToMessageContainer {
padding-left: 4px;
}

.replyToMessageContainer p {
margin: 4px 0px 0px;
}

.replyToMessage {
border-left: 4px solid pink;
border-radius: 6px;
margin: 6px 0px;
padding: 6px;
background-color: #dbf6db;
}

.messageReceived .replyToMessage {
background-color: #f2f2f2;
}

.messageTime {
Expand All @@ -73,10 +119,15 @@
align-items: flex-end;
justify-content: flex-end;
margin-bottom: 0px;
margin-left: 6px;
}

.messageContent {
margin-bottom: 0px;
margin-bottom: 0.5px;
display: flex;
align-items: flex-start;
flex-direction: column;
justify-content: center;
}

.createChat {
Expand Down Expand Up @@ -108,3 +159,91 @@
font-size: 12px;
font-weight: 600;
}

.messageAttributes {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
}

.customToggle {
display: none;
}

.customToggle,
.closeBtn {
padding: 0;
background: none;
border: none;
--bs-btn-active-bg: none;
}
.customToggle svg {
color: black;
font-size: 12px;
}

.customToggle::after,
.closeBtn::after {
content: none;
}

.closeBtn svg {
color: black;
font-size: 18px;
}

.closeBtn {
padding: 2px 10px;
}

.closeBtn:hover {
background-color: transparent;
border-color: transparent;
}

.customToggle:hover,
.customToggle:focus,
.customToggle:active {
background: none;
border: none;
}

.messageReceived:hover .customToggle {
display: block;
}

.messageSent:hover .customToggle {
display: block;
}

.messageSent:hover,
.messageReceived:hover {
padding: 0px 6px;
}

.messageSent:target {
scroll-margin-top: 100px;
animation-name: test;
animation-duration: 1s;
}

.messageReceived:target {
scroll-margin-top: 100px;
animation-name: test;
animation-duration: 1s;
}

@keyframes test {
from {
background-color: white;
}
to {
background-color: rgb(82, 83, 81);
}
}

a {
color: currentColor;
width: 100%;
}
Loading
Loading