Skip to content

Commit

Permalink
WIP Update containers structure
Browse files Browse the repository at this point in the history
Refs: #230
  • Loading branch information
atuonufure committed Feb 28, 2024
1 parent 3f25c7a commit 39c616a
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ export function GeneralInformationDashboard({ patientDetails, props }: Props) {
</DashboardCard>
);
}

GeneralInformationDashboard.displayName = 'GeneralInformation';
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ export function StandardCard({ card }: Props) {
</DashboardCard>
);
}

StandardCard.displayName = 'StandardCard';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Patient } from 'fhir/r4b';

import { CreatinineDashoboard } from 'src/components/DashboardCard/creatinine';
import { useCreatinineDashoboard } from 'src/containers/PatientDetails/PatientOverviewDynamic/hooks/useCreatinineDashoboard';
import { useCreatinineDashoboard } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/CreatinineDashoboardContainer/hooks';
import { WidgetInfo } from 'src/contexts/PatientDashboardContext';

interface CreatinineDashoboardContainerProps {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Patient } from 'fhir/r4b';

import { CreatinineDashoboardContainer } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/CreatinineDashoboardContainer';
import { StandardCardContainer } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/StandardCardContainer';
import { WidgetInfo } from 'src/contexts/PatientDashboardContext';

const widgetComponents = {
CreatinineDashoboard: CreatinineDashoboardContainer,
StandardCard: StandardCardContainer,
};

interface Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Patient } from 'fhir/r4b';

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

export function useStandardCard(patient: Patient, searchParams: SearchParams) {
return { patient, searchParams };
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Patient } from 'fhir/r4b';

import { WidgetInfo } from 'src/contexts/PatientDashboardContext';

import { useStandardCard } from './hooks';

interface StandardCardContainerProps {
patient: Patient;
widgetInfo: WidgetInfo;
}

export function StandardCardContainer({ patient, widgetInfo }: StandardCardContainerProps) {
const searchParams = widgetInfo.query.search;
useStandardCard(patient, searchParams);

return <div style={{ color: '#ff0000' }}>{JSON.stringify(searchParams)}</div>;
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Patient } from 'fhir/r4b';
import { useContext } from 'react';

import { Dashboards } from 'src/containers/PatientDetails/PatientOverviewDynamic/components/Dashboards';
import { Dashboards } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/Dashboards';
import { PatientDashboardContext } from 'src/contexts/PatientDashboardContext';

import s from './PatientOverview.module.scss';
Expand Down
95 changes: 90 additions & 5 deletions src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import { dynamicActivate, getCurrentLocale } from 'shared/src/services/i18n';

import 'antd/dist/reset.css';
import 'src/styles/index.scss';
import 'shared/src/services/i18n';

import { CreatinineDashoboard } from 'src/components/DashboardCard/creatinine';
import { App } from 'src/containers/App';
import { StandardCard } from 'src/containers/PatientDetails/PatientOverviewDynamic/components/StandardCard';
import { PatientDashboardProvider } from 'src/contexts/PatientDashboardContext';

import * as serviceWorker from './serviceWorker';
Expand All @@ -23,20 +23,105 @@ export const dashboard = {
// TODO WIP
default: {
top: [
{
query: {
resourceType: 'Observation',
search: {
text: 'TOP CARD 1',
},
},
widget: StandardCard,
},
{
query: {
resourceType: 'Observation',
search: {
text: 'TOP CARD 2',
},
},
widget: StandardCard,
},
{
query: {
resourceType: 'Observation',
search: {
code: 'http://loinc.org|2160-0',
_sort: ['-date'],
},
},
widget: CreatinineDashoboard,
},
{
query: {
resourceType: 'Observation',
search: {
text: 'TOP CARD 3',
},
},
widget: StandardCard,
},
{
query: {
resourceType: 'Observation',
search: {
code: 'http://loinc.org|2160-0',
_sort: ['date'],
_sort: ['-date'],
},
},
widget: CreatinineDashoboard,
},
],
right: [],
left: [],
bottom: [],
right: [
{
query: {
resourceType: 'Observation',
search: {
text: 'RIGHT CARD 1',
},
},
widget: StandardCard,
},
{
query: {
resourceType: 'Observation',
search: {
text: 'RIGHT CARD 2',
},
},
widget: StandardCard,
},
{
query: {
resourceType: 'Observation',
search: {
text: 'RIGHT CARD 3',
},
},
widget: StandardCard,
},
],
left: [
{
query: {
resourceType: 'Observation',
search: {
text: 'LEFT CARD 1',
},
},
widget: StandardCard,
},
],
bottom: [
{
query: {
resourceType: 'Observation',
search: {
text: 'BOTTOM CARD 1',
},
},
widget: StandardCard,
},
],
},
// [Role.Admin]: {},
// [Role.Practitioner]: {},
Expand Down

0 comments on commit 39c616a

Please sign in to comment.