Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MHV-55186] Update all V1 components to V3 web components on SM MHV #28504

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
0b7b250
[MHV-55186] Update Message landing components to V3
vsaleem Mar 4, 2024
8af53af
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 5, 2024
97c5991
[MHV-55186] Updated modals, buttons, and dropdowns with uswds
vsaleem Mar 5, 2024
91fcdd4
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 11, 2024
f3e129c
[MHV-55186] Update SM va-components to uswds
vsaleem Mar 12, 2024
f8c6800
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 12, 2024
e5f1783
upd: locators and fix failed tests
fazilqa Mar 12, 2024
2d42ef9
upd: locators and fix failed tests
fazilqa Mar 12, 2024
e3c4798
upd: locators and fix failed tests
fazilqa Mar 12, 2024
1870986
upd: locators and fix failed tests
fazilqa Mar 13, 2024
b4f6b5c
upd: locators and fix failed tests
fazilqa Mar 13, 2024
7843bf9
upd: locators and fix failed tests
fazilqa Mar 13, 2024
20d9637
[MHV-55186] cleanup; added charcount to sm subject input
vsaleem Mar 13, 2024
d12f76e
Merge branch '55186-Update-all-V1-components-to-V6-on-sm-mhv' of http…
vsaleem Mar 13, 2024
ce2fb22
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 15, 2024
5dcbea7
upd: locators and fix failed tests
fazilqa Mar 14, 2024
7340055
upd: temporary skip failed test
fazilqa Mar 14, 2024
2f846eb
upd: unskip the test
fazilqa Mar 15, 2024
d219eab
[MHV-55186] Hotfix to update sm V3 components for release
vsaleem Mar 15, 2024
dc4ddda
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 15, 2024
44954e5
attempt to resolve linting errors
vsaleem Mar 15, 2024
d4fb5cc
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 15, 2024
bc3180e
2nd attempt to fix linting errs
vsaleem Mar 15, 2024
c558765
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 18, 2024
6b4764e
cleanup, added null safety
vsaleem Mar 18, 2024
797fd7d
fix eslint
vsaleem Mar 18, 2024
23d22da
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 18, 2024
fe2c719
[MHV-55186] Added margins between mobile view buttons
vsaleem Mar 18, 2024
6f154d1
cleanup eslint, set dropdown uswds to false
vsaleem Mar 18, 2024
4f4f320
upd: update selectors & refactor
fazilqa Mar 15, 2024
d87023b
upd: update assertions
fazilqa Mar 18, 2024
52e45a4
upd: fix failed test
fazilqa Mar 18, 2024
1ef0dd4
upd: remove skip
fazilqa Mar 18, 2024
9fddf13
[MHV-55186] Removing uswds true tags, no longer needed
vsaleem Mar 18, 2024
0efeccb
Merge branch '55186-Update-all-V1-components-to-V6-on-sm-mhv' of http…
vsaleem Mar 18, 2024
07fc403
Merge branch 'main' into 55186-Update-all-V1-components-to-V6-on-sm-mhv
vsaleem Mar 18, 2024
82d7c10
cleanup
vsaleem Mar 18, 2024
9a08371
cleanup, format components with eslint
vsaleem Mar 18, 2024
b886ef5
cleanup with eslint format
vsaleem Mar 18, 2024
e573e35
cleanup using eslint
vsaleem Mar 18, 2024
fdbb3a6
cleanup files not apart of sm
vsaleem Mar 18, 2024
7320089
cleanup non-sm file
vsaleem Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,6 +1,6 @@
import React, { useEffect, useRef, useState } from 'react';
import PropTypes from 'prop-types';
import recordEvent from 'platform/monitoring/record-event';

Check warning on line 3 in src/applications/mhv/secure-messaging/components/AttachmentsList.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/AttachmentsList.jsx:3:1:Importing from platform via platform/monitoring is deprecated. Import from @department-of-veterans-affairs/platform-monitoring instead or check babel.config.json for an alias to the import.
import { focusElement } from '@department-of-veterans-affairs/platform-utilities/ui';
import { VaAlert } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import RemoveAttachmentModal from './Modals/RemoveAttachmentModal';
Expand Down Expand Up @@ -66,7 +66,7 @@
setAttachFileSuccess(false);
}
},
[attachments],

