Skip to content

Commit 4a84a04

Browse files
Merge pull request #3491 from OneCommunityGlobal/development
Frontend Release to Main [4.15]
2 parents dd902c6 + 2eb99c1 commit 4a84a04

19 files changed

Lines changed: 1986 additions & 1004 deletions

File tree

src/App.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ button {
116116

117117
/* .bg-space-cadet:hover{
118118
background-color: #1C2541 !important;
119-
color:black;
119+
color:black;
120120
} */
121121

122122
.bg-yinmn-blue {
@@ -261,3 +261,10 @@ input[type='checkbox']:not([disabled]):hover {
261261
.pdrl-1 {
262262
padding: 0 1em !important;
263263
}
264+
.user-card-container {
265+
display: flex;
266+
flex-wrap: wrap;
267+
justify-content: center;
268+
gap: 24px;
269+
padding: 20px;
270+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import axios from 'axios'; // Import axios for mocking HTTP requests
2+
import { getDashboardDataAI, updateDashboardData, updateCopiedPromptDate, getCopiedDateOfPrompt } from '../weeklySummariesAIPrompt'; // Import the actions to be tested
3+
import { getAIPrompt, updateAIPrompt, updateCopiedPrompt, getCopiedPromptDate } from '../../constants/weeklySummariesAIPrompt'; // Import the action creators
4+
5+
jest.mock('axios'); // Mock axios to control its behavior in tests
6+
7+
describe('getDashboardDataAI', () => {
8+
it('should dispatch getAIPrompt with data on success', async () => {
9+
const mockData = { prompt: 'AI Prompt' }; // Mock data to be returned by axios
10+
axios.get.mockResolvedValue({ data: mockData }); // Mock axios.get to resolve with mock data
11+
12+
const dispatch = jest.fn(); // Mock dispatch function
13+
await getDashboardDataAI()(dispatch); // Call the action with the mock dispatch
14+
15+
expect(axios.get).toHaveBeenCalledWith(expect.any(String)); // Assert axios.get was called with any URL
16+
expect(dispatch).toHaveBeenCalledWith(getAIPrompt(mockData)); // Assert dispatch was called with the correct action
17+
});
18+
19+
it('should dispatch getAIPrompt with undefined on failure', async () => {
20+
axios.get.mockRejectedValue(new Error('Network Error')); // Mock axios.get to reject with an error
21+
22+
const dispatch = jest.fn(); // Mock dispatch function
23+
await getDashboardDataAI()(dispatch); // Call the action with the mock dispatch
24+
25+
expect(axios.get).toHaveBeenCalledWith(expect.any(String)); // Assert axios.get was called with any URL
26+
expect(dispatch).toHaveBeenCalledWith(getAIPrompt(undefined)); // Assert dispatch was called with the correct action
27+
});
28+
});
29+
30+
describe('updateDashboardData', () => {
31+
it('should dispatch updateAIPrompt with textPrompt on success', async () => {
32+
const textPrompt = 'New AI Prompt'; // Mock text prompt
33+
axios.put.mockResolvedValue({ status: 200 }); // Mock axios.put to resolve with a success status
34+
35+
const dispatch = jest.fn(); // Mock dispatch function
36+
await updateDashboardData(textPrompt)(dispatch); // Call the action with the mock dispatch
37+
38+
expect(axios.put).toHaveBeenCalledWith(expect.any(String), { aIPromptText: textPrompt }); // Assert axios.put was called with the correct URL and data
39+
expect(dispatch).toHaveBeenCalledWith(updateAIPrompt(textPrompt)); // Assert dispatch was called with the correct action
40+
});
41+
});
42+
43+
describe('updateCopiedPromptDate', () => {
44+
it('should dispatch updateCopiedPrompt with userId on success', async () => {
45+
const userId = '12345'; // Mock user ID
46+
axios.put.mockResolvedValue({ status: 200 }); // Mock axios.put to resolve with a success status
47+
48+
const dispatch = jest.fn(); // Mock dispatch function
49+
await updateCopiedPromptDate(userId)(dispatch); // Call the action with the mock dispatch
50+
51+
expect(axios.put).toHaveBeenCalledWith(expect.any(String)); // Assert axios.put was called with the correct URL
52+
expect(dispatch).toHaveBeenCalledWith(updateCopiedPrompt(userId)); // Assert dispatch was called with the correct action
53+
});
54+
});
55+
56+
describe('getCopiedDateOfPrompt', () => {
57+
it('should dispatch getCopiedPromptDate with data on success', async () => {
58+
const userId = '12345'; // Mock user ID
59+
const mockData = { message: '2023-10-01' }; // Mock data to be returned by axios
60+
axios.get.mockResolvedValue({ data: mockData }); // Mock axios.get to resolve with mock data
61+
62+
const dispatch = jest.fn(); // Mock dispatch function
63+
await getCopiedDateOfPrompt(userId)(dispatch); // Call the action with the mock dispatch
64+
65+
expect(axios.get).toHaveBeenCalledWith(expect.any(String)); // Assert axios.get was called with the correct URL
66+
expect(dispatch).toHaveBeenCalledWith(getCopiedPromptDate(mockData.message)); // Assert dispatch was called with the correct action
67+
});
68+
69+
it('should dispatch getCopiedPromptDate with undefined on failure', async () => {
70+
const userId = '12345'; // Mock user ID
71+
axios.get.mockRejectedValue(new Error('Network Error')); // Mock axios.get to reject with an error
72+
73+
const dispatch = jest.fn(); // Mock dispatch function
74+
await getCopiedDateOfPrompt(userId)(dispatch); // Call the action with the mock dispatch
75+
76+
expect(axios.get).toHaveBeenCalledWith(expect.any(String)); // Assert axios.get was called with the correct URL
77+
expect(dispatch).toHaveBeenCalledWith(getCopiedPromptDate(undefined)); // Assert dispatch was called with the correct action
78+
});
79+
});

src/components/Announcements/Announcements.css

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ label {
2525
textarea {
2626
margin-top: 5px; /* Space above input fields */
2727
width: 100%;
28-
padding: 10px;
28+
padding: 12px; /* Increased padding */
2929
border: 1px solid #ccc;
3030
border-radius: 4px;
31+
box-sizing: border-box; /* Ensures padding is included in width */
3132
}
3233

3334
.input-file-upload {
@@ -39,9 +40,10 @@ button.send-button {
3940
color: white;
4041
border: none;
4142
border-radius: 4px;
42-
padding: 10px 20px;
43+
padding: 12px 24px; /* Increased padding */
4344
cursor: pointer;
4445
margin-top: 20px;
46+
box-sizing: border-box; /* Ensures padding is included in width */
4547
}
4648

4749
button.send-button:hover {
@@ -57,6 +59,7 @@ button.send-button:hover {
5759
display: flex;
5860
justify-content: space-between;
5961
align-items: flex-start;
62+
box-sizing: border-box; /* Ensures padding is included in width */
6063
}
6164

6265
.editor {
@@ -73,10 +76,11 @@ button.send-button:hover {
7376

7477
.emails {
7578
margin-top: 65px;
76-
padding: 20px;
79+
padding: 24px; /* Increased padding */
7780
border: solid 1px #cacaca;
7881
border-radius: 20px;
7982
width: 300px;
83+
box-sizing: border-box; /* Ensures padding is included in width */
8084
/* Set a fixed width for the email inputs container */
8185
}
8286

@@ -111,4 +115,37 @@ button.send-button:hover {
111115
margin-top: 10px;
112116
/* Reduce margin top on smaller screens */
113117
}
114-
}
118+
}
119+
/* Responsive design: Adjust the layout for smaller screens */
120+
@media (max-width: 800px) {
121+
.email-update-container {
122+
display: flex;
123+
flex-direction: column;
124+
padding: 20px;
125+
box-sizing: border-box; /* Ensures padding is included in width */
126+
}
127+
.editor {
128+
width: 100%;
129+
margin-right: 0;
130+
margin-bottom: 20px;
131+
}
132+
.emails {
133+
width: 100%;
134+
margin-top: 20px;
135+
padding: 20px 12px; /* Adjust padding for smaller screens */
136+
box-sizing: border-box; /* Ensures padding is included in width */
137+
}
138+
.send-button {
139+
width: 100%;
140+
margin-bottom: 10px;
141+
padding: 12px; /* Ensures padding is consistent */
142+
box-sizing: border-box; /* Ensures padding is included in width */
143+
}
144+
.input-text-for-announcement,
145+
textarea {
146+
width: 100%;
147+
padding: 12px; /* Ensures padding is consistent */
148+
box-sizing: border-box; /* Ensures padding is included in width */
149+
}
150+
}
151+

src/components/Header/Header.css

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,21 @@
3030
}
3131

3232
.navbar {
33-
z-index: 100;
33+
display: flex;
34+
flex-wrap: nowrap;
35+
justify-content: space-between;
36+
align-items: center;
37+
width: 100%;
3438
white-space: nowrap;
3539
}
3640

3741
.timer-message-section {
3842
display: flex;
3943
align-items: center;
40-
justify-content: space-between;
41-
width: 100%;
44+
justify-content: flex-start;
45+
flex-wrap: nowrap;
4246
gap: 1rem;
47+
white-space: nowrap;
4348
}
4449

4550
.redBackGroupHeader {
@@ -65,7 +70,10 @@
6570

6671
.nav-links {
6772
display: flex;
73+
flex-direction: row;
6874
align-items: center;
75+
flex-wrap: nowrap;
76+
gap: 1rem;
6977
}
7078

7179
.dropdown-item-hover:hover {
@@ -110,4 +118,12 @@
110118
.responsive-spacing {
111119
margin-right: 5px;
112120
}
113-
}
121+
}
122+
.header-margin{
123+
height : 20px;
124+
background-color: #1B2A41 ;
125+
}
126+
.header-margin-light{
127+
height : 20px;
128+
background-color: #fff;
129+
}

0 commit comments

Comments
 (0)