diff --git a/public/locales/en.json b/public/locales/en.json index 777447cc62..97d63a5073 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -95,7 +95,7 @@ "menu": "Menu", "my organizations": "My Organizations", "users": "Users", - "requests": "Requests", + "requests": "Membership Requests", "communityProfile": "Community Profile", "logout": "Logout" }, @@ -177,17 +177,17 @@ "all": "All" }, "requests": { - "title": "Requests", + "title": "Membership Requests", "sl_no": "Sl. No.", "name": "Name", "email": "Email", "accept": "Accept", "reject": "Reject", - "searchRequests": "Search requests", + "searchRequests": "Search membership requests", "endOfResults": "End of results", "noOrgError": "Organizations not found, please create an organization through dashboard", "noResultsFoundFor": "No results found for ", - "noRequestsFound": "No Request Found", + "noRequestsFound": "No Membership Requests Found", "acceptedSuccessfully": "Request accepted successfully", "rejectedSuccessfully": "Request rejected successfully", "noOrgErrorTitle": "Organizations Not Found", diff --git a/src/App.tsx b/src/App.tsx index 24d52cf65c..1d8787e7eb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -127,7 +127,10 @@ function app(): JSX.Element { } /> } /> } /> - + } + /> } @@ -164,7 +167,7 @@ function app(): JSX.Element { } /> }> } /> diff --git a/src/components/EventCalendar/EventCalendar.test.tsx b/src/components/EventCalendar/EventCalendar.test.tsx index 657f43a781..caca516763 100644 --- a/src/components/EventCalendar/EventCalendar.test.tsx +++ b/src/components/EventCalendar/EventCalendar.test.tsx @@ -11,8 +11,7 @@ import { } from 'GraphQl/Mutations/mutations'; import i18nForTest from 'utils/i18nForTest'; import { StaticMockLink } from 'utils/StaticMockLink'; -import { weekdays } from './constants'; -import { months } from './constants'; +import { weekdays, months } from './constants'; import { BrowserRouter as Router } from 'react-router-dom'; const eventData = [ diff --git a/src/components/EventCalendar/YearlyEventCalender.tsx b/src/components/EventCalendar/YearlyEventCalender.tsx index 2bf8a6eb9d..7b7a4d4b03 100644 --- a/src/components/EventCalendar/YearlyEventCalender.tsx +++ b/src/components/EventCalendar/YearlyEventCalender.tsx @@ -3,7 +3,7 @@ import dayjs from 'dayjs'; import Button from 'react-bootstrap/Button'; import React, { useState, useEffect } from 'react'; import styles from './YearlyEventCalender.module.css'; -import { ViewType } from 'screens/OrganizationEvents/OrganizationEvents'; +import type { ViewType } from 'screens/OrganizationEvents/OrganizationEvents'; import { ChevronLeft, ChevronRight } from '@mui/icons-material'; import type { InterfaceRecurrenceRule } from 'utils/recurrenceUtils'; diff --git a/src/components/EventDashboardScreen/EventDashboardScreen.tsx b/src/components/EventDashboardScreen/EventDashboardScreen.tsx index 86e1d460f3..9b518f5e0b 100644 --- a/src/components/EventDashboardScreen/EventDashboardScreen.tsx +++ b/src/components/EventDashboardScreen/EventDashboardScreen.tsx @@ -9,13 +9,13 @@ import type { TargetsType } from 'state/reducers/routesReducer'; import styles from './EventDashboardScreen.module.css'; import ProfileDropdown from 'components/ProfileDropdown/ProfileDropdown'; import useLocalStorage from 'utils/useLocalstorage'; -const { getItem } = useLocalStorage(); const EventDashboardScreen = (): JSX.Element => { + const { getItem } = useLocalStorage(); const isLoggedIn = getItem('IsLoggedIn'); const adminFor = getItem('AdminFor'); const location = useLocation(); - const titleKey: string | undefined = map[location.pathname.split('/')[1]]; + const titleKey: string | undefined = map[location.pathname.split('/')[2]]; const { t } = useTranslation('translation', { keyPrefix: titleKey }); const [hideDrawer, setHideDrawer] = useState(null); const { orgId } = useParams(); diff --git a/src/components/EventListCard/EventListCard.test.tsx b/src/components/EventListCard/EventListCard.test.tsx index cf321fa4b1..a75b1bdb48 100644 --- a/src/components/EventListCard/EventListCard.test.tsx +++ b/src/components/EventListCard/EventListCard.test.tsx @@ -68,7 +68,14 @@ const renderEventListCard = ( path="/event/:orgId/" element={} /> - } /> + Event Dashboard (Admin)} + /> + Event Dashboard (User)} + /> @@ -287,7 +294,7 @@ describe('Testing Event List Card', () => { }); }); - test('Should navigate to event dashboard when clicked', async () => { + test('Should navigate to event dashboard when clicked (For Admin)', async () => { renderEventListCard(props[1]); userEvent.click(screen.getByTestId('card')); @@ -300,6 +307,25 @@ describe('Testing Event List Card', () => { await waitFor(() => { expect(screen.queryByTestId('card')).not.toBeInTheDocument(); + expect(screen.queryByText('Event Dashboard (Admin)')).toBeInTheDocument(); + }); + }); + + test('Should navigate to event dashboard when clicked (For User)', async () => { + setItem('userId', '123'); + renderEventListCard(props[2]); + + userEvent.click(screen.getByTestId('card')); + + await waitFor(() => { + expect(screen.getByTestId('showEventDashboardBtn')).toBeInTheDocument(); + }); + + userEvent.click(screen.getByTestId('showEventDashboardBtn')); + + await waitFor(() => { + expect(screen.queryByTestId('card')).not.toBeInTheDocument(); + expect(screen.queryByText('Event Dashboard (User)')).toBeInTheDocument(); }); }); diff --git a/src/components/EventListCard/EventListCardModals.tsx b/src/components/EventListCard/EventListCardModals.tsx index 7fdc85647a..69c102910c 100644 --- a/src/components/EventListCard/EventListCardModals.tsx +++ b/src/components/EventListCard/EventListCardModals.tsx @@ -322,7 +322,7 @@ function EventListCardModals({ (registrant) => registrant._id === userId, ); const [registerEventMutation] = useMutation(REGISTER_EVENT); - const [isRegistered, setIsRegistered] = React.useState(isInitiallyRegistered); + const [isRegistered, setIsRegistered] = useState(isInitiallyRegistered); const registerEventHandler = async (): Promise => { if (!isRegistered) { @@ -352,7 +352,9 @@ function EventListCardModals({ }; const openEventDashboard = (): void => { - navigate(`/event/${orgId}/${eventListCardProps.id}`); + const userPath = eventListCardProps.userRole === Role.USER ? 'user/' : ''; + console.log(`/${userPath}event/${orgId}/${eventListCardProps.id}`); + navigate(`/${userPath}event/${orgId}/${eventListCardProps.id}`); }; const popover = ( diff --git a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx index 115b2cf7bc..02f44a55d7 100644 --- a/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx +++ b/src/components/LeftDrawerOrg/LeftDrawerOrg.tsx @@ -141,7 +141,7 @@ const leftDrawerOrg = ({ >
{ ); await wait(); - expect(screen.getByText(/No Request Found/i)).toBeTruthy(); + expect(screen.getByText(/No Membership Requests Found/i)).toBeTruthy(); }); test('Should render warning alert when there are no organizations', async () => { diff --git a/src/state/reducers/routesReducer.test.ts b/src/state/reducers/routesReducer.test.ts index 36b630094e..0a474df0c3 100644 --- a/src/state/reducers/routesReducer.test.ts +++ b/src/state/reducers/routesReducer.test.ts @@ -23,7 +23,7 @@ describe('Testing Routes reducer', () => { }, { name: 'Advertisement', url: '/orgads/undefined' }, { name: 'Funds', url: '/orgfunds/undefined' }, - { name: 'Requests', url: '/requests/undefined' }, + { name: 'Membership Requests', url: '/requests/undefined' }, { name: 'Plugins', subTargets: [ @@ -76,7 +76,7 @@ describe('Testing Routes reducer', () => { component: 'OrganizationFunds', }, { - name: 'Requests', + name: 'Membership Requests', comp_id: 'requests', component: 'Requests', }, @@ -117,7 +117,7 @@ describe('Testing Routes reducer', () => { { name: 'Block/Unblock', url: '/blockuser/orgId' }, { name: 'Advertisement', url: '/orgads/orgId' }, { name: 'Funds', url: '/orgfunds/orgId' }, - { name: 'Requests', url: '/requests/orgId' }, + { name: 'Membership Requests', url: '/requests/orgId' }, { name: 'Plugins', subTargets: [ @@ -166,7 +166,7 @@ describe('Testing Routes reducer', () => { }, { name: 'Funds', comp_id: 'orgfunds', component: 'OrganizationFunds' }, { - name: 'Requests', + name: 'Membership Requests', comp_id: 'requests', component: 'Requests', }, @@ -210,7 +210,7 @@ describe('Testing Routes reducer', () => { }, { name: 'Advertisement', url: '/orgads/undefined' }, { name: 'Funds', url: '/orgfunds/undefined' }, - { name: 'Requests', url: '/requests/undefined' }, + { name: 'Membership Requests', url: '/requests/undefined' }, { name: 'Settings', url: '/orgsetting/undefined' }, { comp_id: null, @@ -266,7 +266,7 @@ describe('Testing Routes reducer', () => { component: 'OrganizationFunds', }, { - name: 'Requests', + name: 'Membership Requests', comp_id: 'requests', component: 'Requests', }, diff --git a/src/state/reducers/routesReducer.ts b/src/state/reducers/routesReducer.ts index e223b0754e..34cfdbbcca 100644 --- a/src/state/reducers/routesReducer.ts +++ b/src/state/reducers/routesReducer.ts @@ -80,7 +80,7 @@ const components: ComponentType[] = [ { name: 'Block/Unblock', comp_id: 'blockuser', component: 'BlockUser' }, { name: 'Advertisement', comp_id: 'orgads', component: 'Advertisements' }, { name: 'Funds', comp_id: 'orgfunds', component: 'OrganizationFunds' }, - { name: 'Requests', comp_id: 'requests', component: 'Requests' }, + { name: 'Membership Requests', comp_id: 'requests', component: 'Requests' }, { name: 'Plugins', comp_id: null,