Skip to content

Commit

Permalink
Use PageContainer across the app
Browse files Browse the repository at this point in the history
  • Loading branch information
vesnushka committed Dec 2, 2024
1 parent eec11cb commit e6fe2f3
Show file tree
Hide file tree
Showing 36 changed files with 1,117 additions and 1,423 deletions.
2 changes: 1 addition & 1 deletion src/components/DashboardCard/DashboardCard.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const S = {
`,
Card: styled.div`
border-radius: 10px;
background-color: ${({ theme }) => theme.neutralPalette.gray_2};
background-color: ${({ theme }) => theme.neutralPalette.gray_1};
color: ${({ theme }) => theme.neutralPalette.gray_13};
border: 1px solid ${({ theme }) => theme.antdTheme?.colorBorderSecondary};
min-width: fit-content;
Expand Down
29 changes: 0 additions & 29 deletions src/components/PageContainer/index.tsx

This file was deleted.

5 changes: 1 addition & 4 deletions src/components/PatientEncounter/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { t, Trans } from '@lingui/macro';
import { Trans } from '@lingui/macro';
import { Col, Row } from 'antd';
import { ColumnsType } from 'antd/lib/table';
import { Patient } from 'fhir/r4b';
Expand All @@ -11,7 +11,6 @@ import { EncounterData } from 'src/components/EncountersTable/types';
import { StatusBadge } from 'src/components/EncounterStatusBadge';
import { ModalNewEncounter } from 'src/components/ModalNewEncounter';
import { useEncounterList } from 'src/containers/EncounterList/hooks';
import { usePatientHeaderLocationTitle } from 'src/containers/PatientDetails/PatientHeader/hooks';
import { formatPeriodDateTime } from 'src/utils/date';
import { renderHumanName } from 'src/utils/fhir';

Expand Down Expand Up @@ -76,8 +75,6 @@ export const PatientEncounter = ({ patient, searchParams, hideCreateButton }: Pr
...searchParams,
});

usePatientHeaderLocationTitle({ title: t`Encounters` });

