Skip to content

Commit

Permalink
STCOR-767 restore correct page titles
Browse files Browse the repository at this point in the history
PR #1532 inadvertently undid the work of PR #1377. This restores it.

Refs STCOR-767, STCOR-875
  • Loading branch information
zburke committed Sep 24, 2024
1 parent 181b42a commit 8281d49
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/components/TitleManager/TitleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,25 @@ class TitleManager extends React.Component {
static defaultProps = { prefix: '' }

renderTitle = (currentTitle) => {
const { prefix, page, record } = this.props;
const { prefix, page, record, stripes } = this.props;
const postfix = stripes.config?.platformName || APP;

if (typeof currentTitle !== 'string') return '';

const tokens = currentTitle.split(' - ');

/**
* When there are 2 items - that means there are page and postfix.
* If we don't clear the tokens[1] item then we'll have two postfixes - in tokens[1] and tokens[2] will be added later
*/
if (tokens.length === 2) {
tokens[1] = '';
}

if (page) tokens[0] = page;
if (record) tokens[1] = record;

tokens[2] = (this.props.stripes.config || {}).platformName || APP;
tokens[2] = postfix;

return prefix + tokens
.filter(t => t)
Expand All @@ -45,4 +55,4 @@ class TitleManager extends React.Component {
}
}

export default withStripes(TitleManager);
export default withStripes(TitleManager);

Check failure on line 58 in src/components/TitleManager/TitleManager.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

Newline required at end of file but not found

Check failure on line 58 in src/components/TitleManager/TitleManager.js

View workflow job for this annotation

GitHub Actions / ui / Install and lint / Install and lint

Newline required at end of file but not found

0 comments on commit 8281d49

Please sign in to comment.