-
Notifications
You must be signed in to change notification settings - Fork 128
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
VACMS - 19549 19800 conditional render services select, and loading indicator until CCP services loaded #33784
Merged
eselkin
merged 23 commits into
VACMS-19548-orientation-of-map-controls-fl
from
VACMS-19549-conditional-render-services-select-fl
Jan 16, 2025
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
673714c
get specialties
eselkin 048e1a7
naming
eselkin bc8c8ea
naming - moved
eselkin db2219b
naming - moved
eselkin 211a77a
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 4dbdd26
benefits services removal
eselkin c88802c
fix some tests
eselkin ce4af78
test that may or may not pass?
eselkin 9c4395e
fix widths on va-button
eselkin d8ac30f
merge - really overwrite
eselkin 66439ad
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 75a376f
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin a7faa7e
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin d5a753b
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 3c4ecc3
Merge branch 'VACMS-19549-conditional-render-services-select-fl' of g…
eselkin b27f770
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin ebf36af
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 5828dff
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 708b463
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin c81854e
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin c23b706
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 4588eb3
Merge branch 'VACMS-19548-orientation-of-map-controls-fl' into VACMS-…
eselkin 5a730aa
Vacms 19801 - error message if ppms services get fails (fixed branch)…
eselkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/applications/facility-locator/components/PpmsServiceError.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useEffect, useRef } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { connect } from 'react-redux'; | ||
import { setFocus } from '../utils/helpers'; | ||
|
||
function PpmsServiceError({ currentQuery }) { | ||
const shownAlert = useRef(null); | ||
useEffect( | ||
() => { | ||
if ( | ||
shownAlert.current && | ||
currentQuery?.fetchSvcsError && | ||
!shownAlert.current.hasAttribute('tabindex') | ||
) { | ||
setTimeout(() => { | ||
// We need the timeout because the alert is rendered after the error is set | ||
// and we need to wait for the alert to be rendered before setting focus | ||
// Also, the required field (facilityType) steals focus immediately no matter how it is set | ||
setFocus(shownAlert.current); | ||
}, 50); | ||
} | ||
}, | ||
[shownAlert, currentQuery], | ||
); | ||
if (currentQuery?.fetchSvcsError) { | ||
return ( | ||
<va-alert | ||
status="error" | ||
class="vads-u-margin-bottom--4" | ||
id="fetch-ppms-services-error" | ||
ref={shownAlert} | ||
> | ||
<h2 slot="headline">We’ve run into a problem</h2> | ||
<p className="vads-u-margin-y--0"> | ||
Community provider searches aren’t working right now. Try again later. | ||
</p> | ||
</va-alert> | ||
); | ||
} | ||
return null; | ||
} | ||
|
||
PpmsServiceError.propTypes = { | ||
currentQuery: PropTypes.object, | ||
}; | ||
|
||
const mapStateToProps = state => { | ||
return { | ||
currentQuery: state.searchQuery, | ||
}; | ||
}; | ||
|
||
export default connect(mapStateToProps)(PpmsServiceError); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/applications/facility-locator/components/ServicesLoadingOrShow.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { connect } from 'react-redux'; | ||
import PropTypes from 'prop-types'; | ||
import React, { useEffect, useState } from 'react'; | ||
import { VaLoadingIndicator } from '@department-of-veterans-affairs/component-library/dist/react-bindings'; | ||
import { getProviderSpecialties } from '../actions'; | ||
|
||
function ServicesLoadingOrShow({ | ||
children, | ||
serviceType = '', | ||
currentQuery, | ||
...dispatchProps | ||
}) { | ||
const [loadingMessage, setLoadingMessage] = useState('Loading services'); | ||
useEffect( | ||
() => { | ||
let ignore = false; | ||
if (ignore) return; | ||
switch (serviceType) { | ||
case 'ppms_services': | ||
setLoadingMessage('Loading community provider services'); | ||
dispatchProps.getProviderSpecialties(); | ||
break; | ||
case 'vamc_services': | ||
setLoadingMessage('Loading VAMC services'); | ||
break; | ||
default: | ||
break; | ||
} | ||
// eslint-disable-next-line consistent-return | ||
return () => { | ||
ignore = true; | ||
}; | ||
}, | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ESLint disabled here |
||
[serviceType], | ||
); | ||
if (currentQuery.fetchSvcsInProgress) { | ||
return ( | ||
<VaLoadingIndicator | ||
id="service-type-loading" | ||
message={loadingMessage} | ||
className="vads-u-margin-bottom--2" | ||
/> | ||
); | ||
} | ||
return children; | ||
} | ||
|
||
ServicesLoadingOrShow.propTypes = { | ||
children: PropTypes.node, | ||
currentQuery: PropTypes.object, | ||
serviceType: PropTypes.string, | ||
}; | ||
|
||
const mapDispatch = { getProviderSpecialties }; | ||
|
||
const mapStateToProps = state => { | ||
return { | ||
currentQuery: state.searchQuery, | ||
}; | ||
}; | ||
|
||
export default connect( | ||
mapStateToProps, | ||
mapDispatch, | ||
)(ServicesLoadingOrShow); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ESLint disabled here