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) O3-4052: Wrap SideNavMenu title in t function #1928

Merged
merged 6 commits into from
Oct 14, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import {
TableHeader,
TableRow,
} from '@carbon/react';
import { useTranslation } from 'react-i18next';

export const TableEmptyState: React.FC<{ tableHeaders: Array<{ key: string; header: string }>; message: string }> = ({
tableHeaders,
message,
}) => {
const { t } = useTranslation();
return (
<div style={{ marginLeft: '-16px' }}>
<DataTable rows={[]} headers={tableHeaders} isSortable={true} size="short" useZebraStyles={true}>
Expand All @@ -29,14 +31,14 @@ export const TableEmptyState: React.FC<{ tableHeaders: Array<{ key: string; head
isSortable: header.isSortable,
})}
>
{header.header?.content ?? header.header}
{t(header.header?.content ?? header.header)}
</TableHeader>
))}
</TableRow>
</TableHead>
<TableBody>
<TableRow>
<TableCell colSpan={tableHeaders.length}>{message}</TableCell>
<TableCell colSpan={tableHeaders.length}>{t(message)}</TableCell>
</TableRow>
</TableBody>
</Table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const EncounterList: React.FC<EncounterListProps> = ({
{actions.map((actionItem, index) => (
<OverflowMenuItem
index={index}
itemText={actionItem.label}
itemText={t(actionItem.label)}
onClick={(e) => {
e.preventDefault();
actionItem.mode == 'delete'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,12 @@ const tileTestProps = {
headerTitle: 'Test header title',
};

jest.mock('@openmrs/esm-framework', () => {
const originalModule = jest.requireActual('@openmrs/esm-framework');
return {
...originalModule,
openmrsFetch: jest.fn(),
};
});
const mockOpenmrsFetch = openmrsFetch as jest.Mock;
mockOpenmrsFetch.mockImplementation(jest.fn());

const mockUseLastEncounter = useLastEncounter as jest.Mock;
jest.mock('../../hooks/useLastEncounter');

const mockOpenmrsFetch = openmrsFetch as jest.Mock;

describe('Encounter tile component', () => {
beforeEach(() => {
jest.clearAllMocks();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Tabs, Tab, TabList, TabPanels, TabPanel } from '@carbon/react';
import { CohortPatientList } from '../cohort-patient-list/cohort-patient-list.component';

import styles from './ohri-patient-list-tabs.scss';

export function OHRIPatientListTabs({ patientListConfigs, moduleName }) {
const { t } = useTranslation();
const [activeTabIndex, setActiveTabIndex] = useState(0); // State to track active tab index
const handleTabChange = ({selectedIndex}) => {
setActiveTabIndex(selectedIndex);
Expand All @@ -15,7 +17,7 @@ export function OHRIPatientListTabs({ patientListConfigs, moduleName }) {
{patientListConfigs.map((config, index) => {
return (
<Tab key={index} id={config.cohortId}>
{config.label}
{t(config.label)}
</Tab>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export const PatientTable: React.FC<PatientTableProps> = ({
})}
className={isDesktop(layout) ? styles.desktopHeader : styles.tabletHeader}
>
{header.header?.content ?? header.header}
{t(header.header?.content ?? header.header)}
</TableHeader>
))}
</TableRow>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function DashboardExtension({ dashboardLinkConfig }: { dashboardLinkConfig: Dash
if (isFolder) {
return (
<SideNavItems>
<SideNavMenu title={folderTitle} renderIcon={folderIcon}>
<SideNavMenu title={t(folderTitle)} renderIcon={folderIcon}>
<ConfigurableLink
className={classNames('cds--side-nav__link', {
'active-left-nav-link': navLink.match(name),
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-commons-lib/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"es2015.promise",
"es2016.array.include",
"es2018",
"es2020"
"es2020",
"es2022"
],
"resolveJsonModule": true,
"noEmit": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function CTSummaryTiles() {
{
title: t('missedAppointments', 'Missed appointments'),
linkAddress: '#',
subTitle: '0-30 days',
subTitle: t('zeroToThirtyDays', '0-30 days'),
value: 50,
},
{
Expand Down
3 changes: 2 additions & 1 deletion packages/esm-hiv-care-treatment-app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"missedAppointments": "Rendez-vous manqués",
"noDrugsPickedLast90days": "Aucun médicament pris, 90 derniers jours",
"patientsInClinicPopulation": "Patients dans la population de la clinique",
"suspectedLTFU": "LTFU suspecté"
"suspectedLTFU": "LTFU suspecté",
"zeroToThirtyDays": "0-30 jours"
}
Loading
Loading