Check warning on line 69 in src/applications/mhv/secure-messaging/components/AttachmentsList.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/AttachmentsList.jsx:69:5:React Hook useEffect has a missing dependency: 'setAttachFileSuccess'. Either include it or remove the dependency array.
);

const removeAttachment = file => {
Expand Down Expand Up @@ -123,6 +123,8 @@
{attachFileSuccess &&
attachments.length > 0 && (
<VaAlert
closeable
closeBtnAriaLabel="Close notification"
aria-live="polite"
aria-label="file successfully attached"
ref={attachFileAlertRef}
Expand All @@ -133,28 +135,12 @@
full-width="false"
show-icon
status="success"
onCloseEvent={handleSuccessAlertClose}
onCloseEvent={() => {
setAttachFileSuccess(false);
handleSuccessAlertClose();
}}
>
<p className="vads-u-margin-bottom--0">File attached</p>
<button
className="close-success-alert-button vads-u-padding--0p5"
id="close-success-alert-button"
data-testid="close-success-alert-button"
aria-label="Close notification"
type="button"
onClick={() => {
setAttachFileSuccess(false);
handleSuccessAlertClose();
}}
>
<i
className="fas fa-times-circle vads-u-color--black"
style={{ fontSize: '2.4rem' }}
alt="Close notification icon"
aria-hidden="true"
role="presentation"
/>
</button>
<p className="vads-u-margin-y--0">File attached</p>
</VaAlert>
)}

Expand Down Expand Up @@ -186,7 +172,7 @@
<span>{file.name} </span>(
{getSize(file.size || file.attachmentSize)})
</span>
<button

Check warning on line 175 in src/applications/mhv/secure-messaging/components/AttachmentsList.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/AttachmentsList.jsx:175:19:The <va-button> Web Component should be used instead of the button HTML element.
type="button"
onClick={() => {
setIsModalVisible(true);
Expand Down
Expand Up @@ -41,7 +41,6 @@ const CategoryInput = props => {
data-dd-privacy="mask"
data-testid="compose-category-radio-button"
data-dd-action-name="Compose Category Radio Button"
style={{ display: 'flex' }}
key={i}
label={
RadioCategories[item]
Expand Down
Expand Up @@ -148,7 +148,7 @@

useEffect(
() => {
if (recipients.allowedRecipients.length > 0) {
if (recipients?.allowedRecipients?.length > 0) {
setRecipientsList([
...defaultRecipientsList,
...recipients.allowedRecipients,
Expand All @@ -162,7 +162,7 @@
setMessageBody('');
}
},
[recipients, draft],

Check warning on line 165 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:165:5:React Hook useEffect has a missing dependency: 'defaultRecipientsList'. Either include it or remove the dependency array.
);

useEffect(() => {
Expand Down Expand Up @@ -197,7 +197,7 @@
}

// The Blocked Triage Group alert should stay visible until the draft is sent or user navigates away
}, []);

Check warning on line 200 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:200:6:React Hook useEffect has missing dependencies: 'draft' and 'recipients'. Either include them or remove the dependency array.

useEffect(
() => {
Expand Down Expand Up @@ -228,7 +228,7 @@
.catch(setSendMessageFlag(false));
}
},
[sendMessageFlag, isSaving],

Check warning on line 231 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:231:5:React Hook useEffect has missing dependencies: 'attachments', 'category', 'currentFolder?.folderId', 'dispatch', 'draft?.messageId', 'history', 'messageBody', 'selectedRecipient', and 'subject'. Either include them or remove the dependency array.
);

useEffect(
Expand All @@ -246,7 +246,7 @@
focusElement(lastFocusableElement);
}
},
[alertStatus],

Check warning on line 249 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:249:5:React Hook useEffect has a missing dependency: 'lastFocusableElement'. Either include it or remove the dependency array.
);

const recipientExists = recipientId => {
Expand Down Expand Up @@ -442,7 +442,7 @@
}
}
},
[

Check warning on line 445 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:445:5:React Hook useEffect has missing dependencies: 'draft?.body' and 'savedDraft'. Either include them or remove the dependency array.
attachments,
category,
checkMessageValidity,
Expand Down Expand Up @@ -521,7 +521,7 @@
noTimeout();
}
},
[

Check warning on line 524 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:524:5:React Hook useCallback has missing dependencies: 'noTimeout' and 'signOutMessage'. Either include them or remove the dependency array.
draft,
selectedRecipient,
category,
Expand All @@ -541,7 +541,7 @@
noTimeout();
};
},
[beforeUnloadHandler],

