Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…awa-admin-clone into priyanshu
  • Loading branch information
git-init-priyanshu committed May 9, 2024
2 parents 4e30282 + 30261c3 commit b73be99
Show file tree
Hide file tree
Showing 11 changed files with 54 additions and 24 deletions.
8 changes: 4 additions & 4 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"menu": "Menu",
"my organizations": "My Organizations",
"users": "Users",
"requests": "Requests",
"requests": "Membership Requests",
"communityProfile": "Community Profile",
"logout": "Logout"
},
Expand Down Expand Up @@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ function app(): JSX.Element {
<Route path="/orgpeople/:orgId" element={<OrganizationPeople />} />
<Route path="/member/:orgId" element={<MemberDetail />} />
<Route path="/orgevents/:orgId" element={<OrganizationEvents />} />

<Route
path="/event/:orgId/:eventId"
element={<EventManagement />}
/>
<Route
path="/orgactionitems/:orgId"
element={<OrganizationActionItems />}
Expand Down Expand Up @@ -164,7 +167,7 @@ function app(): JSX.Element {
<Route path="/user/events/:orgId" element={<Events />} />
<Route element={<EventDashboardScreen />}>
<Route
path="/event/:orgId/:eventId"
path="/user/event/:orgId/:eventId"
element={<EventManagement />}
/>
</Route>
Expand Down
3 changes: 1 addition & 2 deletions src/components/EventCalendar/EventCalendar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
2 changes: 1 addition & 1 deletion src/components/EventCalendar/YearlyEventCalender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
4 changes: 2 additions & 2 deletions src/components/EventDashboardScreen/EventDashboardScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean | null>(null);
const { orgId } = useParams();
Expand Down
30 changes: 28 additions & 2 deletions src/components/EventListCard/EventListCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ const renderEventListCard = (
path="/event/:orgId/"
element={<EventListCard {...props} />}
/>
<Route path="/event/:orgId/:eventId" element={<></>} />
<Route
path="/event/:orgId/:eventId"
element={<div>Event Dashboard (Admin)</div>}
/>
<Route
path="/user/event/:orgId/:eventId"
element={<div>Event Dashboard (User)</div>}
/>
</Routes>
</I18nextProvider>
</LocalizationProvider>
Expand Down Expand Up @@ -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'));
Expand All @@ -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();
});
});

Expand Down
6 changes: 4 additions & 2 deletions src/components/EventListCard/EventListCardModals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> => {
if (!isRegistered) {
Expand Down Expand Up @@ -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 = (
Expand Down
2 changes: 1 addition & 1 deletion src/components/LeftDrawerOrg/LeftDrawerOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const leftDrawerOrg = ({
>
<div className={styles.iconWrapper}>
<IconComponent
name={name}
name={name == 'Membership Requests' ? 'Requests' : name}
fill={
isActive === true
? 'var(--bs-white)'
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Requests/Requests.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ describe('Testing Requests screen', () => {
);

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 () => {
Expand Down
12 changes: 6 additions & 6 deletions src/state/reducers/routesReducer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down Expand Up @@ -76,7 +76,7 @@ describe('Testing Routes reducer', () => {
component: 'OrganizationFunds',
},
{
name: 'Requests',
name: 'Membership Requests',
comp_id: 'requests',
component: 'Requests',
},
Expand Down Expand Up @@ -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: [
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -266,7 +266,7 @@ describe('Testing Routes reducer', () => {
component: 'OrganizationFunds',
},
{
name: 'Requests',
name: 'Membership Requests',
comp_id: 'requests',
component: 'Requests',
},
Expand Down
2 changes: 1 addition & 1 deletion src/state/reducers/routesReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b73be99

Please sign in to comment.