Skip to content

Commit 41e2b74

Browse files
Merge branch 'develop' into user-leaveorg
2 parents 022474d + f6922a6 commit 41e2b74

File tree

15 files changed

+388
-182
lines changed

15 files changed

+388
-182
lines changed

package-lock.json

Lines changed: 309 additions & 158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
"@mui/x-data-grid": "^7.16.0",
2121
"@mui/x-date-pickers": "^7.11.1",
2222
"@pdfme/generator": "^4.5.2",
23+
"@reduxjs/toolkit": "^2.2.7",
2324
"@vitejs/plugin-react": "^4.3.1",
2425
"babel-plugin-transform-import-meta": "^2.2.1",
2526
"bootstrap": "^5.3.3",
2627
"customize-cra": "^1.0.0",
27-
"dayjs": "^1.11.12",
28+
"dayjs": "^1.11.13",
2829
"dotenv": "^16.4.5",
29-
"flag-icons": "^6.6.6",
30+
"flag-icons": "^7.2.3",
3031
"graphql": "^16.9.0",
3132
"graphql-tag": "^2.12.6",
3233
"graphql-ws": "^5.16.0",
@@ -44,16 +45,15 @@
4445
"react-datepicker": "^7.3.0",
4546
"react-dom": "^18.3.1",
4647
"react-google-recaptcha": "^3.1.0",
47-
"react-i18next": "^12.3.1",
48+
"react-i18next": "^15.0.2",
4849
"react-icons": "^5.2.1",
4950
"react-infinite-scroll-component": "^6.1.0",
5051
"react-multi-carousel": "^2.8.5",
51-
"react-redux": "^7.2.5",
52+
"react-redux": "^9.1.2",
5253
"react-router-dom": "^6.26.0",
5354
"react-toastify": "^10.0.5",
5455
"react-tooltip": "^5.27.1",
55-
"redux": "^4.1.1",
56-
"redux-thunk": "^2.3.0",
56+
"redux": "^5.0.1",
5757
"sanitize-html": "^2.13.0",
5858
"typedoc": "^0.26.7",
5959
"typedoc-plugin-markdown": "^4.2.1",
@@ -126,7 +126,7 @@
126126
"babel-jest": "^29.7.0",
127127
"cross-env": "^7.0.3",
128128
"eslint-config-prettier": "^9.1.0",
129-
"eslint-plugin-import": "^2.29.1",
129+
"eslint-plugin-import": "^2.30.0",
130130
"eslint-plugin-jest": "^28.8.0",
131131
"eslint-plugin-prettier": "^5.2.1",
132132
"eslint-plugin-react": "^7.35.0",

