Skip to content

Commit

Permalink
Merge branch 'develop' into talawa-admin-t
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraemon012 authored Sep 29, 2024
2 parents 645ba48 + 895e094 commit b7c0eb2
Show file tree
Hide file tree
Showing 15 changed files with 273 additions and 87 deletions.
265 changes: 198 additions & 67 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@mui/x-data-grid": "^7.16.0",
"@mui/x-date-pickers": "^7.11.1",
"@pdfme/generator": "^4.5.2",
"@reduxjs/toolkit": "^2.2.7",
"@vitejs/plugin-react": "^4.3.1",
"babel-plugin-transform-import-meta": "^2.2.1",
"bootstrap": "^5.3.3",
Expand Down Expand Up @@ -48,12 +49,11 @@
"react-icons": "^5.2.1",
"react-infinite-scroll-component": "^6.1.0",
"react-multi-carousel": "^2.8.5",
"react-redux": "^7.2.5",
"react-redux": "^9.1.2",
"react-router-dom": "^6.26.0",
"react-toastify": "^10.0.5",
"react-tooltip": "^5.27.1",
"redux": "^4.1.1",
"redux-thunk": "^2.3.0",
"redux": "^5.0.1",
"sanitize-html": "^2.13.0",
"typedoc": "^0.26.7",
"typedoc-plugin-markdown": "^4.2.1",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"organizations": "Organizations",
"search": "search",
"filter": "filter",
"searchByName": "searchByName"
"searchByName": "searchByName",
"searchOrganizations": "Search Organization"
},
"userSidebarOrg": {
"yourOrganizations": "Your Organizations",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"organizations": "Organisations",
"search": "Rechercher",
"filter": "Filtrer",
"searchByName": "Rechercher par nom"
"searchByName": "Rechercher par nom",
"searchOrganizations": "Rechercher Organisations"
},
"userSidebarOrg": {
"yourOrganizations": "Vos organisations",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"organizations": "संगठनों",
"search": "खोजें",
"filter": "फ़िल्टर",
"searchByName": "नाम से खोजें"
"searchByName": "नाम से खोजें",
"searchOrganizations": "संगठनों खोजें"
},
"userSidebarOrg": {
"yourOrganizations": "आपके संगठन",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"filter": "Filtrar",
"organizations": "Organizaciones",
"searchByName": "Buscar por nombre",
"searchUsers": "Buscar usuarios"
"searchUsers": "Buscar usuarios",
"searchOrganizations": "Buscar Organizaciones"
},
"userSidebarOrg": {
"yourOrganizations": "Tus Organizaciones",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@
"organizations": "组织机构",
"search": "搜索",
"filter": "筛选",
"searchByName": "按名称搜索"
"searchByName": "按名称搜索",
"searchOrganizations": "搜索组织"
},
"userSidebarOrg": {
"yourOrganizations": "您的组织",
Expand Down
5 changes: 3 additions & 2 deletions src/components/EventDashboardScreen/EventDashboardScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import LeftDrawerOrg from 'components/LeftDrawerOrg/LeftDrawerOrg';
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { useSelector } from 'react-redux';
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
import { updateTargets } from 'state/action-creators';
import { useAppDispatch } from 'state/hooks';
import type { RootState } from 'state/reducers';
import type { TargetsType } from 'state/reducers/routesReducer';
import styles from './EventDashboardScreen.module.css';
Expand Down Expand Up @@ -58,7 +59,7 @@ const EventDashboardScreen = (): JSX.Element => {
} = useSelector((state: RootState) => state.appRoutes);
const { targets } = appRoutes;

const dispatch = useDispatch();
const dispatch = useAppDispatch();

// Update targets when orgId changes
useEffect(() => {
Expand Down
5 changes: 3 additions & 2 deletions src/components/OrganizationScreen/OrganizationScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import LeftDrawerOrg from 'components/LeftDrawerOrg/LeftDrawerOrg';
import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { useSelector } from 'react-redux';
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
import { updateTargets } from 'state/action-creators';
import { useAppDispatch } from 'state/hooks';
import type { RootState } from 'state/reducers';
import type { TargetsType } from 'state/reducers/routesReducer';
import styles from './OrganizationScreen.module.css';
Expand Down Expand Up @@ -59,7 +60,7 @@ const OrganizationScreen = (): JSX.Element => {
} = useSelector((state: RootState) => state.appRoutes);
const { targets } = appRoutes;

const dispatch = useDispatch();
const dispatch = useAppDispatch();

// Update targets whenever the organization ID changes
useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion src/components/PaginationList/PaginationList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ const PaginationList = ({
<Hidden smDown initialWidth={'lg'}>
<TablePagination
rowsPerPageOptions={[
-1,
5,
10,
30,
Expand Down
40 changes: 40 additions & 0 deletions src/screens/UserPortal/Organizations/Organizations.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -519,4 +519,44 @@ describe('Testing Organizations Screen [User Portal]', () => {
settingsBtn.click();
});
});
test('Rows per Page values', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<Organizations />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);
await wait();
const dropdown = screen.getByTestId('table-pagination');
userEvent.click(dropdown);
expect(screen.queryByText('-1')).not.toBeInTheDocument();
expect(screen.getByText('5')).toBeInTheDocument();
expect(screen.getByText('10')).toBeInTheDocument();
expect(screen.getByText('30')).toBeInTheDocument();
expect(screen.getByText('All')).toBeInTheDocument();
});

test('Search input has correct placeholder text', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<Organizations />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>,
);

await wait();

const searchInput = screen.getByPlaceholderText('Search Organization');
expect(searchInput).toBeInTheDocument();
});
});
4 changes: 2 additions & 2 deletions src/screens/UserPortal/Organizations/Organizations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,8 @@ export default function organizations(): JSX.Element {
<div className="mt-4">
<InputGroup className={styles.maxWidth}>
<Form.Control
placeholder={t('searchUsers')}
id="searchUserOrgs"
placeholder={t('searchOrganizations')}
id="searchOrganizations"
type="text"
className={`${styles.borderNone} ${styles.backgroundWhite}`}
onKeyUp={handleSearchByEnter}
Expand Down
5 changes: 3 additions & 2 deletions src/screens/UserPortal/UserScreen/UserScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import React, { useEffect, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useSelector } from 'react-redux';
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
import { updateTargets } from 'state/action-creators';
import { useAppDispatch } from 'state/hooks';
import type { RootState } from 'state/reducers';
import type { TargetsType } from 'state/reducers/routesReducer';
import styles from './UserScreen.module.css';
Expand Down Expand Up @@ -57,7 +58,7 @@ const UserScreen = (): JSX.Element => {
*/

// Initialize Redux dispatch
const dispatch = useDispatch();
const dispatch = useAppDispatch();

/**
* Effect hook to update targets based on the organization ID.
Expand Down
5 changes: 5 additions & 0 deletions src/state/hooks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { useDispatch } from 'react-redux';
import type { AppDispatch } from './store';

// Use throughout your app instead of plain `useDispatch`
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
9 changes: 6 additions & 3 deletions src/state/store.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import { applyMiddleware, createStore } from 'redux';
import thunk from 'redux-thunk';
import { configureStore } from '@reduxjs/toolkit';
import { reducers } from './reducers/index';

export const store = createStore(reducers, {}, applyMiddleware(thunk));
export const store = configureStore({
reducer: reducers,
});

export type AppDispatch = typeof store.dispatch;

0 comments on commit b7c0eb2

Please sign in to comment.