Skip to content

Commit d27d224

Browse files
Merge pull request #5191 from OneCommunityGlobal/Diya_Fix_ProjectPageButtonPopups
Diya 🔥 fix(popup): Fixed Project Page Button Popups
2 parents b71553f + 60b6c44 commit d27d224

3 files changed

Lines changed: 42 additions & 11 deletions

File tree

src/components/Projects/Projects.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ const Projects = function(props) {
9494

9595
const onClickArchiveBtn = projectData => {
9696
setProjectTarget(projectData);
97+
const archiveMessage = projectData.isArchived
98+
? `<p style="${darkMode ? 'color: white' : 'color: black'}">Do you want to unarchive <b>${projectData.projectName}</b>? This will restore it and its tasks.</p>`
99+
: `<p style="${darkMode ? 'color: white' : 'color: black'}"><b>Hold on!</b><br/>Archiving <b>${projectData.projectName}</b> will deactivate all its WBS, tasks, and time entries, and remove it from all team members' profiles.<br/><b>Sure about this?</b></p>`;
97100
setModalData({
98101
showModal: true,
99-
modalMessage: `<p style="${darkMode ? 'color: white' : 'color: black'}">Do you want to ${projectData.isArchived ? 'unarchive' : 'archive'} ${projectData.projectName}?</p>`,
102+
modalMessage: archiveMessage,
100103
modalTitle: projectData.isArchived ? 'Confirm Unarchive' : CONFIRM_ARCHIVE,
101104
hasConfirmBtn: true,
102105
hasInactiveBtn: false,
@@ -431,7 +434,7 @@ const Projects = function(props) {
431434
darkMode={darkMode}
432435
confirmButtonText={isArchiving
433436
? (projectTarget.isArchived ? 'Unarchiving...' : 'Archiving...')
434-
: (projectTarget.isArchived ? 'Unarchive' : 'Confirm')
437+
: (projectTarget.isArchived ? 'Unarchive' : 'Yes, archive it')
435438
}
436439
isConfirmDisabled={isArchiving}
437440
setInactiveButton={isChangingStatus ? 'Setting Inactive' : 'Yes, hide it all'}

src/components/common/Modal/Modal.jsx

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,42 @@ const ModalExample = props => {
8888
</ModalBody>
8989
<ModalFooter className={darkMode ? 'bg-yinmn-blue' : ''}>
9090
{setInactiveModal != null ? (
91-
<Button color="danger" onClick={closeModal} style={darkMode ? boxStyleDark : boxStyle}>
92-
Nope, changed my mind
93-
</Button>
91+
<>
92+
<Button
93+
color="secondary"
94+
onClick={closeModal}
95+
style={darkMode ? boxStyleDark : boxStyle}
96+
>
97+
Nope, changed my mind
98+
</Button>
99+
<Button
100+
color="success"
101+
disabled={isSetInactiveDisabled}
102+
onClick={setInactiveModal}
103+
style={darkMode ? boxStyleDark : boxStyle}
104+
>
105+
{isSetInactiveDisabled ? 'Setting Inactive...' : setInactiveButton}
106+
</Button>
107+
</>
94108
) : null}
95109
{setActiveModal != null ? (
96-
<Button color="danger" onClick={closeModal} style={darkMode ? boxStyleDark : boxStyle}>
97-
Nope, leave it buried
98-
</Button>
110+
<>
111+
<Button
112+
color="secondary"
113+
onClick={closeModal}
114+
style={darkMode ? boxStyleDark : boxStyle}
115+
>
116+
Nope, leave it buried
117+
</Button>
118+
<Button
119+
color="success"
120+
disabled={isSetActiveDisabled}
121+
onClick={setActiveModal}
122+
style={darkMode ? boxStyleDark : boxStyle}
123+
>
124+
{isSetActiveDisabled ? 'Setting Active...' : setActiveButton}
125+
</Button>
126+
</>
99127
) : null}
100128
{/*
101129
{confirmModal != null ? (
@@ -151,7 +179,7 @@ const ModalExample = props => {
151179
{/* Close button */}
152180
{confirmModal && (
153181
<Button color="secondary" onClick={closeModal} style={darkMode ? boxStyleDark : boxStyle}>
154-
Close
182+
Nope, changed my mind
155183
</Button>
156184
)}
157185

src/components/common/Modal/__tests__/Modal.test.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('ModalExample Component', () => {
3737
</Provider>,
3838
);
3939

40-
fireEvent.click(screen.getByText('Close'));
40+
fireEvent.click(screen.getByText('Nope, changed my mind'));
4141
expect(closeModalMock).toHaveBeenCalledTimes(1);
4242
});
4343

@@ -110,7 +110,7 @@ describe('ModalExample Component', () => {
110110
/>,
111111
);
112112

113-
fireEvent.click(screen.getByText(/yes, hide it all/i));
113+
fireEvent.click(screen.getAllByText(/yes, hide it all/i)[0]);
114114
expect(setInactiveModalMock).toHaveBeenCalled();
115115
});
116116

0 commit comments

Comments
 (0)