Check warning on line 544 in src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv/secure-messaging/components/ComposeForm/ComposeForm.jsx:544:5:React Hook useEffect has a missing dependency: 'noTimeout'. Either include it or remove the dependency array.
);

return (
Expand Down Expand Up @@ -599,7 +599,8 @@
<EditPreferences />

{showBlockedTriageGroupAlert &&
(!noAssociations && !allTriageGroupsBlocked) && (
!noAssociations &&
!allTriageGroupsBlocked && (
<div
className="
vads-u-border-top--1px
Expand All @@ -620,6 +621,7 @@
!allTriageGroupsBlocked && (
<>
<VaSelect
uswds={false}
enable-analytics
id="recipient-dropdown"
label="To"
Expand Down Expand Up @@ -665,6 +667,7 @@
<ViewOnlyDraftSection title={FormLabels.SUBJECT} body={subject} />
) : (
<va-text-input
charcount
label={FormLabels.SUBJECT}
required
type="text"
Expand All @@ -678,8 +681,6 @@
data-dd-privacy="mask"
data-dd-action-name="Compose Message Subject Input Field"
maxlength="50"
uswds
charcount
/>
)}
</div>
Expand Down Expand Up @@ -712,26 +713,26 @@
)}
</div>
{recipientsList &&
(!noAssociations &&
!allTriageGroupsBlocked && (
<section className="attachments-section">
<AttachmentsList
compose
attachments={attachments}
setAttachments={setAttachments}
attachFileSuccess={attachFileSuccess}
setAttachFileSuccess={setAttachFileSuccess}
setNavigationError={setNavigationError}
editingEnabled
/>

<FileInput
attachments={attachments}
setAttachments={setAttachments}
setAttachFileSuccess={setAttachFileSuccess}
/>
</section>
))}
!noAssociations &&
!allTriageGroupsBlocked && (
<section className="attachments-section">
<AttachmentsList
compose
attachments={attachments}
setAttachments={setAttachments}
attachFileSuccess={attachFileSuccess}
setAttachFileSuccess={setAttachFileSuccess}
setNavigationError={setNavigationError}
editingEnabled
/>

<FileInput
attachments={attachments}
setAttachments={setAttachments}
setAttachFileSuccess={setAttachFileSuccess}
/>
</section>
)}

