Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Adjust claim website validation and display
Browse files Browse the repository at this point in the history
Make some changes suggested in
#647 (comment)
to:

- outline an invalid website string in red on the claim form
- make the claim's submitted website clickable when displayed on the
admin dashboard

Also use the addProtocolToWebsiteURLIfMissing function on the LinkedIn
url displayed on the dashboard.
  • Loading branch information
Kelly Innes committed Jul 9, 2019
1 parent 88b517d commit df94afc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/app/src/components/ClaimFacilityFacilityInfoStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Typography from '@material-ui/core/Typography';
import TextField from '@material-ui/core/TextField';
import InputLabel from '@material-ui/core/InputLabel';
import isEmpty from 'lodash/isEmpty';
import { isURL } from 'validator';
import Select from 'react-select';

import RequiredAsterisk from './RequiredAsterisk';
Expand Down Expand Up @@ -108,6 +109,7 @@ function ClaimFacilityFacilityInfoStep({
</InputLabel>
<TextField
id={websiteFormField.id}
error={!isEmpty(website) && !isURL(website)}
variant="outlined"
style={claimAFacilityFormStyles.textFieldStyles}
value={website}
Expand Down
19 changes: 17 additions & 2 deletions src/app/src/components/DashboardClaimsDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { facilityClaimPropType } from '../util/propTypes';
import {
makeProfileRouteLink,
makeFacilityDetailLink,
addProtocolToWebsiteURLIfMissing,
} from '../util/util';

const dashboardClaimsDetailsStyles = Object.freeze({
Expand Down Expand Up @@ -149,7 +150,17 @@ function DashboardClaimsDetails({
/>
<InfoSection
label="Website"
value={data.website}
value={
data.website && (
<a
href={addProtocolToWebsiteURLIfMissing(data.website)}
target="_blank"
rel="noopener noreferrer"
>
{data.website}
</a>
)
}
/>
<InfoSection
label="Facility Parent Company"
Expand Down Expand Up @@ -184,7 +195,11 @@ function DashboardClaimsDetails({
label="LinkedIn Profile"
value={
data.linkedin_profile && (
<a href={data.linkedin_profile}>
<a
href={addProtocolToWebsiteURLIfMissing(data.linkedin_profile)}
target="_blank"
rel="noopener noreferrer"
>
{data.linkedin_profile}
</a>
)
Expand Down

0 comments on commit df94afc

Please sign in to comment.