Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…awa-admin into re_fund_campaign
  • Loading branch information
GlenDsza committed Jul 5, 2024
2 parents 707e81c + ffb686e commit 5f24763
Show file tree
Hide file tree
Showing 11 changed files with 17,950 additions and 157 deletions.
17,793 changes: 17,756 additions & 37 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@mui/material": "^5.15.20",
"@mui/private-theming": "^5.15.12",
"@mui/system": "^5.14.12",
"@mui/x-charts": "^7.6.2",
"@mui/x-charts": "^7.8.0",
"@mui/x-data-grid": "^6.20.0",
"@mui/x-date-pickers": "^7.6.1",
"@pdfme/generator": "^1.2.6",
Expand All @@ -34,16 +34,17 @@
"inquirer": "^8.0.0",
"js-cookie": "^3.0.1",
"markdown-toc": "^1.2.0",
"prettier": "^3.2.5",
"prettier": "^3.3.2",
"react": "^17.0.2",
"react-app-rewired": "^2.2.1",
"react-bootstrap": "^2.7.4",
"react-datepicker": "^4.2.0",
"react-datepicker": "^7.2.0",
"react-dom": "^17.0.2",
"react-google-recaptcha": "^2.1.0",
"react-i18next": "^11.18.1",
"react-icons": "^5.2.1",
"react-infinite-scroll-component": "^6.1.0",
"react-multi-carousel": "^2.8.5",
"react-redux": "^7.2.5",
"react-router-dom": "^6.23.1",
"react-scripts": "5.0.1",
Expand Down Expand Up @@ -125,7 +126,7 @@
"lint-staged": "^15.2.7",
"postcss-modules": "^6.0.0",
"sass": "^1.77.4",
"tsx": "^4.15.5"
"tsx": "^4.16.0"
},
"resolutions": {
"@apollo/client": "^3.4.0-beta.19",
Expand Down
1 change: 1 addition & 0 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
"editActionItem": "Edit Action Item",
"isCompleted": "Completed",
"latest": "Latest",
"makeActive": "Active",
"noActionItems": "No Action Items",
"options": "Options",
"preCompletionNotes": "Pre Completion Notes",
Expand Down
1 change: 1 addition & 0 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"editActionItem": "Modifier l'élément d'action",
"isCompleted": "Complété",
"latest": "Dernier",
"makeActive": "Actif",
"noActionItems": "Aucune action",
"options": "Possibilités",
"preCompletionNotes": "Notes préalables à l'achèvement",
Expand Down
1 change: 1 addition & 0 deletions public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"editActionItem": "क्रिया आइटम संपादित करें",
"isCompleted": "पुरा होना।",
"latest": "नवीनतम",
"makeActive": "सक्रिय",
"noActionItems": "कोई एक्शन आइटम नहीं",
"options": "विकल्प",
"preCompletionNotes": "समापन पूर्व नोट्स",
Expand Down
1 change: 1 addition & 0 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@
"editActionItem": "编辑操作项",
"isCompleted": "完全的",
"latest": "最新的",
"makeActive": "积极的",
"noActionItems": "无行动项目",
"options": "选项",
"preCompletionNotes": "预完成注释",
Expand Down
48 changes: 48 additions & 0 deletions src/components/ActionItems/ActionItemsContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,48 @@ describe('Testing Action Item Categories Component', () => {
);
});

test('completed action item status change modal loads correctly', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<Provider store={store}>
<BrowserRouter>
<LocalizationProvider dateAdapter={AdapterDayjs}>
<I18nextProvider i18n={i18nForTest}>
<ActionItemsContainer {...props} />
</I18nextProvider>
</LocalizationProvider>
</BrowserRouter>
</Provider>
</MockedProvider>,
);

await wait();

await waitFor(() => {
expect(
screen.getAllByTestId('actionItemStatusChangeCheckbox')[1],
).toBeInTheDocument();
});
userEvent.click(screen.getAllByTestId('actionItemStatusChangeCheckbox')[1]);

await waitFor(() => {
return expect(
screen.findByTestId('actionItemStatusChangeModalCloseBtn'),
).resolves.toBeInTheDocument();
});
expect(screen.getByText(translations.actionItemStatus)).toBeInTheDocument();

expect(
screen.getByTestId('actionItemsStatusChangeNotes'),
).toBeInTheDocument();
expect(
screen.getByPlaceholderText(translations.actionItemCompleted),
).toBeInTheDocument();
expect(
screen.getByRole('button', { name: translations.makeActive }),
).toBeInTheDocument();
});

