Skip to content

Commit

Permalink
(fix): Wrap page header in t function (#226)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Kigen <[email protected]>
  • Loading branch information
NethmiRodrigo and denniskigen authored Nov 21, 2024
1 parent 46ce473 commit 83a1141
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from 'react';
import { useParams } from 'react-router-dom';
import { useLayoutType, isDesktop, useExtensionStore, ExtensionSlot, WorkspaceContainer } from '@openmrs/esm-framework';
import DashboardView from './dashboard-view.component';
import type { DashboardConfig } from '../types/index';
import DashboardView from './dashboard-view.component';
import styles from './home-dashboard.scss';

export default function HomeDashboard() {
const params = useParams();
const extensionStore = useExtensionStore();
const layout = useLayoutType();

const ungroupedDashboards =
extensionStore.slots['homepage-dashboard-slot']?.assignedExtensions
.map((e) => e.meta)
Expand Down
12 changes: 2 additions & 10 deletions packages/esm-home-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { registerBreadcrumbs, defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { defineConfigSchema, getAsyncLifecycle, getSyncLifecycle } from '@openmrs/esm-framework';
import { createDashboardLink } from './createDashboardLink.component';
import { dashboardMeta } from './dashboard.meta';
import { esmHomeSchema } from './openmrs-esm-home-schema';
import rootComponent from './root.component';
import homeNavMenuComponent from './side-menu/side-menu.component';
import homeWidgetDashboardComponent from './home-page-widgets/home-page-widgets.component';
import rootComponent from './root.component';

const moduleName = '@openmrs/esm-home-app';
const pageName = 'home';
Expand All @@ -30,12 +30,4 @@ export const metrics = getAsyncLifecycle(() => import('./metrics/metrics.compone

export function startupApp() {
defineConfigSchema(moduleName, esmHomeSchema);
// t('home', 'Home');

registerBreadcrumbs([
{
path: `${window.spaBase}/${pageName}`,
title: () => Promise.resolve(window.i18next.t('home', { defaultValue: 'Home', ns: moduleName })),
},
]);
}
11 changes: 9 additions & 2 deletions packages/esm-home-app/src/page-header/page-header.component.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import React from 'react';
import { PageHeader, HomePictogram } from '@openmrs/esm-framework';
import { useTranslation } from 'react-i18next';
import { HomePictogram, PageHeader } from '@openmrs/esm-framework';
import styles from './page-header.scss';

interface PageHeaderProps {
dashboardTitle: string;
}

const HomePageHeader: React.FC<PageHeaderProps> = ({ dashboardTitle }) => {
return <PageHeader illustration={<HomePictogram />} title={dashboardTitle} className={styles.pageHeader} />;
const { t } = useTranslation();

/**
* Translation for the home page header
* // t('home', 'Home')
*/
return <PageHeader className={styles.pageHeader} illustration={<HomePictogram />} title={t(dashboardTitle)} />;
};

export default HomePageHeader;

0 comments on commit 83a1141

Please sign in to comment.