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

Add link to facility name for Appointments Details pages #33790

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/applications/vaos/components/layout/ClaimExamLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export default function ClaimExamLayout({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jenniemc since you looked at the spike ticket for this work item, do you know if it's ever possible that a facility will be missing the website attribute? I'm wondering if we need to add a condition to check for that to make sure we don't display a link that doesn't actually navigate anywhere.

<br />
<Address address={facility?.address} />
<div className="vads-u-margin-top--1 vads-u-color--link-default">
Expand Down Expand Up @@ -143,7 +143,7 @@ export default function ClaimExamLayout({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
{facilityPhone && (
<FacilityPhone heading="Phone:" contact={facilityPhone} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { expect } from 'chai';
import moment from 'moment';

Check warning on line 3 in src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js:3:1:Use date-fns or Native Date methods instead of moment.js
import {
createTestStore,
renderWithStoreAndRouter,
Expand All @@ -25,6 +25,8 @@
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -318,6 +320,11 @@
screen.getByRole('heading', { level: 2, name: /Where to attend/i }),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.getByText(/2360 East Pershing Boulevard/i));

expect(screen.container.querySelector('va-icon[icon="directions"]')).to.be
Expand Down Expand Up @@ -395,7 +402,7 @@
isCompAndPenAppointment: true,
isPastAppointment: true,
apiData: {
localStartTime: moment()

Check warning on line 405 in src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js:405:29:Consider using date-fns subDays(date, amount) or dayjs().subtract(number, unit)

Check warning on line 405 in src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js:405:29:Consider using Native new Date().
.subtract(1, 'day')
.format('YYYY-MM-DDTHH:mm:ss'),
serviceType: 'primaryCare',
Expand Down Expand Up @@ -494,7 +501,7 @@
isCompAndPenAppointment: true,
isUpcomingAppointment: true,
apiData: {
localStartTime: moment().format('YYYY-MM-DDTHH:mm:ss'),

Check warning on line 504 in src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js:504:29:Consider using date-fns format(date, format) or dayjs().format()

Check warning on line 504 in src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/ClaimExamLayout.unit.spec.js:504:29:Consider using Native new Date().
serviceType: 'primaryCare',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function InPersonLayout({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<Address address={facility?.address} />
<div className="vads-u-margin-top--1 vads-u-color--link-default">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { expect } from 'chai';
import moment from 'moment';

Check warning on line 3 in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/InPersonLayout.unit.spec.js:3:1:Use date-fns or Native Date methods instead of moment.js
import {
createTestStore,
renderWithStoreAndRouter,
Expand All @@ -25,6 +25,8 @@
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -320,6 +322,11 @@
screen.getByRole('heading', { level: 2, name: /Where to attend/i }),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.getByText(/2360 East Pershing Boulevard/i));

expect(screen.container.querySelector('va-icon[icon="directions"]')).to.be
Expand Down Expand Up @@ -499,7 +506,7 @@
isPastAppointment: true,
isCancellable: true,
apiData: {
localStartTime: moment()

Check warning on line 509 in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/InPersonLayout.unit.spec.js:509:29:Consider using date-fns subDays(date, amount) or dayjs().subtract(number, unit)

Check warning on line 509 in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/InPersonLayout.unit.spec.js:509:29:Consider using Native new Date().
.subtract(1, 'day')
.format('YYYY-MM-DDTHH:mm:ss'),
serviceType: 'primaryCare',
Expand Down Expand Up @@ -591,7 +598,7 @@
vaos: {
isUpcomingAppointment: true,
apiData: {
localStartTime: moment().format('YYYY-MM-DDTHH:mm:ss'),

Check warning on line 601 in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/InPersonLayout.unit.spec.js:601:29:Consider using date-fns format(date, format) or dayjs().format()

Check warning on line 601 in src/applications/vaos/components/layout/InPersonLayout.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/components/layout/InPersonLayout.unit.spec.js:601:29:Consider using Native new Date().
serviceType: 'primaryCare',
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/applications/vaos/components/layout/PhoneLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default function PhoneLayout({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<Address address={facility?.address} />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('VAOS Component: PhoneLayout', () => {
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -243,6 +245,11 @@ describe('VAOS Component: PhoneLayout', () => {
}),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.getByText(/2360 East Pershing Boulevard/i));
expect(screen.container.querySelector('va-icon[icon="directions"]')).not
.to.exist;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function VARequestLayout({ data: appointment }) {
)}
{!!facility?.name && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ describe('VAOS Component: VARequestLayout', () => {
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -112,6 +114,11 @@ describe('VAOS Component: VARequestLayout', () => {

expect(screen.getByRole('heading', { level: 2, name: /Facility/i }));
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.getByText(/2360 East Pershing Boulevard/i));

expect(screen.container.querySelector('va-icon[icon="directions"]')).to.be
Expand Down
4 changes: 2 additions & 2 deletions src/applications/vaos/components/layout/VideoLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function VideoLayout({ data: appointment }) {
<Section heading="Scheduling facility">
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<span>
{address.city}, <State state={address.state} />
Expand Down Expand Up @@ -140,7 +140,7 @@ export default function VideoLayout({ data: appointment }) {
<br />
{facility ? (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<span>
{address.city}, <State state={address.state} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('VAOS Component: VideoLayout', () => {
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -276,6 +278,11 @@ describe('VAOS Component: VideoLayout', () => {
}),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.queryByText(/2360 East Pershing Boulevard/i)).not.to.exist;

expect(screen.getByText(/Clinic: Clinic 1/i));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default function VideoLayoutAtlas({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<ClinicOrFacilityPhone
clinicPhone={clinicPhone}
Expand Down Expand Up @@ -156,7 +156,7 @@ export default function VideoLayoutAtlas({ data: appointment }) {
<br />
{facility ? (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<span>
{address.city}, <State state={address.state} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('VAOS Component: VideoLayoutAtlas', () => {
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -354,6 +356,11 @@ describe('VAOS Component: VideoLayoutAtlas', () => {
}),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.queryByText(/2360 East Pershing Boulevard/i)).not.to.exist;
expect(screen.container.querySelector('va-icon[icon="directions"]')).to.be
.ok;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export default function VideoLayoutVA({ data: appointment }) {
)}
{!!facility && (
<>
{facility.name}
<a href={facility.website}>{facility.name}</a>
<br />
<Address address={facility?.address} />
<div className="vads-u-margin-top--1 vads-u-color--link-default">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ describe('VAOS Component: VideoLayoutVA', () => {
value: '307-778-7550',
},
],
website:
'https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/',
},
},
},
Expand Down Expand Up @@ -379,6 +381,11 @@ describe('VAOS Component: VideoLayoutVA', () => {
}),
);
expect(screen.getByText(/Cheyenne VA Medical Center/i));
expect(
screen.container.querySelector(
'a[href="https://www.va.gov/cheyenne-health-care/locations/cheyenne-va-medical-center/"]',
),
).to.be.ok;
expect(screen.getByText(/2360 East Pershing Boulevard/i));
expect(screen.container.querySelector('va-icon[icon="directions"]')).to
.be.ok;
Expand Down
1 change: 1 addition & 0 deletions src/applications/vaos/services/location/transformers.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export function transformFacilityV2(facility) {
state: facility.physicalAddress.state,
postalCode: facility.physicalAddress.postalCode,
},
website: facility.website,
};
}

Expand Down
Loading