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

Fix: Back to search results button functionality #1044

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
useConfig,
type ConfigObject,
} from '@openmrs/esm-framework';
import { ArrowLeft } from '@carbon/react/icons';
import { type Appointment, SearchTypes } from '../types';
import styles from './patient-scheduled-visits.scss';
import { useScheduledVisits } from './hooks/useScheduledVisits';
Expand Down Expand Up @@ -293,6 +294,16 @@ const PatientScheduledVisits: React.FC<PatientScheduledVisitsProps> = ({

return (
<div className={styles.container}>
<div className={styles.backButton}>
<Button
kind="ghost"
renderIcon={(props) => <ArrowLeft size={24} {...props} />}
iconDescription={t('backToSearchResult', 'Back to search result')}
size="sm"
onClick={closePanel}>
Copy link
Member

Choose a reason for hiding this comment

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

This would seem to indicate that clicking on this button will close the entire overlay / search panel entirely, not actually return to the search result. If the goal is to return to the search result, can you show that this is what this does?

<span>{t('backToSearchResult', 'Back to search result')}</span>
</Button>
</div>
<ScheduledVisits
visitType={visitType.RECENT}
visits={appointments?.recentVisits}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { addQueueEntry, useVisitQueueEntries } from '../../active-visits/active-
import { convertTime12to24, type amPm } from '../../helpers/time-helpers';
import { MemoizedRecommendedVisitType } from './recommended-visit-type.component';
import { useActivePatientEnrollment } from '../hooks/useActivePatientEnrollment';
import { SearchTypes, type PatientProgram, type NewVisitPayload } from '../../types';
import { type SearchTypes, type PatientProgram, type NewVisitPayload } from '../../types';
import styles from './visit-form.scss';
import { useDefaultLoginLocation } from '../hooks/useDefaultLocation';
import isEmpty from 'lodash-es/isEmpty';
Expand Down Expand Up @@ -203,10 +203,10 @@ const StartVisitForm: React.FC<VisitFormProps> = ({ patientUuid, toggleSearchTyp
<Button
kind="ghost"
renderIcon={(props) => <ArrowLeft size={24} {...props} />}
iconDescription={t('backToScheduledVisits', 'Back to scheduled visits')}
iconDescription={t('backToSearchResult', 'Back to search result')}
size="sm"
onClick={() => toggleSearchType(SearchTypes.SCHEDULED_VISITS, patientUuid)}>
<span>{t('backToScheduledVisits', 'Back to scheduled visits')}</span>
onClick={closePanel}>
<span>{t('backToSearchResult', 'Back to search result')}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Same here. Does the "closePanel" function actually return you to the search result? Or does it close the panel entirely? If it closes the panel, this would seem incorrect.

</Button>
)}
</div>
Expand Down