Skip to content

Commit

Permalink
Added features to filter chats, edit messages, add users to group cha…
Browse files Browse the repository at this point in the history
…t, share images as messages, and create dedicated group chats for events (#2360)

* Initial commit

* Updated the UI of chat screen

* feat: added support to create group chat

* implemented group chats

* Implemented logic to send messages in group chat

* refactor chat functionality

* fix format

* refactor code

* fix failing tests

* removed unwanted code

* fix: formatting issues and reverted unwanted changes

* removed unwanted code

* implemented reply functionality for direct chat

* implemented reply functionality

* Updated chat schema

* fix: contact card ui

* removed unwanted code

* feat: implemented unseen message functionality

* fix: create group chat functionality

* added filters

* feat: add member to group chat

* feat: implemented logic to update group image and name

* feat: moved chat to organization & added functionality to share media in chat

* fix: formatting issues

* fix: formatting issue

* fix: formatting issue

* fix: type errors

* fix: tsdoc error

* fix: formatting errors

* improve code coverage

* improved code coverage

* feat: implemented edit message functionality

* Update Chat.tsx

* feat: added option for creating a dedicated group chat for an event

* fix: failing test cases

* feat: implemented notifications

* fix: failing tests

* reverted unwanted changes

* revert unwanted changes

* feat: added missing queries

* fix: formatting issues

* fix: formatting issues

* fix: failing test cases

* removed unwanted changes

* fix: failing test cases

* updated translation files

* improved: code coverage

* Update public/locales/hi/translation.json

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* improve code coverage

* fix: add svg

* removed unused svg file

* updated schema.graphql

* updated schema.graphql

* updated schema.graphql

* fix: test cases

* fix: test cases

* fix: test cases

* fix: test cases

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
disha1202 and coderabbitai[bot] authored Dec 28, 2024
1 parent 9dbd7a6 commit a99b146
Show file tree
Hide file tree
Showing 33 changed files with 16,372 additions and 1,426 deletions.
15 changes: 13 additions & 2 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@
"recurringEvent": "Recurring Event",
"isPublic": "Is Public",
"isRegistrable": "Is Registrable",
"createChat": "Create Chat",
"createEvent": "Create Event",
"enterFilter": "Enter Filter",
"enterTitle": "Enter Title",
Expand Down Expand Up @@ -553,6 +554,7 @@
"recurringEvent": "Recurring Event",
"isPublic": "Is Public",
"isRegistrable": "Is Registrable",
"createChat": "Create Chat",
"updatePost": "Update Post",
"eventDetails": "Event Details",
"eventDeleted": "Event deleted successfully.",
Expand Down Expand Up @@ -1204,6 +1206,7 @@
"enterDescription": "Enter Description",
"publicEvent": "Is Public",
"registerable": "Is Registerable",
"createChat": "Create Chat",
"monthlyCalendarView": "Monthly Calendar",
"yearlyCalendarView": "Yearly Calender",
"startTime": "startTime",
Expand Down Expand Up @@ -1259,14 +1262,22 @@
"endOfResults": "endOfResults"
},
"userChat": {
"add": "Add",
"chat": "Chat",
"search": "Search",
"messages": "Messages",
"contacts": "Contacts"
"contacts": "Contacts",
"create": "Create",
"newChat": "New Chat",
"newGroupChat": "New Group Chat",
"groupInfo": "Group Info",
"members": "Members",
"addMembers": "Add Members"
},
"userChatRoom": {
"selectContact": "Select a contact to start conversation",
"sendMessage": "Send Message"
"sendMessage": "Send Message",
"reply": "Reply"
},
"orgProfileField": {
"loading": "Loading...",
Expand Down
21 changes: 16 additions & 5 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"startDate": "Date de début",
"endDate": "Date de fin",
"talawaApiUnavailable": "API Talawa indisponible",
"done": "Fait"
"done": "Fait",
"createChat": "Créer une discussion"
},
"organizationActionItems": {
"actionItemCategory": "Catégorie de l'Action",
Expand Down Expand Up @@ -579,7 +580,8 @@
"registerEvent": "Inscrire à l'événement",
"close": "Fermer",
"talawaApiUnavailable": "API Talawa non disponible",
"done": "Terminé"
"done": "Terminé",
"createChat": "Créer une discussion"
},
"funds": {
"title": "Fonds",
Expand Down Expand Up @@ -1215,7 +1217,8 @@
"eventDescription": "Description de l'événement",
"eventLocation": "Lieu de l'événement",
"startDate": "Date de début",
"endDate": "Date de fin"
"endDate": "Date de fin",
"createChat": "Créer une discussion"
},
"userEventCard": {
"starts": "Départs",
Expand Down Expand Up @@ -1259,14 +1262,22 @@
"endOfResults": "Fin des résultats"
},
"userChat": {
"add": "Ajouter",
"chat": "Chat",
"contacts": "Contacts",
"search": "rechercher",
"messages": "messages"
"messages": "messages",
"create": "créer",
"newChat": "nouvelle discussion",
"newGroupChat": "Nouvelle discussion de groupe",
"groupInfo": "Informations sur le groupe",
"members": "Membres",
"addMembers": "Add Members"
},
"userChatRoom": {
"selectContact": "Sélectionnez un contact pour démarrer la conversation",
"sendMessage": "Envoyer le message"
"sendMessage": "Envoyer le message",
"reply": "répondre"
},
"orgProfileField": {
"loading": "Chargement...",
Expand Down
21 changes: 16 additions & 5 deletions public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"startDate": "प्रारंभ तिथि",
"endDate": "समाप्ति तिथि",
"talawaApiUnavailable": "Talawa API अनुपलब्ध",
"done": "पूर्ण"
"done": "पूर्ण",
"createChat": "चैट बनाएं"
},
"organizationActionItems": {
"actionItemCategory": "क्रिया वस्तु श्रेणी",
Expand Down Expand Up @@ -579,7 +580,8 @@
"registerEvent": "कार्यक्रम के लिए पंजीकरण करें",
"close": "बंद करें",
"talawaApiUnavailable": "Talawa API अनुपलब्ध",
"done": "समाप्त"
"done": "समाप्त",
"createChat": "चैट बनाएं"
},
"funds": {
"title": "फंड",
Expand Down Expand Up @@ -1215,7 +1217,8 @@
"eventDescription": "कार्यक्रम विवरण",
"eventLocation": "कार्यक्रम स्थान",
"startDate": "प्रारंभ तिथि",
"endDate": "समाप्ति तिथि"
"endDate": "समाप्ति तिथि",
"createChat": "चैट बनाएं"
},
"userEventCard": {
"starts": "प्रारंभ होगा",
Expand Down Expand Up @@ -1259,14 +1262,22 @@
"endOfResults": "परिणाम समाप्त"
},
"userChat": {
"add": "जोड़ें",
"chat": "बात करना",
"contacts": "संपर्क",
"search": "खोज",
"messages": "संदेश"
"messages": "संदेश",
"create": "बनाएं",
"newChat": "नई चैट",
"newGroupChat": "नया समूह चैट",
"groupInfo": "समूह जानकारी",
"members": "सदस्यों",
"addMembers": "सदस्य जोड़ें"
},
"userChatRoom": {
"selectContact": "बातचीत शुरू करने के लिए एक संपर्क चुनें",
"sendMessage": "मेसेज भेजें"
"sendMessage": "मेसेज भेजें",
"reply": "जवाब"
},
"orgProfileField": {
"loading": "लोड हो रहा है...",
Expand Down
21 changes: 16 additions & 5 deletions public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"on": "En",
"after": "Después de",
"occurences": "ocurrencias",
"done": "Hecho"
"done": "Hecho",
"createChat": "Crear chat"
},
"organizationActionItems": {
"actionItemCategory": "Categoría de Acción",
Expand Down Expand Up @@ -579,7 +580,8 @@
"on": "En",
"after": "Después de",
"occurences": "ocurrencias",
"done": "Hecho"
"done": "Hecho",
"createChat": "Crear chat"
},
"funds": {
"title": "Fondos",
Expand Down Expand Up @@ -1218,7 +1220,8 @@
"publicEvent": "Es público",
"registerable": "Es registrable",
"monthlyCalendarView": "Calendario mensual",
"yearlyCalendarView": "Calendario anual"
"yearlyCalendarView": "Calendario anual",
"createChat": "Crear chat"
},
"userEventCard": {
"location": "Ubicación",
Expand Down Expand Up @@ -1262,14 +1265,22 @@
"createAdvertisement": "Crear publicidad"
},
"userChat": {
"add": "Agregar",
"chat": "Charlar",
"search": "Buscar",
"contacts": "Contactos",
"messages": "Mensajes"
"messages": "Mensajes",
"create": "crear",
"newChat": "nueva charla",
"newGroupChat": "Nuevo chat grupal",
"groupInfo": "Información del grupo",
"members": "Miembros",
"addMembers": "Add Members"
},
"userChatRoom": {
"selectContact": "Seleccione un contacto para iniciar una conversación",
"sendMessage": "Enviar mensaje"
"sendMessage": "Enviar mensaje",
"reply": "responder"
},
"orgProfileField": {
"loading": "Cargando..",
Expand Down
21 changes: 16 additions & 5 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@
"startDate": "开始日期",
"endDate": "结束日期",
"talawaApiUnavailable": "塔拉瓦 API 不可用",
"done": "完成"
"done": "完成",
"createChat": "创建聊天"
},
"organizationActionItems": {
"actionItemCategory": "行动项类别",
Expand Down Expand Up @@ -579,7 +580,8 @@
"registerEvent": "注册活动",
"close": "关闭",
"talawaApiUnavailable": "塔拉瓦 API 不可用",
"done": "完成"
"done": "完成",
"createChat": "创建聊天"
},
"funds": {
"title": "基金",
Expand Down Expand Up @@ -1215,7 +1217,8 @@
"eventDescription": "活动描述",
"eventLocation": "活动位置",
"startDate": "开始日期",
"endDate": "结束日期"
"endDate": "结束日期",
"createChat": "创建聊天"
},
"userEventCard": {
"starts": "开始",
Expand Down Expand Up @@ -1259,14 +1262,22 @@
"endOfResults": "结果结束"
},
"userChat": {
"add": "添加",
"chat": "聊天",
"contacts": "联系方式",
"search": "搜索",
"messages": "消息"
"messages": "消息",
"create": "创造",
"newChat": "新聊天",
"newGroupChat": "新群聊",
"groupInfo": "集团信息",
"members": "会员",
"addMembers": "Add Members"
},
"userChatRoom": {
"selectContact": "选择联系人开始对话",
"sendMessage": "发信息"
"sendMessage": "发信息",
"reply": "回复"
},
"orgProfileField": {
"loading": "加载中...",
Expand Down
3 changes: 2 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,14 @@ function app(): JSX.Element {
<Route element={<SecuredRouteForUser />}>
<Route path="/user/organizations" element={<Organizations />} />
<Route path="/user/settings" element={<Settings />} />
<Route path="/user/chat" element={<Chat />} />
{/* <Route path="/user/chat" element={<Chat />} /> */}
<Route element={<UserScreen />}>
<Route path="/user/organizations" element={<Organizations />} />
<Route path="/user/organization/:orgId" element={<Posts />} />
<Route path="/user/people/:orgId" element={<People />} />
<Route path="/user/donate/:orgId" element={<Donate />} />
<Route path="/user/events/:orgId" element={<Events />} />
<Route path="/user/chat/:orgId" element={<Chat />} />
<Route path="/user/campaigns/:orgId" element={<Campaigns />} />
<Route path="/user/pledges/:orgId" element={<Pledges />} />
<Route
Expand Down
51 changes: 50 additions & 1 deletion src/GraphQl/Mutations/OrganizationMutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,34 +63,83 @@ export const CREATE_CHAT = gql`
$organizationId: ID
$isGroup: Boolean!
$name: String
$image: String
) {
createChat(
data: {
userIds: $userIds
organizationId: $organizationId
isGroup: $isGroup
name: $name
image: $image
}
) {
_id
}
}
`;

export const ADD_USER_TO_GROUP_CHAT = gql`
mutation addUserToGroupChat($userId: ID!, $chatId: ID!) {
addUserToGroupChat(userId: $userId, chatId: $chatId) {
_id
}
}
`;

export const MARK_CHAT_MESSAGES_AS_READ = gql`
mutation markChatMessagesAsRead($chatId: ID!, $userId: ID!) {
markChatMessagesAsRead(chatId: $chatId, userId: $userId) {
_id
}
}
`;

export const UPDATE_CHAT = gql`
mutation updateChat($input: UpdateChatInput!) {
updateChat(input: $input) {
_id
}
}
`;

export const EDIT_CHAT_MESSAGE = gql`
mutation updateChatMessage(
$messageId: ID!
$messageContent: String!
$chatId: ID!
) {
updateChatMessage(
input: {
messageId: $messageId
messageContent: $messageContent
chatId: $chatId
}
) {
_id
messageContent
updatedAt
}
}
`;

export const SEND_MESSAGE_TO_CHAT = gql`
mutation sendMessageToChat(
$chatId: ID!
$replyTo: ID
$messageContent: String!
$media: String
$messageContent: String
) {
sendMessageToChat(
chatId: $chatId
replyTo: $replyTo
messageContent: $messageContent
media: $media
) {
_id
createdAt
messageContent
media
replyTo {
_id
createdAt
Expand Down
2 changes: 2 additions & 0 deletions src/GraphQl/Mutations/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ export const CREATE_EVENT_MUTATION = gql`
$count: PositiveInt
$interval: PositiveInt
$weekDayOccurenceInMonth: Int
$createChat: Boolean!
) {
createEvent(
data: {
Expand All @@ -298,6 +299,7 @@ export const CREATE_EVENT_MUTATION = gql`
startTime: $startTime
endTime: $endTime
location: $location
createChat: $createChat
}
recurrenceRuleData: {
recurrenceStartDate: $recurrenceStartDate
Expand Down
Loading

0 comments on commit a99b146

Please sign in to comment.