test('opens and closes the preview modal correctly', async () => {
render(
<MockedProvider addTypename={false} link={link}>
Expand Down Expand Up @@ -473,6 +515,9 @@ describe('Testing Action Item Categories Component', () => {
screen.getByTestId('actionItemStatusChangeSubmitBtn'),
).toBeInTheDocument();
});
expect(
screen.getByTestId('actionItemStatusChangeSubmitBtn'),
).toHaveTextContent(translations.markCompletion);
userEvent.click(screen.getByTestId('actionItemStatusChangeSubmitBtn'));

await waitFor(() => {
Expand Down Expand Up @@ -506,6 +551,9 @@ describe('Testing Action Item Categories Component', () => {
screen.getByTestId('actionItemStatusChangeSubmitBtn'),
).toBeInTheDocument();
});
expect(
screen.getByTestId('actionItemStatusChangeSubmitBtn'),
).toHaveTextContent(translations.makeActive);
userEvent.click(screen.getByTestId('actionItemStatusChangeSubmitBtn'));

await waitFor(() => {
Expand Down
7 changes: 5 additions & 2 deletions src/components/UserPortal/PostCard/PostCard.module.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.cardStyles {
height: 28rem;
max-height: 30rem;
width: 20rem;
background-color: white;
padding: 0;
Expand Down Expand Up @@ -178,3 +176,8 @@
outline: none;
background-color: #f1f3f6;
}

.postImage {
height: 300px;
object-fit: cover;
}
4 changes: 1 addition & 3 deletions src/components/UserPortal/PostCard/PostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
</Dropdown>
</Card.Header>
<Card.Img
className={styles.postImage}
variant="top"
src={
props.image === '' || props.image === null
Expand All @@ -291,9 +292,6 @@ export default function postCard(props: InterfacePostCard): JSX.Element {
<Card.Text className={`${styles.cardText} mt-4`}>
{props.text}
</Card.Text>
{props.image && (
<img src={props.image} className={styles.imageContainer} />
)}
</Card.Body>
<Card.Footer style={{ border: 'none', background: 'white' }}>
<div className={`${styles.cardActions}`}>
Expand Down
122 changes: 69 additions & 53 deletions src/screens/UserPortal/Posts/Posts.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { act, render, screen, waitFor, within } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import userEvent from '@testing-library/user-event';
import {
ADVERTISEMENTS_GET,
ORGANIZATION_ADVERTISEMENT_LIST,
ORGANIZATION_POST_LIST,
} from 'GraphQl/Queries/Queries';
import { Provider } from 'react-redux';
Expand Down Expand Up @@ -137,67 +137,83 @@ const MOCKS = [
},
{
request: {
query: ADVERTISEMENTS_GET,
variables: {},
query: ORGANIZATION_ADVERTISEMENT_LIST,
variables: { id: 'orgId', first: 6 },
},
result: {
data: {
advertisementsConnection: {
edges: [
{
node: {
_id: '1234',
name: 'Ad 1',
type: 'Type 1',
organization: {
_id: 'orgId',
organizations: [
{
_id: 'orgId',
advertisements: {
edges: [
{
node: {
_id: '1234',
name: 'Ad 1',
type: 'Type 1',
organization: {
_id: 'orgId',
},
mediaUrl: 'Link 1',
endDate: '2024-12-31',
startDate: '2022-01-01',
},
cursor: '1234',
},
mediaUrl: 'Link 1',
endDate: '2024-12-31',
startDate: '2022-01-01',
},
},
{
node: {
_id: '2345',
name: 'Ad 2',
type: 'Type 1',
organization: {
_id: 'orgId',
{
node: {
_id: '2345',
name: 'Ad 2',
type: 'Type 1',
organization: {
_id: 'orgId',
},
mediaUrl: 'Link 2',
endDate: '2024-09-31',
startDate: '2023-04-01',
},
cursor: '1234',
},
mediaUrl: 'Link 2',
endDate: '2024-09-31',
startDate: '2023-04-01',
},
},
{
node: {
_id: '3456',
name: 'name3',
type: 'Type 2',
organization: {
_id: 'orgId',
{
node: {
_id: '3456',
name: 'name3',
type: 'Type 2',
organization: {
_id: 'orgId',
},
mediaUrl: 'link3',
startDate: '2023-01-30',
endDate: '2023-12-31',
},
cursor: '1234',
},
mediaUrl: 'link3',
startDate: '2023-01-30',
endDate: '2023-12-31',
},
},
{
node: {
_id: '4567',
name: 'name4',
type: 'Type 2',
organization: {
_id: 'orgId1',
{
node: {
_id: '4567',
name: 'name4',
type: 'Type 2',
organization: {
_id: 'orgId1',
},
mediaUrl: 'link4',
startDate: '2023-01-30',
endDate: '2023-12-01',
},
cursor: '1234',
},
mediaUrl: 'link4',
startDate: '2023-01-30',
endDate: '2023-12-01',
],
pageInfo: {
startCursor: '6411e53835d7ba2344a78e21',
endCursor: '6411e54835d7ba2344a78e31',
hasNextPage: false,
hasPreviousPage: false,
},
totalCount: 2,
},
],
},
},
],
},
},
},
Expand Down
Loading

0 comments on commit 5f24763

Please sign in to comment.