return (
<>
{hideCreateButton ? null : (
Expand Down
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export * from './ModalNewEncounter';
export * from './ModalNewHealthcareService';
export * from './ModalNewPatient';
export * from './ModalTrigger';
export * from './PageContainer';
export * from './PatientEncounter';
export * from './QuestionnaireResponseForm';
export * from './QuestionnairesWizard';
Expand Down
3 changes: 0 additions & 3 deletions src/containers/Appointment/PublicAppointment.styles.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import styled from 'styled-components';

import { BasePageHeader } from 'src/components/BaseLayout';

export const S = {
Header: styled(BasePageHeader)``,
Content: styled.div`
width: 540px;
background-color: ${({ theme }) => theme.antdTheme?.colorBgContainer};
Expand Down
77 changes: 34 additions & 43 deletions src/containers/Appointment/PublicAppointment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ import { axiosInstance as axiosAidboxInstance } from 'aidbox-react/lib/services/

import { uuid4 } from '@beda.software/fhir-react';

import { BasePageContent } from 'src/components/BaseLayout';
import { PageContainer } from 'src/components/BaseLayout/PageContainer';
import { DateTimeSlotPicker } from 'src/components/BaseQuestionnaireResponseForm/widgets';
import { QuestionnaireResponseForm } from 'src/components/QuestionnaireResponseForm';
import { Spinner } from 'src/components/Spinner';
import { Title } from 'src/components/Typography';
import { questionnaireIdLoader } from 'src/hooks/questionnaire-response-form-data';
import { getToken } from 'src/services/auth';
import { axiosInstance as axiosFHIRInstance } from 'src/services/fhir';
Expand Down Expand Up @@ -42,47 +41,39 @@ export function PublicAppointment() {
}, [isAnonymousUser]);

return (
<>
<S.Header>
<Title>
<Trans>Appointment booking</Trans>
</Title>
</S.Header>

<BasePageContent style={{ alignItems: 'center' }}>
<S.Content>
{isLoading ? (
<Spinner />
) : (
<QuestionnaireResponseForm
questionnaireLoader={questionnaireIdLoader('public-appointment')}
onSuccess={() => {
notification.success({
message: t`Appointment successfully created`,
});
history.replace('/');
}}
itemControlQuestionItemComponents={{
'date-time-slot': (props) => (
<DateTimeSlotPicker {...props} practitionerRolePath={practitionerRolePath} />
),
}}
initialQuestionnaireResponse={{
questionnaire: 'public-appointment',
}}
launchContextParameters={[
{
name: 'Patient',
resource: {
resourceType: 'Patient',
id: uuid4(),
},
<PageContainer title={<Trans>Appointment booking</Trans>} content={{ style: { alignItems: 'center' } }}>
<S.Content>
{isLoading ? (
<Spinner />
) : (
<QuestionnaireResponseForm
questionnaireLoader={questionnaireIdLoader('public-appointment')}
onSuccess={() => {
notification.success({
message: t`Appointment successfully created`,
});
history.replace('/');
}}
itemControlQuestionItemComponents={{
'date-time-slot': (props) => (
<DateTimeSlotPicker {...props} practitionerRolePath={practitionerRolePath} />
),
}}
initialQuestionnaireResponse={{
questionnaire: 'public-appointment',
}}
launchContextParameters={[
{
name: 'Patient',
resource: {
resourceType: 'Patient',
id: uuid4(),
},
]}
/>
)}
</S.Content>
</BasePageContent>
</>
},
]}
/>
)}
</S.Content>
</PageContainer>
);
}
3 changes: 0 additions & 3 deletions src/containers/EncounterDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { Spinner } from 'src/components/Spinner';
import { Text } from 'src/components/Typography';
import { DocumentsList } from 'src/containers/DocumentsList';
import { ChooseDocumentToCreateModal } from 'src/containers/DocumentsList/ChooseDocumentToCreateModal';
import { usePatientHeaderLocationTitle } from 'src/containers/PatientDetails/PatientHeader/hooks';
import { questionnaireIdLoader } from 'src/hooks/questionnaire-response-form-data';

import { AIScribe, useAIScribe } from './AIScribe';
Expand All @@ -35,8 +34,6 @@ export const EncounterDetails = (props: EncounterDetailsProps) => {
const [documentListKey, setDocumentListKey] = useState(0);
const reload = useCallback(() => setDocumentListKey((k) => k + 1), [setDocumentListKey]);

usePatientHeaderLocationTitle({ title: t`Consultation` });

const [showScriber, setShowScriber] = useState(false);
const { recorderControls } = useAIScribe();

Expand Down
45 changes: 21 additions & 24 deletions src/containers/EncounterList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { Trans } from '@lingui/macro';
import { Col, Row } from 'antd';
import { Link } from 'react-router-dom';

import { BasePageContent, BasePageHeader } from 'src/components/BaseLayout';
import { PageContainer } from 'src/components/BaseLayout/PageContainer';
import { EncountersTable } from 'src/components/EncountersTable';
import { EncounterData } from 'src/components/EncountersTable/types';
import { StatusBadge } from 'src/components/EncounterStatusBadge';
import { SearchBar } from 'src/components/SearchBar';
import { useSearchBar } from 'src/components/SearchBar/hooks';
import { Title } from 'src/components/Typography';
import { formatPeriodDateTime } from 'src/utils/date';
import { renderHumanName } from 'src/utils/fhir';
import { matchCurrentUserRole, Role } from 'src/utils/role';
Expand Down Expand Up @@ -97,27 +96,25 @@ export function EncounterList() {
];

return (
<>
<BasePageHeader style={{ paddingTop: 40, paddingBottom: 92 }}>
<Title style={{ marginBottom: 40 }}>
<Trans>Encounters</Trans>
</Title>

<SearchBar
columnsFilterValues={columnsFilterValues}
onChangeColumnFilter={onChangeColumnFilter}
onResetFilters={onResetFilters}
/>
</BasePageHeader>

<BasePageContent style={{ marginTop: '-55px', paddingTop: 0 }}>
<EncountersTable
columns={columns}
remoteData={encounterDataListRD}
handleTableChange={handleTableChange}
pagination={pagination}
/>
</BasePageContent>
</>
<PageContainer
variant="with-table"
title={<Trans>Encounters</Trans>}
header={{
children: (
<SearchBar
columnsFilterValues={columnsFilterValues}
onChangeColumnFilter={onChangeColumnFilter}
onResetFilters={onResetFilters}
/>
),
}}
>
<EncountersTable
columns={columns}
remoteData={encounterDataListRD}
handleTableChange={handleTableChange}
pagination={pagination}
/>
</PageContainer>
);
}
Loading

0 comments on commit e6fe2f3

Please sign in to comment.