public/locales/en/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,8 @@
964964
"organizations": "Organizations",
965965
"search": "search",
966966
"filter": "filter",
967-
"searchByName": "searchByName"
967+
"searchByName": "searchByName",
968+
"searchOrganizations": "Search Organization"
968969
},
969970
"userSidebarOrg": {
970971
"yourOrganizations": "Your Organizations",

public/locales/fr/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,8 @@
964964
"organizations": "Organisations",
965965
"search": "Rechercher",
966966
"filter": "Filtrer",
967-
"searchByName": "Rechercher par nom"
967+
"searchByName": "Rechercher par nom",
968+
"searchOrganizations": "Rechercher Organisations"
968969
},
969970
"userSidebarOrg": {
970971
"yourOrganizations": "Vos organisations",

public/locales/hi/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,8 @@
964964
"organizations": "संगठनों",
965965
"search": "खोजें",
966966
"filter": "फ़िल्टर",
967-
"searchByName": "नाम से खोजें"
967+
"searchByName": "नाम से खोजें",
968+
"searchOrganizations": "संगठनों खोजें"
968969
},
969970
"userSidebarOrg": {
970971
"yourOrganizations": "आपके संगठन",

public/locales/sp/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,8 @@
965965
"filter": "Filtrar",
966966
"organizations": "Organizaciones",
967967
"searchByName": "Buscar por nombre",
968-
"searchUsers": "Buscar usuarios"
968+
"searchUsers": "Buscar usuarios",
969+
"searchOrganizations": "Buscar Organizaciones"
969970
},
970971
"userSidebarOrg": {
971972
"yourOrganizations": "Tus Organizaciones",

public/locales/zh/translation.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,8 @@
964964
"organizations": "组织机构",
965965
"search": "搜索",
966966
"filter": "筛选",
967-
"searchByName": "按名称搜索"
967+
"searchByName": "按名称搜索",
968+
"searchOrganizations": "搜索组织"
968969
},
969970
"userSidebarOrg": {
970971
"yourOrganizations": "您的组织",

src/components/EventDashboardScreen/EventDashboardScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import LeftDrawerOrg from 'components/LeftDrawerOrg/LeftDrawerOrg';
22
import React, { useEffect, useState } from 'react';
33
import { useTranslation } from 'react-i18next';
4-
import { useDispatch, useSelector } from 'react-redux';
4+
import { useSelector } from 'react-redux';
55
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
66
import { updateTargets } from 'state/action-creators';
7+
import { useAppDispatch } from 'state/hooks';
78
import type { RootState } from 'state/reducers';
89
import type { TargetsType } from 'state/reducers/routesReducer';
910
import styles from './EventDashboardScreen.module.css';
@@ -58,7 +59,7 @@ const EventDashboardScreen = (): JSX.Element => {
5859
} = useSelector((state: RootState) => state.appRoutes);
5960
const { targets } = appRoutes;
6061

61-
const dispatch = useDispatch();
62+
const dispatch = useAppDispatch();
6263

6364
// Update targets when orgId changes
6465
useEffect(() => {

src/components/OrganizationScreen/OrganizationScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import LeftDrawerOrg from 'components/LeftDrawerOrg/LeftDrawerOrg';
22
import React, { useEffect, useState } from 'react';
33
import { useTranslation } from 'react-i18next';
4-
import { useDispatch, useSelector } from 'react-redux';
4+
import { useSelector } from 'react-redux';
55
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
66
import { updateTargets } from 'state/action-creators';
7+
import { useAppDispatch } from 'state/hooks';
78
import type { RootState } from 'state/reducers';
89
import type { TargetsType } from 'state/reducers/routesReducer';
910
import styles from './OrganizationScreen.module.css';
@@ -44,7 +45,7 @@ const OrganizationScreen = (): JSX.Element => {
4445
} = useSelector((state: RootState) => state.appRoutes);
4546
const { targets } = appRoutes;
4647

47-
const dispatch = useDispatch();
48+
const dispatch = useAppDispatch();
4849

4950
// Update targets whenever the organization ID changes
5051
useEffect(() => {

src/components/PaginationList/PaginationList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ const PaginationList = ({
6767
<Hidden smDown initialWidth={'lg'}>
6868
<TablePagination
6969
rowsPerPageOptions={[
70-
-1,
7170
5,
7271
10,
7372
30,

src/screens/UserPortal/Organizations/Organizations.test.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,4 +519,44 @@ describe('Testing Organizations Screen [User Portal]', () => {
519519
settingsBtn.click();
520520
});
521521
});
522+
test('Rows per Page values', async () => {
523+
render(
524+
<MockedProvider addTypename={false} link={link}>
525+
<BrowserRouter>
526+
<Provider store={store}>
527+
<I18nextProvider i18n={i18nForTest}>
528+
<Organizations />
529+
</I18nextProvider>
530+
</Provider>
531+
</BrowserRouter>
532+
</MockedProvider>,
533+
);
534+
await wait();
535+
const dropdown = screen.getByTestId('table-pagination');
536+
userEvent.click(dropdown);
537+
expect(screen.queryByText('-1')).not.toBeInTheDocument();
538+
expect(screen.getByText('5')).toBeInTheDocument();
539+
expect(screen.getByText('10')).toBeInTheDocument();
540+
expect(screen.getByText('30')).toBeInTheDocument();
541+
expect(screen.getByText('All')).toBeInTheDocument();
542+
});
543+
544+
test('Search input has correct placeholder text', async () => {
545+
render(
546+
<MockedProvider addTypename={false} link={link}>
547+
<BrowserRouter>
548+
<Provider store={store}>
549+
<I18nextProvider i18n={i18nForTest}>
550+
<Organizations />
551+
</I18nextProvider>
552+
</Provider>
553+
</BrowserRouter>
554+
</MockedProvider>,
555+
);
556+
557+
await wait();
558+
559+
const searchInput = screen.getByPlaceholderText('Search Organization');
560+
expect(searchInput).toBeInTheDocument();
561+
});
522562
});

src/screens/UserPortal/Organizations/Organizations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,8 @@ export default function organizations(): JSX.Element {
319319
<div className="mt-4">
320320
<InputGroup className={styles.maxWidth}>
321321
<Form.Control
322-
placeholder={t('searchUsers')}
323-
id="searchUserOrgs"
322+
placeholder={t('searchOrganizations')}
323+
id="searchOrganizations"
324324
type="text"
325325
className={`${styles.borderNone} ${styles.backgroundWhite}`}
326326
onKeyUp={handleSearchByEnter}

src/screens/UserPortal/UserScreen/UserScreen.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import React, { useEffect, useState } from 'react';
2-
import { useDispatch, useSelector } from 'react-redux';
2+
import { useSelector } from 'react-redux';
33
import { Navigate, Outlet, useLocation, useParams } from 'react-router-dom';
44
import { updateTargets } from 'state/action-creators';
5+
import { useAppDispatch } from 'state/hooks';
56
import type { RootState } from 'state/reducers';
67
import type { TargetsType } from 'state/reducers/routesReducer';
78
import styles from './UserScreen.module.css';
@@ -57,7 +58,7 @@ const UserScreen = (): JSX.Element => {
5758
*/
5859

5960
// Initialize Redux dispatch
60-
const dispatch = useDispatch();
61+
const dispatch = useAppDispatch();
6162

6263
/**
6364
* Effect hook to update targets based on the organization ID.

src/state/hooks.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { useDispatch } from 'react-redux';
2+
import type { AppDispatch } from './store';
3+
4+
// Use throughout your app instead of plain `useDispatch`
5+
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();

src/state/store.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import { applyMiddleware, createStore } from 'redux';
2-
import thunk from 'redux-thunk';
1+
import { configureStore } from '@reduxjs/toolkit';
32
import { reducers } from './reducers/index';
43

5-
export const store = createStore(reducers, {}, applyMiddleware(thunk));
4+
export const store = configureStore({
5+
reducer: reducers,
6+
});
7+
8+
export type AppDispatch = typeof store.dispatch;

0 commit comments

Comments
 (0)