Commit 2c549018 authored by Matija Obreza's avatar Matija Obreza
Browse files

Fix: Page title component should not use t()

parent 170aa79b
import * as React from 'react'; import * as React from 'react';
import { WithTranslation, withTranslation } from 'react-i18next';
import { Helmet } from 'react-helmet-async'; import { Helmet } from 'react-helmet-async';
import { stripHtml } from '@genesys/client/utilities'; import { stripHtml } from '@genesys/client/utilities';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { WithConfig } from 'config/config'; import { WithConfig } from 'config/config';
interface IPageTitle extends React.ClassAttributes<any>, WithTranslation { interface IPageTitle extends React.ClassAttributes<any> {
title: string; title: string;
description?: string; description?: string;
} }
class PageTitle extends React.Component<IPageTitle & WithConfig, any> { class PageTitle extends React.Component<IPageTitle & WithConfig, any> {
public constructor(props, context) {
super(props, context);
}
public render() { public render() {
const { appConfig: { title: appTitle }, title, description, t } = this.props; const { appConfig: { title: appTitle }, title, description } = this.props;
return ( return (
<Helmet> <Helmet>
<title>{ t(stripHtml( appTitle ? (appTitle + ' ' + title).trim() : title)) }</title> <title>{ stripHtml( appTitle ? (appTitle + ' ' + title).trim() : title) }</title>
{ description && <meta name="description" content={ t(description) } /> } { description && <meta name="description" content={ stripHtml(description) } /> }
</Helmet> </Helmet>
); );
} }
...@@ -31,4 +27,4 @@ const mapStateToProps = (state) => ({ ...@@ -31,4 +27,4 @@ const mapStateToProps = (state) => ({
appConfig: state.appConfig.config, appConfig: state.appConfig.config,
}); });
export default connect(mapStateToProps)(withTranslation()(PageTitle)); export default connect(mapStateToProps)(PageTitle);
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment