-
+
diff --git a/workspaces/ui-express/src/constants/pageTitle.ts b/workspaces/ui-express/src/constants/pageTitle.ts
deleted file mode 100644
index 1721f760fdce365f816e828d841ecc0e87173b9a..0000000000000000000000000000000000000000
--- a/workspaces/ui-express/src/constants/pageTitle.ts
+++ /dev/null
@@ -1 +0,0 @@
-export const SET_PAGE_TITLE = 'SET_PAGE_TITLE';
diff --git a/workspaces/ui-express/src/reducers/index.ts b/workspaces/ui-express/src/reducers/index.ts
index 02f9069cd79a7698a3310347c19dcee3064c6de8..09fe7444b5d64c5dc48369f6954383a3b60dddd3 100644
--- a/workspaces/ui-express/src/reducers/index.ts
+++ b/workspaces/ui-express/src/reducers/index.ts
@@ -5,7 +5,6 @@ import login from './login';
import serverInfo from './serverInfo';
import appMounted from './appMounted';
import historyReducer from './history';
-import pageTitle from './pageTitle';
import snackbar from './snackbar';
import filterCode from './filterCode';
import decoder from './decoder';
@@ -41,7 +40,6 @@ const rootReducer = (history?) => combineReducers({
history: historyReducer,
login,
serverInfo,
- pageTitle,
applicationConfig,
snackbar,
filterCode,
diff --git a/workspaces/ui-express/src/reducers/pageTitle.ts b/workspaces/ui-express/src/reducers/pageTitle.ts
deleted file mode 100644
index 5a3ae553fc69f71200b787dd7660796bc409f5bf..0000000000000000000000000000000000000000
--- a/workspaces/ui-express/src/reducers/pageTitle.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-import update from 'immutability-helper';
-
-import { SET_PAGE_TITLE } from 'constants/pageTitle';
-
-const INITIAL_STATE: {
- title: string,
-} = {
- title: 'Genesys PGR',
-};
-
-export default (state = INITIAL_STATE, action: { type?: string, payload?: any } = {type: '', payload: {}}) => {
-
- switch (action.type) {
- case SET_PAGE_TITLE: {
- if (typeof window !== 'undefined') {
- window.document.title = action.payload;
- }
- return update(state, {
- title: {$set: action.payload},
- });
- }
-
- default:
- return state;
- }
-}
diff --git a/workspaces/ui-express/src/ui/App.tsx b/workspaces/ui-express/src/ui/App.tsx
index d38a20dce150afcf3fadaa0ff068ffefb28bda19..e46e1c3b0313932ea86f3fef5c79d011f1347ff8 100644
--- a/workspaces/ui-express/src/ui/App.tsx
+++ b/workspaces/ui-express/src/ui/App.tsx
@@ -2,7 +2,6 @@ import * as React from 'react';
import { WithTranslation, withTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
-import * as _ from 'lodash';
import { updateHistory } from 'actions/history';
import { loadCrops } from 'crop/actions/public';
@@ -20,7 +19,6 @@ import Snackbar from 'ui/common/snackbar/Snackbar';
import renderRoutes from 'ui/renderRoutes';
import Crop from '@genesys/client/model/genesys/Crop';
import ApiCall from '@genesys/client/model/ApiCall';
-import ActivityPost from '@genesys/client/model/cms/ActivityPost';
interface IAppProps extends React.ClassAttributes
, WithTranslation {
@@ -38,7 +36,6 @@ interface IAppProps extends React.ClassAttributes, WithTranslation {
serverInfoRequest: any;
checkSoftwareVersion: any;
initMyMaps: any;
- currentPost: ApiCall;
refreshIso3Decodings: (lang: string) => void;
lang: string;
}
@@ -68,8 +65,8 @@ class App extends React.Component {
}
public componentDidUpdate(prevProps: IAppProps) {
- const {updateHistory, currentPost: prevPost, location: prevLocation} = prevProps;
- const {currentPost, location} = this.props;
+ const {updateHistory, location: prevLocation} = prevProps;
+ const {location} = this.props;
if (prevLocation !== null && location !== null) {
if (prevLocation !== location) {
if (typeof window !== 'undefined') {
@@ -87,24 +84,6 @@ class App extends React.Component {
}
}
- if (currentPost && currentPost.data && prevPost && !_.isEqual(prevPost, currentPost)) {
- const metaDescription = document.querySelector('meta[name="description"]');
- if (currentPost.data.summary) {
- if (metaDescription) {
- metaDescription.setAttribute('content', currentPost.data.summary);
- } else {
- const descriptionEl = document.createElement('meta');
- descriptionEl.setAttribute('name', 'description');
- descriptionEl.setAttribute('content', currentPost.data.summary);
- document.getElementsByTagName('head')[0].appendChild(descriptionEl);
- }
- } else {
- if (metaDescription) {
- metaDescription.remove();
- }
- }
- }
-
const {countryCodes, loadIso3Decodings, i18n, tReady} = this.props;
if (tReady && (!countryCodes || (!countryCodes.loading && !countryCodes.error && !countryCodes.data))) {
loadIso3Decodings(i18n.language);
@@ -128,7 +107,6 @@ const mapStateToProps = (state) => ({
crops: state.crop.public.list ? state.crop.public.list.data : undefined,
serverInfo: state.serverInfo.data,
lang: state.applicationConfig.lang,
- currentPost: state.cms.public.activityPost.currentPost,
});
const mapDispatchToProps = (dispatch) => bindActionCreators({
diff --git a/workspaces/ui-express/src/ui/common/PageTitle.ts b/workspaces/ui-express/src/ui/common/PageTitle.ts
deleted file mode 100644
index 5c70587fb46f0fbb6c52822eca47a5ba48ba3b35..0000000000000000000000000000000000000000
--- a/workspaces/ui-express/src/ui/common/PageTitle.ts
+++ /dev/null
@@ -1,43 +0,0 @@
-import * as React from 'react';
-import { connect } from 'react-redux';
-import { bindActionCreators } from 'redux';
-
-import { setPageTitle } from 'actions/pageTitle';
-
-interface IPageTitleProps extends React.ClassAttributes {
- title: string;
- setPageTitle?: (title: string) => void;
-}
-
-class PageTitle extends React.Component {
-
- public constructor(props) {
- super(props);
- const { setPageTitle, title } = props;
- if (title && setPageTitle) {
- setPageTitle(title.split('*').join(''));
- }
- }
-
- public componentDidUpdate(prevProps, prevState, snapshot) {
- const { title: oldTitle } = prevProps;
- const { title, setPageTitle} = this.props;
-
- if (title && setPageTitle) {
- if (title !== oldTitle) {
- setPageTitle(title.split('*').join(''));
- }
- }
- }
-
- public render() {
- return null;
- }
-}
-
-const mapDispatchToProps = (dispatch) => bindActionCreators({
- setPageTitle,
-}, dispatch);
-
-
-export default connect(null, mapDispatchToProps)(PageTitle);
diff --git a/workspaces/ui-express/src/ui/common/PageTitle.tsx b/workspaces/ui-express/src/ui/common/PageTitle.tsx
new file mode 100644
index 0000000000000000000000000000000000000000..aeaa9126e4fd348c41164be2e8741ea937237e9c
--- /dev/null
+++ b/workspaces/ui-express/src/ui/common/PageTitle.tsx
@@ -0,0 +1,28 @@
+import * as React from 'react';
+import { WithTranslation, withTranslation } from 'react-i18next';
+import { Helmet } from 'react-helmet-async';
+import { stripHtml } from '@genesys/client/utilities';
+
+interface IPageTitle extends React.ClassAttributes, WithTranslation {
+ title: string;
+ description?: string;
+}
+
+class PageTitle extends React.Component {
+ public constructor(props, context) {
+ super(props, context);
+ }
+
+ public render() {
+ const { title, description, t } = this.props;
+
+ return (
+
+ { t(stripHtml(title)) }
+ { description && }
+
+ );
+ }
+}
+
+export default withTranslation()(PageTitle);
diff --git a/yarn.lock b/yarn.lock
index 705dacd8dcf318555511cf6437f53773c74d7907..ce91b62c5c6c4cb37988b9e25f0dd37b06df2d44 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -151,7 +151,7 @@
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.4"
-"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
+"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.1", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.4", "@babel/runtime@^7.5.5", "@babel/runtime@^7.7.2", "@babel/runtime@^7.8.3", "@babel/runtime@^7.8.7", "@babel/runtime@^7.9.2":
version "7.11.2"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.11.2.tgz#f549c13c754cc40b87644b9fa9f09a6a95fe0736"
integrity sha512-TeWkU52so0mPtDcaCTxNBI/IHiz0pZgr8VEFqXFtZWpYD08ZB6FaSwVAS8MKRQAP3bYKiVjwysOJgMFY28o6Tw==
@@ -11247,6 +11247,11 @@ react-dom@^16.13.1:
prop-types "^15.6.2"
scheduler "^0.19.1"
+react-fast-compare@^3.2.0:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.0.tgz#641a9da81b6a6320f270e89724fb45a0b39e43bb"
+ integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA==
+
react-fontawesome@^1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/react-fontawesome/-/react-fontawesome-1.7.1.tgz#f74f5a338fef3ee3b379820109c1cba47290f035"
@@ -11270,6 +11275,17 @@ react-google-recaptcha@^2.0.1:
prop-types "^15.5.0"
react-async-script "^1.1.1"
+react-helmet-async@^1.0.7:
+ version "1.0.7"
+ resolved "https://registry.yarnpkg.com/react-helmet-async/-/react-helmet-async-1.0.7.tgz#b988fbc3abdc4b704982bb74b9cb4a08fcf062c1"
+ integrity sha512-By90p5uxAriGukbyejq2poK41DwTxpNWOpOjN8mIyX/BKrCd3+sXZ5pHUZXjHyjR5OYS7PGsOD9dbM61YxfFmA==
+ dependencies:
+ "@babel/runtime" "^7.11.2"
+ invariant "^2.2.4"
+ prop-types "^15.7.2"
+ react-fast-compare "^3.2.0"
+ shallowequal "^1.1.0"
+
react-hot-loader@^4.12.20:
version "4.12.21"
resolved "https://registry.yarnpkg.com/react-hot-loader/-/react-hot-loader-4.12.21.tgz#332e830801fb33024b5a147d6b13417f491eb975"