<DraftSavedInfo />
<ComposeFormActionButtons
Expand Down
Expand Up @@ -36,6 +36,7 @@ const CrisisLineConnectButton = () => {

return (
<va-button
class="vads-u-margin-y--1"
secondary="true"
text="Connect with the Veterans Crisis Line"
onClick={e => {
Expand Down
Expand Up @@ -231,6 +231,7 @@ const FrequentlyAskedQuestions = ({ prefLink }) => {
or night.
<br />
<va-button
class="vads-u-margin-y--1"
secondary="true"
text="Connect with the Veterans Crisis Line"
onClick={openCrisisModal}
Expand Down
Expand Up @@ -218,6 +218,7 @@ const ManageFolderButtons = props => {
text="Save"
onClick={confirmRenameFolder}
data-dd-action-name="Save Rename Folder Button"
class="xsmall-screen:vads-u-margin-y--1p5"
/>
<va-button
secondary="true"
Expand Down
Expand Up @@ -173,6 +173,7 @@ const MoveMessageToFolderBtn = props => {
secondary
text="Cancel"
onClick={closeModal}
class="vads-u-margin-left--1p5"
data-dd-action-name="Cancel Move to Button"
/>
</VaModal>
Expand Down
Expand Up @@ -67,10 +67,7 @@ const CernerFacilityAlert = ({ cernerFacilities }) => {
Go to My VA Health (opens in new tab)
</a>

<va-additional-info
trigger="Having trouble opening My VA Health?"
uswds
>
<va-additional-info trigger="Having trouble opening My VA Health?">
<div>Try these steps:</div>
<ul>
<li>Disable your browser’s pop-up blocker</li>
Expand Down
Expand Up @@ -30,7 +30,7 @@ import { threadSortingOptions } from '../../util/constants';

// Arbitrarily set because the VaPagination component has a required prop for this.
// This value dictates how many pages are displayed in a pagination component
const MAX_PAGE_LIST_LENGTH = 5;
const MAX_PAGE_LIST_LENGTH = 7;
const {
SENT_DATE_ASCENDING,
SENT_DATE_DESCENDING,
Expand Down Expand Up @@ -178,7 +178,7 @@ const MessageList = props => {
<div
role="status"
ref={displayingNumberOfMesssagesRef}
className="vads-u-padding-y--1 vads-l-row vads-u-margin-top--2 vads-u-border-top--1px vads-u-border-bottom--1px vads-u-border-color--gray-light"
className="vads-u-padding-y--1 vads-l-row vads-u-margin-top--2 vads-u-background-color--gray-light-alt vads-u-padding-left--1"
>
{`Showing ${displayNums.from} to ${
displayNums.to
Expand Down Expand Up @@ -215,7 +215,7 @@ const MessageList = props => {
onPageSelect={e => onPageChange(e.detail.page)}
page={page}
pages={paginatedMessages.current.length}
maxPageListLength={MAX_PAGE_LIST_LENGTH}
max-page-list-length={MAX_PAGE_LIST_LENGTH}
showLastPage
/>
)}
Expand Down
Expand Up @@ -86,6 +86,7 @@ const CreateFolderModal = props => {
onClick={confirmNewFolder}
data-testid="create-folder-button"
data-dd-action-name="Confirm Create New Folder Button"
class="xsmall-screen:vads-u-margin-y--1p5"
/>
<va-button
secondary="true"
Expand Down
Expand Up @@ -26,14 +26,10 @@ const DeleteDraftModal = props => {
<div className="vads-u-display--flex vads-u-flex-direction--column small-screen:vads-u-flex-direction--row">
<va-button
class="vads-u-padding-right--0 vads-u-padding-bottom--2 small-screen:vads-u-padding-right--2 small-screen:vads-u-padding-bottom--0"
text={unsavedNewDraft ? 'Yes, delete this draft' : 'Delete draft'}
text="Delete draft"
onClick={props.onDelete}
/>
<va-button
secondary
text={unsavedNewDraft ? 'No, continue editing' : 'Cancel'}
onClick={props.onClose}
/>
<va-button secondary text="Cancel" onClick={props.onClose} />
</div>
</VaModal>
);
Expand Down
Expand Up @@ -18,10 +18,7 @@ const DeleteMessageModal = props => {
data-testid="delete-message-modal"
data-dd-action-name="Delete Message Modal Closed"
>
<div
className="modal-body vads-u-padding-bottom--1p5"
data-testid="delete-message-confirm-note"
>
<div className="modal-body" data-testid="delete-message-confirm-note">
<p>{Prompts.Message.DELETE_MESSAGE_CONFIRM_NOTE}</p>
</div>
</VaModal>
Expand Down
Expand Up @@ -87,13 +87,14 @@ const FilterBox = forwardRef((props, ref) => {
</VaModal>
)}

<va-accordion open-single>
<va-accordion-item id="additional-filter-accordion">
<va-accordion uswds={false} open-single>
<va-accordion-item uswds={false} id="additional-filter-accordion">
<h3 slot="headline" className="headline-text">
Add filters
</h3>
<div className="filter-content">
<VaSelect
uswds={false}
id="category-dropdown"
label="Category"
name="category"
Expand All @@ -110,6 +111,7 @@ const FilterBox = forwardRef((props, ref) => {
</VaSelect>

<VaSelect
uswds={false}
id="date-range-dropdown"
label="Date range"
name="dateRange"
Expand Down
Expand Up @@ -258,7 +258,7 @@ const SearchForm = props => {
{!location.pathname.includes(Paths.DRAFTS) && (
<va-additional-info
trigger="What's a message ID?"
class="message-id-info"
class="message-id-info vads-u-margin-y--1p5"
>
A message ID is a number we assign to each message. If you sign up
for email notifications, we’ll send you an email each time you get a
Expand Down
Expand Up @@ -89,7 +89,7 @@ const ThreadListItem = props => {
>
<div className="unread-column vads-l-col">
{activeFolder.folderId !== DefaultFolders.DRAFTS.id &&
(unreadMessages && (
unreadMessages && (
<span>
<i
role="img"
Expand All @@ -99,7 +99,7 @@ const ThreadListItem = props => {
alt="Unread message icon"
/>
</span>
))}
)}
</div>
<div className="vads-l-col vads-u-margin-left--1">
<Link
Expand Down Expand Up @@ -184,7 +184,7 @@ const ThreadListItem = props => {
>
<div className="unread-column vads-l-col">
{activeFolder.folderId !== DefaultFolders.DRAFTS.id &&
(unreadMessages && (
unreadMessages && (
<span>
<i
role="img"
Expand All @@ -195,7 +195,7 @@ const ThreadListItem = props => {
/>
<span className="sr-only">Unread message</span>
</span>
))}
)}
</div>
<div className="vads-l-col vads-u-margin-left--1">
<div className={getClassNames()} data-dd-privacy="mask">
Expand Down
Expand Up @@ -28,6 +28,7 @@ const ThreadListSort = props => {
>
<h2 className="sr-only">Sort conversations</h2>
<VaSelect
uswds={false}
id="sort-order-dropdown"
data-dd-action-name="Sort Order Dropdown"
className="small-screen:vads-u-margin-right--1 vads-u-width--full small-screen:vads-u-flex--1"
Expand Down
Expand Up @@ -94,7 +94,6 @@ const ThreadsList = props => {
onPageSelect={e => paginationCallback(e.detail.page)}
page={pageNum}
pages={Math.ceil(threadList[0]?.threadPageSize / threadsPerPage)}
uswds
/>
)}
</div>
Expand Down
Expand Up @@ -129,7 +129,6 @@ const AlertBackgroundBox = props => {
<>
{activeAlert && (
<VaAlert
uswds
ref={alertRef}
background-only
closeable={props.closeable}
Expand Down
Expand Up @@ -133,6 +133,7 @@ const SmBreadcrumbs = () => {
!crumbs?.label ? 'breadcrumbs--hidden' : ''
}`}
>
{/* We need to redo va-breadcrumbs functionality make it compatible with uswds */}
<va-breadcrumbs
uswds="false"
label="Breadcrumb"
Expand Down
Expand Up @@ -37,7 +37,6 @@ const InterstitialPage = props => {
</p>

<va-button
uswds
data-testid="continue-button"
onClick={acknowledge}
text={continueButtonText}
Expand Down
Expand Up @@ -63,7 +63,7 @@
va-select {

@media (min-width: $small-screen) {
max-width: 225px;
max-width: 250px;
}
}

Expand Down
Expand Up @@ -133,9 +133,7 @@ describe('Delete Draft component', () => {
'visible',
'true',
);
fireEvent.click(
document.querySelector('va-button[text="Yes, delete this draft"]'),
);
fireEvent.click(document.querySelector('va-button[text="Delete draft"]'));
expect(screen.getByTestId('delete-draft-modal')).to.have.attribute(
'visible',
'false',
Expand Down
@@ -1,7 +1,7 @@
import SecureMessagingSite from '../sm_site/SecureMessagingSite';
import PatientInboxPage from '../pages/PatientInboxPage';
import { AXE_CONTEXT, Locators } from '../utils/constants';
import PatientMessageDraftsPage from '../pages/PatientMessageDraftsPage';
import { AXE_CONTEXT, Locators } from '../utils/constants';
import mockMultiDraftsResponse from '../fixtures/draftsResponse/multi-draft-response.json';

describe('re-save multiple drafts in one thread', () => {
Expand Down