From 30e280d8b3535dd1c4a952a8d7f7d0b4b42bfe7b Mon Sep 17 00:00:00 2001 From: Noble Mittal <62551163+beingnoble03@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:47:01 +0530 Subject: [PATCH] Add My Tasks screen and Fix UI bugs [User Portal] (#978) * Create login and register page for user portal * Lint public locales * Create tests for login page components * Add react import in tests * Create organizations screen for user portal * Fix failing tests and lint code * fix failing tests * Add tests for organization screen and componenets * Fix non-null assertions * Fix non-null assertions in organizations test * Fix bootstrap migration changes * Add Home Screen along with other components * Fix failing tests * Add required tests and Offcanvas navbar * Remove unused variables from tests * Sync the Mutations with talawa-api * Add Settings and Donate Screen * Add multilingual support for the screens * Add events screen without calendar view * Add multilingual support to Events screen * Fix failing tests due to merge * Add Post Comment functionality * Refactor Events tests * Deprecate event registrants from query * Add my tasks screen for user portal * Remove unnecessary comments from test files --- public/locales/en.json | 19 +- public/locales/fr.json | 19 +- public/locales/hi.json | 19 +- public/locales/sp.json | 19 +- public/locales/zh.json | 19 +- src/App.tsx | 2 + src/GraphQl/Queries/Queries.ts | 36 ++++ .../OrganizationCard.test.tsx | 2 +- .../OrganizationNavbar/OrganizationNavbar.tsx | 33 +++- .../UserPortal/PeopleCard/PeopleCard.test.tsx | 2 +- .../UserPortal/TaskCard/TaskCard.module.css | 41 +++++ .../UserPortal/TaskCard/TaskCard.test.tsx | 95 ++++++++++ .../UserPortal/TaskCard/TaskCard.tsx | 131 +++++++++++++ .../UserPortal/UserNavbar/UserNavbar.tsx | 11 +- .../Organizations/Organizations.module.css | 4 + .../Organizations/Organizations.tsx | 5 +- src/screens/UserPortal/Tasks/Tasks.module.css | 48 +++++ src/screens/UserPortal/Tasks/Tasks.test.tsx | 130 +++++++++++++ src/screens/UserPortal/Tasks/Tasks.tsx | 173 ++++++++++++++++++ 19 files changed, 787 insertions(+), 21 deletions(-) create mode 100644 src/components/UserPortal/TaskCard/TaskCard.module.css create mode 100644 src/components/UserPortal/TaskCard/TaskCard.test.tsx create mode 100644 src/components/UserPortal/TaskCard/TaskCard.tsx create mode 100644 src/screens/UserPortal/Tasks/Tasks.module.css create mode 100644 src/screens/UserPortal/Tasks/Tasks.test.tsx create mode 100644 src/screens/UserPortal/Tasks/Tasks.tsx diff --git a/public/locales/en.json b/public/locales/en.json index 7f6771f1e9..a8c22f0102 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -528,7 +528,8 @@ "joinedOrganizations": "Joined Organizations", "createdOrganizations": "Created Organizations", "search": "Search", - "nothingToShow": "Nothing to show here." + "nothingToShow": "Nothing to show here.", + "selectOrganization": "Select Organization" }, "userSidebar": { "yourOrganizations": "Your Organizations", @@ -594,5 +595,21 @@ "creator": "Creator", "alreadyRegistered": "Already registered", "register": "Register" + }, + "userTasks": { + "yourAssignedTasks": "Your assigned tasks", + "nothingToShow": "Nothing to show here." + }, + "userTaskCard": { + "description": "Description", + "deadline": "Deadline", + "created": "Created", + "assignees": "Assignees", + "completed": "Completed", + "incomplete": "Incomplete", + "taskCompleted": "The task has been completed", + "taskNotCompleted": "The task has not been completed yet", + "event": "Event", + "organization": "Organization" } } diff --git a/public/locales/fr.json b/public/locales/fr.json index 786c133520..39550fdb81 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -521,7 +521,8 @@ "joinedOrganizations": "Organisations jointes", "createdOrganizations": "Organisations créées", "search": "Recherche", - "nothingToShow": "Rien à montrer ici." + "nothingToShow": "Rien à montrer ici.", + "selectOrganization": "Sélectionnez une organisation" }, "userSidebar": { "yourOrganizations": "Vos organisations", @@ -587,5 +588,21 @@ "creator": "Créatrice", "alreadyRegistered": "Déjà enregistré", "register": "Registre" + }, + "userTasks": { + "yourAssignedTasks": "Vos tâches assignées", + "nothingToShow": "Rien à montrer ici." + }, + "userTaskCard": { + "description": "Description", + "deadline": "Date limite", + "created": "Créé", + "assignees": "Destinataires", + "completed": "Complété", + "incomplete": "Incomplète", + "taskCompleted": "La tâche est terminée", + "taskNotCompleted": "La tâche n'est pas encore terminée", + "event": "Événement", + "organization": "Organisation" } } diff --git a/public/locales/hi.json b/public/locales/hi.json index 5f5654b884..be82066a74 100644 --- a/public/locales/hi.json +++ b/public/locales/hi.json @@ -522,7 +522,8 @@ "joinedOrganizations": "संगठन शामिल हुए", "createdOrganizations": "संगठन बनाये गये", "search": "खोज", - "nothingToShow": "यहां दिखाने के लिए कुछ भी नहीं है." + "nothingToShow": "यहां दिखाने के लिए कुछ भी नहीं है.", + "selectOrganization": "संगठन का चयन करें" }, "userSidebar": { "yourOrganizations": "आपके संगठन", @@ -588,5 +589,21 @@ "creator": "निर्माता", "alreadyRegistered": "पहले से ही पंजीकृत", "register": "पंजीकरण करवाना" + }, + "userTasks": { + "yourAssignedTasks": "आपके असाइन किए गए कार्य", + "nothingToShow": "यहां दिखाने के लिए कुछ भी नहीं है." + }, + "userTaskCard": { + "description": "विवरण", + "deadline": "अंतिम तारीख", + "created": "बनाया", + "assignees": "असाइनी", + "completed": "पुरा", + "incomplete": "अधूरा", + "taskCompleted": "काम पूरा हो गया", + "taskNotCompleted": "कार्य अभी तक पूरा नहीं हुआ है", + "event": "आयोजन", + "organization": "संगठन" } } diff --git a/public/locales/sp.json b/public/locales/sp.json index 85f3492c02..27f0968470 100644 --- a/public/locales/sp.json +++ b/public/locales/sp.json @@ -522,7 +522,8 @@ "joinedOrganizations": "Organizaciones unidas", "createdOrganizations": "Organizaciones creadas", "search": "Buscar", - "nothingToShow": "Nada que mostrar aquí." + "nothingToShow": "Nada que mostrar aquí.", + "selectOrganization": "Seleccionar organización" }, "userSidebar": { "yourOrganizations": "Tus Organizaciones", @@ -588,5 +589,21 @@ "creator": "Creadora", "alreadyRegistered": "Ya registrado", "register": "Registro" + }, + "userTasks": { + "yourAssignedTasks": "Tus tareas asignadas", + "nothingToShow": "No hay nada que mostrar aquí." + }, + "userTaskCard": { + "description": "Descripción", + "deadline": "Fecha límite", + "created": "Creado", + "assignees": "Cesionarias", + "completed": "Terminada", + "incomplete": "Incompleta", + "taskCompleted": "La tarea ha sido completada", + "taskNotCompleted": "La tarea aún no se ha completado", + "event": "Evento", + "organization": "Organización" } } diff --git a/public/locales/zh.json b/public/locales/zh.json index 055bb709b2..d4a2a5ea7c 100644 --- a/public/locales/zh.json +++ b/public/locales/zh.json @@ -522,7 +522,8 @@ "joinedOrganizations": "加入組織", "createdOrganizations": "創建的組織", "search": "搜索", - "nothingToShow": "這裡沒有什麼可展示的。" + "nothingToShow": "這裡沒有什麼可展示的。", + "selectOrganization": "選擇組織" }, "userSidebar": { "yourOrganizations": "您的組織", @@ -588,5 +589,21 @@ "creator": "創作者", "alreadyRegistered": "已經註冊", "register": "登記" + }, + "userTasks": { + "yourAssignedTasks": "您指派的任務", + "nothingToShow": "這裡沒有什麼可顯示的。" + }, + "userTaskCard": { + "description": "描述", + "deadline": "最後期限", + "created": "已創建", + "assignees": "受讓人", + "completed": "完全的", + "incomplete": "不完整", + "taskCompleted": "任務已完成", + "taskNotCompleted": "任務還沒完成", + "event": "事件", + "organization": "組織" } } diff --git a/src/App.tsx b/src/App.tsx index 31e97bdc64..9b32d4ba59 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -31,6 +31,7 @@ import People from 'screens/UserPortal/People/People'; import Settings from 'screens/UserPortal/Settings/Settings'; import Donate from 'screens/UserPortal/Donate/Donate'; import Events from 'screens/UserPortal/Events/Events'; +import Tasks from 'screens/UserPortal/Tasks/Tasks'; function app(): JSX.Element { /*const { updatePluginLinks, updateInstalled } = bindActionCreators( @@ -125,6 +126,7 @@ function app(): JSX.Element { + diff --git a/src/GraphQl/Queries/Queries.ts b/src/GraphQl/Queries/Queries.ts index ef8aa20a2b..d426a4bfb5 100644 --- a/src/GraphQl/Queries/Queries.ts +++ b/src/GraphQl/Queries/Queries.ts @@ -663,3 +663,39 @@ export const ORGANIZATION_EVENTS_CONNECTION = gql` } } `; + +export const USER_TASKS_LIST = gql` + query User($id: ID!) { + user(id: $id) { + _id + assignedTasks { + _id + title + description + deadline + volunteers { + _id + firstName + lastName + email + } + createdAt + completed + event { + _id + title + organization { + _id + name + image + } + } + creator { + _id + firstName + lastName + } + } + } + } +`; diff --git a/src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx b/src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx index f04c87b526..fa4339e810 100644 --- a/src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx +++ b/src/components/UserPortal/OrganizationCard/OrganizationCard.test.tsx @@ -27,7 +27,7 @@ let props = { description: 'organizationDescription', }; -describe('Testing Organization Card Component [User Portal]', () => { +describe('Testing OrganizationCard Component [User Portal]', () => { test('Component should be rendered properly', async () => { render( diff --git a/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.tsx b/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.tsx index 3e748e2856..d1d72847bf 100644 --- a/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.tsx +++ b/src/components/UserPortal/OrganizationNavbar/OrganizationNavbar.tsx @@ -81,34 +81,49 @@ function organizationNavbar(props: InterfaceNavbarProps): JSX.Element { Talawa -