Skip to content

Commit

Permalink
(fix) Fix React missing prop warning
Browse files Browse the repository at this point in the history
  • Loading branch information
denniskigen committed Oct 23, 2024
1 parent fe14d60 commit 37dd2aa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Dropdown } from '@carbon/react';
import MetricsCard from './metrics-card.component';
import MetricsHeader from './metrics-header.component';
import { isDesktop, useLayoutType } from '@openmrs/esm-framework';
import { updateSelectedService, useSelectedService, useSelectedQueueLocationUuid } from '../helpers/helpers';
import { useActiveVisits, useAverageWaitTime } from './clinic-metrics.resource';
import { useServiceMetricsCount } from './queue-metrics.resource';
import styles from './clinic-metrics.scss';
import { useQueues } from '../hooks/useQueues';
import { useQueueEntries } from '../hooks/useQueueEntries';
import MetricsCard from './metrics-card.component';
import MetricsHeader from './metrics-header.component';
import useQueueServices from '../hooks/useQueueService';
import { isDesktop, useLayoutType } from '@openmrs/esm-framework';
import styles from './clinic-metrics.scss';

export interface Service {
uuid: string;
Expand Down Expand Up @@ -64,13 +63,14 @@ function ClinicMetrics() {
locationUuid={currentQueueLocation}>
<Dropdown
id="inline"
type="inline"
items={[{ display: `${t('all', 'All')}` }, ...(services ?? [])]}
itemToString={(item) =>
item ? `${item.display} ${item.location?.display ? `- ${item.location.display}` : ''}` : ''
}
label=""
onChange={handleServiceChange}
size={isDesktop(layout) ? 'sm' : 'lg'}
type="inline"
/>
</MetricsCard>
<MetricsCard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { ComboButton, MenuItem } from '@carbon/react';
import {
UserHasAccess,
Expand All @@ -8,22 +10,29 @@ import {
useLayoutType,
useSession,
} from '@openmrs/esm-framework';
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { spaBasePath } from '../constants';
import styles from './metrics-header.scss';

const MetricsHeader = () => {
const { t } = useTranslation();
const currentUserSession = useSession();
const layout = useLayoutType();

const metricsTitle = t('clinicMetrics', 'Clinic metrics');
const queueScreenText = t('queueScreen', 'Queue screen');
const currentUserSession = useSession();
const providerUuid = currentUserSession?.currentProvider?.uuid;
const layout = useLayoutType();

const navigateToQueueScreen = () => {
const launchAddProviderToRoomModal = useCallback(() => {
const dispose = showModal('add-provider-to-room-modal', {
closeModal: () => dispose(),
providerUuid,
});
}, [providerUuid]);

const navigateToQueueScreen = useCallback(() => {
navigate({ to: `${spaBasePath}/service-queues/screen` });
};
}, []);

return (
<div className={styles.metricsContainer}>
<span className={styles.metricsTitle}>{metricsTitle}</span>
Expand All @@ -44,15 +53,7 @@ const MetricsHeader = () => {
onClick={() => launchWorkspace('service-queues-room-form')}
/>
</UserHasAccess>
<MenuItem
label={t('addProviderQueueRoom', 'Add provider queue room')}
onClick={() => {
const dispose = showModal('add-provider-to-room-modal', {
closeModal: () => dispose(),
providerUuid,
});
}}
/>
<MenuItem label={t('addProviderQueueRoom', 'Add provider queue room')} onClick={launchAddProviderToRoomModal} />
</ComboButton>
</div>
);
Expand Down

0 comments on commit 37dd2aa

Please sign in to comment.